annotate README.md @ 99:f4e05641c108

rewrote using the latest azure C++ sdk
author Alain Mazy <am@osimis.io>
date Thu, 20 Jul 2023 15:09:57 +0200
parents d65580d2e9ca
children 57be7094d6c5
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
Alain Mazy
parents: 4
diff changeset
29 * `./vcpkg install google-cloud-cpp`
Alain Mazy
parents: 4
diff changeset
30 * `./vcpkg install cryptopp`
Alain Mazy
parents: 4
diff changeset
31 * `hg clone ...`
Alain Mazy
parents: 4
diff changeset
32 * `mkdir -p build/google`
Alain Mazy
parents: 4
diff changeset
33 * `cd build/google`
15
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
34 * `cmake -DCMAKE_TOOLCHAIN_FILE=[vcpkg root]\scripts\buildsystems\vcpkg.cmake ../../orthanc-object-storage/Google`
5
Alain Mazy
parents: 4
diff changeset
35
Alain Mazy
parents: 4
diff changeset
36 ### Google plugin configuration ###
Alain Mazy
parents: 4
diff changeset
37
Alain Mazy
parents: 4
diff changeset
38 ```
Alain Mazy
parents: 4
diff changeset
39 "GoogleCloudStorage" : {
15
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
40 "ServiceAccountFile" : "/.../googleServiceAccountFile.json",
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
41 "BucketName": "test-orthanc-storage-plugin",
20
968eb1c78aed Added 'RootPath' configuration
Alain Mazy
parents: 15
diff changeset
42 "RootPath": "", // optional: folder in which files are stored (ex: my/path/to/myfolder)
15
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
43 "StorageEncryption" : {...},
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
44 "StorageStructure" : "flat",
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
45 "MigrationFromFileSystemEnabled" : false
5
Alain Mazy
parents: 4
diff changeset
46 }
Alain Mazy
parents: 4
diff changeset
47
Alain Mazy
parents: 4
diff changeset
48 ```
Alain Mazy
parents: 4
diff changeset
49
Alain Mazy
parents: 4
diff changeset
50 ## Azure Blob Storage plugin ##
Alain Mazy
parents: 4
diff changeset
51
Alain Mazy
parents: 4
diff changeset
52 ### Prerequisites ###
Alain Mazy
parents: 4
diff changeset
53
Alain Mazy
parents: 4
diff changeset
54 * Install [vcpkg](https://github.com/Microsoft/vcpkg)
Alain Mazy
parents: 4
diff changeset
55
Alain Mazy
parents: 4
diff changeset
56 ### Compile Azure plugin ###
Alain Mazy
parents: 4
diff changeset
57
90
Alain Mazy <alain@mazy.be>
parents: 83
diff changeset
58 On Linux, with vcpkg version `2022.11.14`:
34
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
59
5
Alain Mazy
parents: 4
diff changeset
60 * `./vcpkg install cpprestsdk`
34
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
61 * `./vcpkg install cryptopp`
5
Alain Mazy
parents: 4
diff changeset
62 * `hg clone ...`
Alain Mazy
parents: 4
diff changeset
63 * `mkdir -p build/azure`
Alain Mazy
parents: 4
diff changeset
64 * `cd build/azure`
Alain Mazy
parents: 4
diff changeset
65 * `cmake -DCMAKE_TOOLCHAIN_FILE=[vcpkg root]\scripts\buildsystems\vcpkg.cmake ../../orthanc-object-storage/Azure`
Alain Mazy
parents: 4
diff changeset
66
90
Alain Mazy <alain@mazy.be>
parents: 83
diff changeset
67 On Windows, with vcpkg version `2022.11.14` :
34
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
68
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
69 * `.\vcpkg.exe install cpprestsdk:x64-windows-static`
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
70 * `.\vcpkg.exe install azure-storage-cpp:x64-windows-static`
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
71 * `.\vcpkg.exe install cryptopp:x64-windows-static`
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
72 * `hg clone ...`
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
73 * `mkdir -p build/azure`
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
74 * `cd build/azure`
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
75 * `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
76 * `cmake --build . --config Release`
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
77
7ddd840563c9 windows build for Azure plugin
Alain Mazy <alain@mazy.be>
parents: 20
diff changeset
78
5
Alain Mazy
parents: 4
diff changeset
79 ### Azure plugin configuration ###
Alain Mazy
parents: 4
diff changeset
80
Alain Mazy
parents: 4
diff changeset
81 ```
Alain Mazy
parents: 4
diff changeset
82 "AzureBlobStorage" : {
Alain Mazy
parents: 4
diff changeset
83 "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=xxxxxxxxx;AccountKey=yyyyyyyy===;EndpointSuffix=core.windows.net",
15
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
84 "ContainerName" : "test-orthanc-storage-plugin",
50
Alain Mazy <am@osimis.io>
parents: 48
diff changeset
85 "CreateContainerIfNotExists": true, // available from version 1.2.0
20
968eb1c78aed Added 'RootPath' configuration
Alain Mazy
parents: 15
diff changeset
86 "RootPath": "", // optional: folder in which files are stored (ex: my/path/to/myfolder)
15
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
87 "StorageEncryption" : {...},
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
88 "StorageStructure" : "flat",
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
89 "MigrationFromFileSystemEnabled" : false
5
Alain Mazy
parents: 4
diff changeset
90 }
Alain Mazy
parents: 4
diff changeset
91 ```
Alain Mazy
parents: 4
diff changeset
92
Alain Mazy
parents: 4
diff changeset
93 ## AWS S3 Storage plugin ##
Alain Mazy
parents: 4
diff changeset
94
Alain Mazy
parents: 4
diff changeset
95 ### Prerequisites ###
Alain Mazy
parents: 4
diff changeset
96
Alain Mazy
parents: 4
diff changeset
97 * Install [vcpkg](https://github.com/Microsoft/vcpkg)
Alain Mazy
parents: 4
diff changeset
98
Alain Mazy
parents: 4
diff changeset
99 * compile the AWS C++ SDK
Alain Mazy
parents: 4
diff changeset
100
Alain Mazy
parents: 4
diff changeset
101 ```
Alain Mazy
parents: 4
diff changeset
102
Alain Mazy
parents: 4
diff changeset
103 mkdir ~/aws
Alain Mazy
parents: 4
diff changeset
104 cd ~/aws
Alain Mazy
parents: 4
diff changeset
105 git clone https://github.com/aws/aws-sdk-cpp.git
Alain Mazy
parents: 4
diff changeset
106
Alain Mazy
parents: 4
diff changeset
107 mkdir -p ~/aws/builds/aws-sdk-cpp
Alain Mazy
parents: 4
diff changeset
108 cd ~/aws/builds/aws-sdk-cpp
Alain Mazy
parents: 4
diff changeset
109 cmake -DBUILD_ONLY="s3;transfer" ~/aws/aws-sdk-cpp
Alain Mazy
parents: 4
diff changeset
110 make -j 4
Alain Mazy
parents: 4
diff changeset
111 make install
Alain Mazy
parents: 4
diff changeset
112 ```
Alain Mazy
parents: 4
diff changeset
113
Alain Mazy
parents: 4
diff changeset
114 ### Compile AWS S3 plugin ###
Alain Mazy
parents: 4
diff changeset
115
Alain Mazy
parents: 4
diff changeset
116 * `./vcpkg install cryptopp`
Alain Mazy
parents: 4
diff changeset
117 * `hg clone ...`
Alain Mazy
parents: 4
diff changeset
118 * `mkdir -p build/aws`
Alain Mazy
parents: 4
diff changeset
119 * `cd build/aws`
Alain Mazy
parents: 4
diff changeset
120 * `cmake -DCMAKE_TOOLCHAIN_FILE=[vcpkg root]\scripts\buildsystems\vcpkg.cmake ../../orthanc-object-storage/Aws`
Alain Mazy
parents: 4
diff changeset
121
54
Alain Mazy <am@osimis.io>
parents: 50
diff changeset
122 ### AWS S3 plugin configuration ###
5
Alain Mazy
parents: 4
diff changeset
123
Alain Mazy
parents: 4
diff changeset
124 ```
Alain Mazy
parents: 4
diff changeset
125 "AwsS3Storage" : {
Alain Mazy
parents: 4
diff changeset
126 "BucketName": "test-orthanc-s3-plugin",
Alain Mazy
parents: 4
diff changeset
127 "Region" : "eu-central-1",
54
Alain Mazy <am@osimis.io>
parents: 50
diff changeset
128 "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
129 "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
130 "Endpoint": "", // optional: custom endpoint
393fcf337462 AWS: added 3 configurations: Endpoint, ConnectionTimeout, RequestTimeout
Alain Mazy
parents: 5
diff changeset
131 "ConnectionTimeout": 30, // optional: connection timeout in seconds
15
2a02b21f0a19 migration + storage structure
Alain Mazy
parents: 6
diff changeset
132 "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
133 "RootPath": "", // optional: folder in which files are stored (ex: my/path/to/myfolder)
968eb1c78aed Added 'RootPath' configuration
Alain Mazy
parents: 15
diff changeset
134 "StorageEncryption" : {...}, // optional
968eb1c78aed Added 'RootPath' configuration
Alain Mazy
parents: 15
diff changeset
135 "StorageStructure" : "flat", // optional
77
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
136 "MigrationFromFileSystemEnabled" : false, // optional (deprecated, is now equivalent to "HybridMode": "WriteToObjectStorage")
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
137 "HybridMode": "WriteToDisk" // "WriteToDisk", "WriteToObjectStorage", "Disabled"
5
Alain Mazy
parents: 4
diff changeset
138 }
77
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
139 ```
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 ### Testing the S3 plugin with minio
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
142
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 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
145 ```
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 config file:
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
148 ```
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
149 "AwsS3Storage" : {
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
150 "BucketName": "orthanc",
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
151 "Region": "eu-west-1",
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
152 "Endpoint": "http://127.0.0.1:9000/",
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
153 "AccessKey": "minio",
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
154 "SecretKey": "miniopwd",
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
155 "VirtualAddressing": false
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
156
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
157 // "StorageEncryption" : {
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
158 // "Enable": true,
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
159 // "MasterKey": [1, "/home/test/encryption/test.key"],
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
160 // "MaxConcurrentInputSize": 1024,
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
161 // "Verbose": true
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
162 // } // optional: see the section related to encryption
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
163 }
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 Test the hybrid mode
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
168 - start in "HybridMode": "WriteToFileSystem",
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
169 - upload instances 1 & 2
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
170 - restart in "HybridMode": "WriteToObjectStorage",
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
171 - 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
172 - upload instances 3 & 4
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
173 - restart in "HybridMode": "WriteToFileSystem",
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
174 - 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
175 - final check:
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
176 - there should be only one file in the disk storage
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
177 - there should be only one file in the S3 bucket
80792bb9600e new HybridMode
Alain Mazy <am@osimis.io>
parents: 54
diff changeset
178
83
431ab61b5760 /move-storage when HybridMode is enabled
Alain Mazy <am@osimis.io>
parents: 77
diff changeset
179 test moving a study to file-system storage
431ab61b5760 /move-storage when HybridMode is enabled
Alain Mazy <am@osimis.io>
parents: 77
diff changeset
180 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
181 curl http://localhost:8043/move-storage -d '{"Resources": ["737c0c8d-ea890b4d-e36a43bb-fb8c8d41-aa0ed0a8"], "TargetStorage" : "object-storage"}'