annotate README.md @ 101:57be7094d6c5

updated Google plugin for latest SDK
author Alain Mazy <am@osimis.io>
date Thu, 20 Jul 2023 16:14:39 +0200
parents d65580d2e9ca
children 6aa3ec905f58
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
fc26a8fc54d5 initial release
Alain Mazy <alain@mazy.be>
parents:
diff changeset
1 # README #
fc26a8fc54d5 initial release
Alain Mazy <alain@mazy.be>
parents:
diff changeset
2
fc26a8fc54d5 initial release
Alain Mazy <alain@mazy.be>
parents:
diff changeset
3 Orthanc object-storages plugin for main cloud providers (Google/Azure/AWS)
fc26a8fc54d5 initial release
Alain Mazy <alain@mazy.be>
parents:
diff changeset
4
4
55ce49bf32b3 readme links to orthanc book doc
Alain Mazy <alain@mazy.be>
parents: 1
diff changeset
5 Check the [Orthanc book](https://book.orthanc-server.com/plugins/object-storage.html) for complete documentation.
1
fc26a8fc54d5 initial release
Alain Mazy <alain@mazy.be>
parents:
diff changeset
6
5
Alain Mazy
parents: 4
diff changeset
7 ## info for developers ##
Alain Mazy
parents: 4
diff changeset
8
Alain Mazy
parents: 4
diff changeset
9 Here's a sample configuration file of the `StorageEncryption` section of the plugins:
Alain Mazy
parents: 4
diff changeset
10
Alain Mazy
parents: 4
diff changeset
11 ```
Alain Mazy
parents: 4
diff changeset
12 {
15
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
13 "GoogleCloudStorage" : {
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
14 "StorageEncryption" : {
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
15 "Enable": true,
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
16 "MasterKey": [3, "/path/to/master.key"], // key id - path to the base64 encoded key
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
17 "PreviousMasterKeys" : [
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
18 [ 1, "/path/to/previous1.key"],
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
19 [ 2, "/path/to/previous2.key"]
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
20 ],
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
21 "MaxConcurrentInputSize" : 1024 // size in MB
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
22 }
5
Alain Mazy
parents: 4
diff changeset
23 }
Alain Mazy
parents: 4
diff changeset
24 }
Alain Mazy
parents: 4
diff changeset
25 ```
Alain Mazy
parents: 4
diff changeset
26
Alain Mazy
parents: 4
diff changeset
27 ### Compile Google plugin ###
Alain Mazy
parents: 4
diff changeset
28
101
57be7094d6c5 updated Google plugin for latest SDK
Alain Mazy <am@osimis.io>
parents: 90
diff changeset
29 On Linux, with vcpkg version `2023.06.20`:
57be7094d6c5 updated Google plugin for latest SDK
Alain Mazy <am@osimis.io>
parents: 90
diff changeset
30
57be7094d6c5 updated Google plugin for latest SDK
Alain Mazy <am@osimis.io>
parents: 90
diff changeset
31 * `./vcpkg install google-cloud-cpp[storage]`
5
Alain Mazy
parents: 4
diff changeset
32 * `./vcpkg install cryptopp`
Alain Mazy
parents: 4
diff changeset
33 * `hg clone ...`
Alain Mazy
parents: 4
diff changeset
34 * `mkdir -p build/google`
Alain Mazy
parents: 4
diff changeset
35 * `cd build/google`
15
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
36 * `cmake -DCMAKE_TOOLCHAIN_FILE=[vcpkg root]\scripts\buildsystems\vcpkg.cmake ../../orthanc-object-storage/Google`
5
Alain Mazy
parents: 4
diff changeset
37
Alain Mazy
parents: 4
diff changeset
38 ### Google plugin configuration ###
Alain Mazy
parents: 4
diff changeset
39
Alain Mazy
parents: 4
diff changeset
40 ```
Alain Mazy
parents: 4
diff changeset
41 "GoogleCloudStorage" : {
15
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
42 "ServiceAccountFile" : "/.../googleServiceAccountFile.json",
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
43 "BucketName": "test-orthanc-storage-plugin",
20
968eb1c78aed Added 'RootPath' configuration
Alain Mazy
parents: 15
diff changeset
44 "RootPath": "", // optional: folder in which files are stored (ex: my/path/to/myfolder)
15
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
45 "StorageEncryption" : {...},
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
46 "StorageStructure" : "flat",
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
47 "MigrationFromFileSystemEnabled" : false
5
Alain Mazy
parents: 4
diff changeset
48 }
Alain Mazy
parents: 4
diff changeset
49
Alain Mazy
parents: 4
diff changeset
50 ```
Alain Mazy
parents: 4
diff changeset
51
Alain Mazy
parents: 4
diff changeset
52 ## Azure Blob Storage plugin ##
Alain Mazy
parents: 4
diff changeset
53
Alain Mazy
parents: 4
diff changeset
54 ### Prerequisites ###
Alain Mazy
parents: 4
diff changeset
55
Alain Mazy
parents: 4
diff changeset
56 * Install [vcpkg](https://github.com/Microsoft/vcpkg)
Alain Mazy
parents: 4
diff changeset
57
Alain Mazy
parents: 4
diff changeset
58 ### Compile Azure plugin ###
Alain Mazy
parents: 4
diff changeset
59
101
57be7094d6c5 updated Google plugin for latest SDK
Alain Mazy <am@osimis.io>
parents: 90
diff changeset
60 On Linux, with vcpkg version `2023.06.20`:
34
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
61
101
57be7094d6c5 updated Google plugin for latest SDK
Alain Mazy <am@osimis.io>
parents: 90
diff changeset
62 * `./vcpkg install azure-core-cpp azure-storage-blobs-cpp`
34
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
63 * `./vcpkg install cryptopp`
5
Alain Mazy
parents: 4
diff changeset
64 * `hg clone ...`
Alain Mazy
parents: 4
diff changeset
65 * `mkdir -p build/azure`
Alain Mazy
parents: 4
diff changeset
66 * `cd build/azure`
Alain Mazy
parents: 4
diff changeset
67 * `cmake -DCMAKE_TOOLCHAIN_FILE=[vcpkg root]\scripts\buildsystems\vcpkg.cmake ../../orthanc-object-storage/Azure`
Alain Mazy
parents: 4
diff changeset
68
101
57be7094d6c5 updated Google plugin for latest SDK
Alain Mazy <am@osimis.io>
parents: 90
diff changeset
69 On Windows, with vcpkg version `2023.06.20` :
34
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
70
101
57be7094d6c5 updated Google plugin for latest SDK
Alain Mazy <am@osimis.io>
parents: 90
diff changeset
71 * `.\vcpkg.exe install azure-storage-blobs-cpp:x64-windows-static`
34
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
72 * `.\vcpkg.exe install cryptopp:x64-windows-static`
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
73 * `hg clone ...`
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
74 * `mkdir -p build/azure`
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
75 * `cd build/azure`
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
76 * `cmake -DCMAKE_TOOLCHAIN_FILE=[vcpkg root]\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE="Release" ../../orthanc-object-storage/Azure`
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
77 * `cmake --build . --config Release`
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
78
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
79
5
Alain Mazy
parents: 4
diff changeset
80 ### Azure plugin configuration ###
Alain Mazy
parents: 4
diff changeset
81
Alain Mazy
parents: 4
diff changeset
82 ```
Alain Mazy
parents: 4
diff changeset
83 "AzureBlobStorage" : {
Alain Mazy
parents: 4
diff changeset
84 "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=xxxxxxxxx;AccountKey=yyyyyyyy===;EndpointSuffix=core.windows.net",
15
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
85 "ContainerName" : "test-orthanc-storage-plugin",
50
Alain Mazy <am@osimis.io>
parents: 48
diff changeset
86 "CreateContainerIfNotExists": true, // available from version 1.2.0
20
968eb1c78aed Added 'RootPath' configuration
Alain Mazy
parents: 15
diff changeset
87 "RootPath": "", // optional: folder in which files are stored (ex: my/path/to/myfolder)
15
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
88 "StorageEncryption" : {...},
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
89 "StorageStructure" : "flat",
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
90 "MigrationFromFileSystemEnabled" : false
5
Alain Mazy
parents: 4
diff changeset
91 }
Alain Mazy
parents: 4
diff changeset
92 ```
Alain Mazy
parents: 4
diff changeset
93
Alain Mazy
parents: 4
diff changeset
94 ## AWS S3 Storage plugin ##
Alain Mazy
parents: 4
diff changeset
95
Alain Mazy
parents: 4
diff changeset
96 ### Prerequisites ###
Alain Mazy
parents: 4
diff changeset
97
Alain Mazy
parents: 4
diff changeset
98 * Install [vcpkg](https://github.com/Microsoft/vcpkg)
Alain Mazy
parents: 4
diff changeset
99
Alain Mazy
parents: 4
diff changeset
100 * compile the AWS C++ SDK
Alain Mazy
parents: 4
diff changeset
101
Alain Mazy
parents: 4
diff changeset
102 ```
Alain Mazy
parents: 4
diff changeset
103
Alain Mazy
parents: 4
diff changeset
104 mkdir ~/aws
Alain Mazy
parents: 4
diff changeset
105 cd ~/aws
Alain Mazy
parents: 4
diff changeset
106 git clone https://github.com/aws/aws-sdk-cpp.git
Alain Mazy
parents: 4
diff changeset
107
Alain Mazy
parents: 4
diff changeset
108 mkdir -p ~/aws/builds/aws-sdk-cpp
Alain Mazy
parents: 4
diff changeset
109 cd ~/aws/builds/aws-sdk-cpp
Alain Mazy
parents: 4
diff changeset
110 cmake -DBUILD_ONLY="s3;transfer" ~/aws/aws-sdk-cpp
Alain Mazy
parents: 4
diff changeset
111 make -j 4
Alain Mazy
parents: 4
diff changeset
112 make install
Alain Mazy
parents: 4
diff changeset
113 ```
Alain Mazy
parents: 4
diff changeset
114
Alain Mazy
parents: 4
diff changeset
115 ### Compile AWS S3 plugin ###
Alain Mazy
parents: 4
diff changeset
116
Alain Mazy
parents: 4
diff changeset
117 * `./vcpkg install cryptopp`
Alain Mazy
parents: 4
diff changeset
118 * `hg clone ...`
Alain Mazy
parents: 4
diff changeset
119 * `mkdir -p build/aws`
Alain Mazy
parents: 4
diff changeset
120 * `cd build/aws`
Alain Mazy
parents: 4
diff changeset
121 * `cmake -DCMAKE_TOOLCHAIN_FILE=[vcpkg root]\scripts\buildsystems\vcpkg.cmake ../../orthanc-object-storage/Aws`
Alain Mazy
parents: 4
diff changeset
122
54
Alain Mazy <am@osimis.io>
parents: 50
diff changeset
123 ### AWS S3 plugin configuration ###
5
Alain Mazy
parents: 4
diff changeset
124
Alain Mazy
parents: 4
diff changeset
125 ```
Alain Mazy
parents: 4
diff changeset
126 "AwsS3Storage" : {
Alain Mazy
parents: 4
diff changeset
127 "BucketName": "test-orthanc-s3-plugin",
Alain Mazy
parents: 4
diff changeset
128 "Region" : "eu-central-1",
54
Alain Mazy <am@osimis.io>
parents: 50
diff changeset
129 "AccessKey" : "AKXXX", // optional: if not specified, the plugin will use the default credentials manager (from version 1.3.0)
Alain Mazy <am@osimis.io>
parents: 50
diff changeset
130 "SecretKey" : "RhYYYY", // optional: if not specified, the plugin will use the default credentials manager (from version 1.3.0)
6
393fcf337462 AWS: added 3 configurations: Endpoint, ConnectionTimeout, RequestTimeout
Alain Mazy
parents: 5
diff changeset
131 "Endpoint": "", // optional: custom endpoint
393fcf337462 AWS: added 3 configurations: Endpoint, ConnectionTimeout, RequestTimeout
Alain Mazy
parents: 5
diff changeset
132 "ConnectionTimeout": 30, // optional: connection timeout in seconds
15
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
133 "RequestTimeout": 1200, // optional: request timeout in seconds (max time to upload/download a file)
20
968eb1c78aed Added 'RootPath' configuration
Alain Mazy
parents: 15
diff changeset
134 "RootPath": "", // optional: folder in which files are stored (ex: my/path/to/myfolder)
968eb1c78aed Added 'RootPath' configuration
Alain Mazy
parents: 15
diff changeset
135 "StorageEncryption" : {...}, // optional
968eb1c78aed Added 'RootPath' configuration
Alain Mazy
parents: 15
diff changeset
136 "StorageStructure" : "flat", // optional
77
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
137 "MigrationFromFileSystemEnabled" : false, // optional (deprecated, is now equivalent to "HybridMode": "WriteToObjectStorage")
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
138 "HybridMode": "WriteToDisk" // "WriteToDisk", "WriteToObjectStorage", "Disabled"
5
Alain Mazy
parents: 4
diff changeset
139 }
77
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
140 ```
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
141
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
142 ### Testing the S3 plugin with minio
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
143
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
144 ```
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
145 docker run -p 9000:9000 -p 9001:9001 -e MINIO_REGION=eu-west-1 -e MINIO_ROOT_USER=minio -e MINIO_ROOT_PASSWORD=miniopwd minio/minio server /data --console-address ":9001"
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
146 ```
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
147
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
148 config file:
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
149 ```
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
150 "AwsS3Storage" : {
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
151 "BucketName": "orthanc",
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
152 "Region": "eu-west-1",
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
153 "Endpoint": "http://127.0.0.1:9000/",
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
154 "AccessKey": "minio",
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
155 "SecretKey": "miniopwd",
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
156 "VirtualAddressing": false
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
157
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
158 // "StorageEncryption" : {
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
159 // "Enable": true,
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
160 // "MasterKey": [1, "/home/test/encryption/test.key"],
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
161 // "MaxConcurrentInputSize": 1024,
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
162 // "Verbose": true
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
163 // } // optional: see the section related to encryption
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
164 }
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
165
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
166 ```
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
167
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
168 Test the hybrid mode
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
169 - start in "HybridMode": "WriteToFileSystem",
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
170 - upload instances 1 & 2
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
171 - restart in "HybridMode": "WriteToObjectStorage",
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
172 - check that you can read instance 1 and that you can delete it
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
173 - upload instances 3 & 4
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
174 - restart in "HybridMode": "WriteToFileSystem",
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
175 - check that you can read instance 3 and that you can delete it
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
176 - final check:
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
177 - there should be only one file in the disk storage
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
178 - there should be only one file in the S3 bucket
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
179
83
431ab61b5760 /move-storage when HybridMode is enabled
Alain Mazy <am@osimis.io>
parents: 77
diff changeset
180 test moving a study to file-system storage
431ab61b5760 /move-storage when HybridMode is enabled
Alain Mazy <am@osimis.io>
parents: 77
diff changeset
181 curl http://localhost:8043/move-storage -d '{"Resources": ["737c0c8d-ea890b4d-e36a43bb-fb8c8d41-aa0ed0a8"], "TargetStorage" : "file-system"}'
431ab61b5760 /move-storage when HybridMode is enabled
Alain Mazy <am@osimis.io>
parents: 77
diff changeset
182 curl http://localhost:8043/move-storage -d '{"Resources": ["737c0c8d-ea890b4d-e36a43bb-fb8c8d41-aa0ed0a8"], "TargetStorage" : "object-storage"}'