@@ -181,14 +181,16 @@ As mentioned above, the docker images are built with a `UID:GID`
181
181
dervied from account used to build the images. If you would prefer to
182
182
use a different identity, the ` --user ` switch to the ` docker run `
183
183
command will override the builtin identities. This can be especially
184
- useful if the images are stored in a repository .
184
+ useful if the images are stored in a registry .
185
185
186
+ <!-- -
186
187
** NOTE: ** We need a better way to process registrations for SGX HW mode. In
187
188
theory, the best way to do this may be to create a canonical base
188
189
services image; populate an instance of it with CCF private keys, run
189
190
the registration. That way the canonical base service image would have
190
191
a standard version of the enclave library that would not have to deal
191
192
with reproducible builds.
193
+ --->
192
194
193
195
### CCF Deployment ###
194
196
@@ -305,3 +307,74 @@ For example:
305
307
``` bash
306
308
user@has:/project/pdo# source /project/pdo/tools/start_client.sh --ledger http://127.0.0.1:6600/
307
309
```
310
+
311
+ <!-- - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --->
312
+ ## Pattern: Deploy PDO Images Through a Registry ##
313
+
314
+ Deploying PDO images through a Docker registry additionally requires
315
+ creation of an account used to run the PDO services. Since services
316
+ are configured through a shared host file system (the ` xfer ` directory
317
+ tree) permissions must be set appropriately.
318
+
319
+ ### Build the Images ###
320
+
321
+ PDO images that will be pushed to a shared registry should be built
322
+ with a unique user identity that is unlikely to exist on the servers
323
+ where it will be deployed. The UID that is used by default when
324
+ building the images in the GitHub registry is 55172. The following
325
+ statement will build PDO images with that UID.
326
+
327
+ ``` bash
328
+ make PDO_USER_UID=55172 PDO_GROUP_UID=55172
329
+ ```
330
+
331
+ Once built, use the standard docker commands to push the images to
332
+ your registry. If you wish to do PDO service development, you will
333
+ need access to all of the images (` pdo_base ` , ` pdo_services_base ` ,
334
+ ` pdo_services ` , ` pdo_client ` , ` pdo_ccf_base ` , and ` pdo_ccf ` ). For
335
+ using and developing contracts the only necessary images are
336
+ ` pdo_services ` , ` pdo_client ` and ` pdo_ccf ` .
337
+
338
+ * Note* : prebuilt images are often available from the GitHub container
339
+ registry through
340
+ [ Hyperledger Labs] ( https://github.com/orgs/hyperledger-labs/packages?q=pdo ) .
341
+ These images can be pulled using standard docker commands such as:
342
+
343
+ ``` bash
344
+ docker pull ghcr.io/hyperledger-labs/pdo_client:latest
345
+ docker pull ghcr.io/hyperledger-labs/pdo_services:latest
346
+ docker pull ghcr.io/hyperledger-labs/pdo_ccf:latest
347
+ ```
348
+
349
+ ### Create Accounts ###
350
+
351
+ To manage local storage associated with the containers (specifically
352
+ the contents of the ` xfer ` directory), create a local user/group
353
+ account that corresponds to the UIDs used in the PDO images. The
354
+ following commands create a ` pdo_user ` user and group with UIDs that
355
+ correspond to the ones used above (and consistent with the identities
356
+ used in the images in GHCR:
357
+
358
+ ``` bash
359
+ sudo addgroup --gid 55172 pdo_user
360
+ sudo adduser --uid 55172 --gid 55172 --disabled-login --no-create-home pdo_user
361
+ ```
362
+
363
+ Next, add the local user that will be used to manage the containers to
364
+ the ` pdo_user ` group.
365
+
366
+ ``` bash
367
+ sudo adduser < username> pdo_user
368
+ ```
369
+
370
+ And, finally, change the ` xfer ` directory ownership and permissions to
371
+ give group users write permission.
372
+
373
+ ``` bash
374
+ sudo chown -R pdo_user:pdo_user xfer
375
+ sudo chmod -R g+w xfer
376
+ ```
377
+
378
+ At this point, you should be able to use the instructions above for
379
+ [ Service Deployment] ( #pattern:-service-deployment ) using the PDO
380
+ images.
0 commit comments