DM
Multi-staging Deployment Manager (DM). MD consists of the client and server parts (DMC and DMS accordingly).
Installation
- Install Nix
curl https://nixos.org/nix/install | sh
- Build the project
make build
Interact with DMC
$ result/bin/dmc-exe --help
DMC
Usage: dmc-exe (create | list | edit | destroy | update | info)
Available options:
-h,--help Show this help text
Available commands:
create
list
edit
destroy
update
info
Interact with DMS
$ result/bin/dms-exe --help
DMS
Usage: dms-exe --port INT --db TEXT --db-pool-size INT --tls-cert-path TEXT
--tls-key-path TEXT --tls-store-path TEXT
Available options:
-h,--help Show this help text
Build and publish docker images to ECR
For a build and publish of Docker images you must have needed AWS permissions: access to SSM and ECR!
./release.sh <user|ci|rundesk>
Kubernetes installation
- Deploy DMS's infra
./b2b-helm-tool -d deploy dms-infra
- Clone b2b-helm to
/tmp
git clone https://github.com/Aviora/b2b-helm.git /tmp/b2b-helm
- Give needed permissions for DMS
cd /tmp/b2b-helm/charts/admin && helm install --name dm-helm-access ./helm-access
cd /tmp/b2b-helm/charts/admin && helm install --name dm-pvc-control ./pvc-control
- Deploy DMS
./b2b-helm-tool -d deploy dms:latest
How to deploy a new staging
dmc create --name STAGING_NAME -t DOCKER_IMAGE_TAG -e ENV_VAR1=env_val1 -e ENV_VAR2=env_val2
Or use Docker:
docker run -ti --rm 560065381221.dkr.ecr.us-east-1.amazonaws.com/dmc:latest create --name STAGING_NAME -t DOCKER_IMAGE_TAG -e ENV_VAR1=env_val1 -e ENV_VAR2=env_val2
Note that in our ECR(hosted docker registry) we use a convention of DOCKER_IMAGE_TAG = GIT_SHA. So, if this build was successfully built on github actions CI and docker image was pushed to ECR, you can deploy it without any intermediate steps.
How to override an environment variable in an application
dmc edit --name STAGING_NAME
Or use Docker:
# use Vim
docker run -ti --rm 560065381221.dkr.ecr.us-east-1.amazonaws.com/dmc:latest edit --name STAGING_NAME
# use Emacs
docker run -ti -e EDITOR=emacs --rm 560065381221.dkr.ecr.us-east-1.amazonaws.com/dmc:latest edit --name STAGING_NAME
dmc edit opens an $EDITOR where you can override staging variables. To
override an environment variable FOO with a value foo, add a line like this:
FOO=foo
To commit the changes, save the file and quit your default $EDITOR. :wq in
vim. Note that to discard your changes, you have to exit your $EDITOR with a
not-zero exit code. You can do this by typing :cq in vim.