diff --git a/ops/configs/snowball-config.toml b/ops/configs/backend-config.toml similarity index 100% rename from ops/configs/snowball-config.toml rename to ops/configs/backend-config.toml diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index f218f1c..08419d2 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -1241,27 +1241,27 @@
snowball-backend -## Snowball Backend +## Deploy Backend * Stack: * Source repo: -* Target dir: `/srv/snowball/snowball-deployment` +* Target dir: `/srv/deploy-backend/backend-deployment` * Cleanup an existing deployment if required: ```bash - cd /srv/snowball + cd /srv/deploy-backend # Stop the deployment - laconic-so deployment --dir snowball-deployment stop --delete-volumes + laconic-so deployment --dir backend-deployment stop --delete-volumes # Remove the deployment dir - sudo rm -rf snowball-deployment + sudo rm -rf backend-deployment # Remove the existing spec file - rm snowball-deployment-spec.yml + rm backend-deployment-spec.yml ``` ### Setup @@ -1271,7 +1271,7 @@ ```bash laconic-so fetch-stack git.vdb.to/cerc-io/snowballtools-base-api-stack --pull - # This should clone the testnet-laconicd-stack repo at `/home/dev/cerc/snowballtools-base-api-stack` + # This should clone the snowballtools-base-api-stack repo at `/home/dev/cerc/snowballtools-base-api-stack` ``` * Clone required repositories: @@ -1290,39 +1290,75 @@ # This should create the Docker images: "cerc/snowballtools-base-backend" and "cerc/snowballtools-base-backend-base" ``` +* Push the images to the container registry. The container registry will be set up while setting up a service provider + + ```bash + laconic-so deployment --dir backend-deployment push-images + ``` + ### Deployment * Create a spec file for the deployment: ```bash - cd /srv/snowball + cd /srv/backend-deployment - laconic-so --stack ~/cerc/snowballtools-base-api-stack/stack-orchestrator/stacks/snowballtools-base-backend deploy init --output snowball-deployment-spec.yml --config SNOWBALL_BACKEND_CONFIG_FILE_PATH=/config/local.toml + laconic-so --stack ~/cerc/snowballtools-base-api-stack/stack-orchestrator/stacks/snowballtools-base-backend deploy init --output backend-deployment-spec.yml --config SNOWBALL_BACKEND_CONFIG_FILE_PATH=/config/prod.toml ``` -* Edit network in the spec file to map container ports to host ports: +* Edit the spec file to deploy the stack to k8s: ```bash + stack: + /home/dev/cerc/snowballtools-base-api-stack/stack-orchestrator/stacks/snowballtools-base-backend + deploy-to: k8s + kube-config: /home/dev/.kube/config-vs-narwhal.yaml + image-registry: container-registry.apps.vaasl.io/laconic-registry + config: + SNOWBALL_BACKEND_CONFIG_FILE_PATH: /config/prod.toml network: ports: - snowballtools-base-backend: - - '8000:8000' + deploy-backend: + - '8000' + http-proxy: + - host-name: deploy-backend.apps.vaasl.io + routes: + - path: '/' + proxy-to: deploy-backend:8000 + volumes: + data: + configmaps: + config: ./configmaps/config ``` * Create a deployment from the spec file: ```bash - laconic-so --stack ~/cerc/snowballtools-base-api-stack/stack-orchestrator/stacks/snowballtools-base-backend deploy create --deployment-dir snowball-deployment --spec-file snowball-deployment-spec.yml + laconic-so --stack ~/cerc/snowballtools-base-api-stack/stack-orchestrator/stacks/snowballtools-base-backend deploy create --deployment-dir backend-deployment --spec-file backend-deployment-spec.yml + # This should create the deployment directory at `/srv/deploy-backend/backend-deployment` ``` +* Modify file `backend-deployment/kubeconfig.yml` if required + ``` + apiVersion: v1 + ... + contexts: + - context: + cluster: *** + user: *** + name: default + ... + ``` + NOTE: `context.name` must be default to use with SO + * Fetch the config template file for the snowball backend: ```bash # Place in snowball deployment directory - wget -O /srv/snowball/snowball-deployment/data/config/local.toml https://git.vdb.to/cerc-io/testnet-laconicd-stack/raw/branch/main/ops/configs/snowball-config.toml + wget -O /srv/deploy-backend/backend-deployment/configmaps/config/prod.toml https://git.vdb.to/cerc-io/testnet-laconicd-stack/raw/branch/main/ops/configs/backend-deployment.toml ``` -* Setup private key and bond id. Execute the following commands in the directory containing `stage2-deployment` +* Setup private key and bond. If not already setup, execute the following commands in the directory containing `stage2-deployment` * Create a new account and fetch the private key @@ -1405,21 +1441,21 @@ ``` -* Update `/srv/snowball/snowball-deployment/data/config/local.toml`. Replace `` with your credentials. Use the `userKey`, `bondId` and `authority` that you set up +* Update `/srv/snowball/snowball-deployment/data/config/prod.toml`. Replace `` with your credentials. Use the `userKey`, `bondId` and `authority` that you set up ### Start * Start the deployment: ```bash - laconic-so deployment --dir snowball-deployment start + laconic-so deployment --dir backend-deployment start ``` * Check status: ```bash # Follow logs for snowball container - laconic-so deployment --dir snowball-deployment logs snowballtools-base-backend -f + laconic-so deployment --dir backend-deployment logs snowballtools-base-backend -f ```
@@ -1427,7 +1463,7 @@
snowball-frontend -## Snowball Frontend +## Deploy Frontend * Source repo: