-
Fork and Clone the Workshop Repository
-
Have your developer environment setup
-
Navigate to the Python Directory
cd python
-
(Optional) Review API endpoints in the Appendix
-
(Optional) Create a Redis Cluster.
- You can deploy the application without a Redis cluster, but there will be no data persistence.
doctl databases create workshop-redis-cluster --engine redis --region sfo3
-
Build the docker container
docker build -t ots .
-
Add your Redis credentials and run the image locally
docker run -p 8080:8080 --env DB_HOST="<REDIS_HOST_URL>" --env DB_PORT="25061" --env DB_PASSWORD="<REDIS_PASSWORD>" --env DB_SSL=True ots
-
Test with
httpie
- Test write
http POST localhost:8080/secrets message="YOUR_MESSAGE" passphrase="YOUR_PASSPHRASE"
- Sample Response
{ "id": "ea54d2701885400cafd0c11279672c8f", "success": "True" }
- Test read, using the id from above
http POST localhost:8080/secrets/<id> passphrase="YOUR_PASSPHRASE"
- Sample Response
{ "message": "Hello there", "success": "True" }
- Test write
-
Create a DO Container Registry
doctl registry create <your-registry-name> --region sfo3
-
Use the registry login command to authenticate Docker with your registry:
doctl registry login
-
Use the docker tag command to tag your image with the fully qualified destination path:
docker tag ots registry.digitalocean.com/<your-registry>/ots:0.0.1
-
Use the docker push command to upload your image:
docker push registry.digitalocean.com/<your-registry>/ots:0.0.1
-
Allow your image to be used with your Kubernetes Cluster
- Visit the registry page and click the Settings tab.
- In the DigitalOcean Kubernetes integration section, click Edit to display the available Kubernetes clusters.
- Select the clusters and click Save.
- The default service account in each of those namespaces is updated to include the secret in its image pull secret.