diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 6130485..f2672b0 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -1234,6 +1234,110 @@ +## snowballtools-base-api-stack + +* Stack: + +* Source repos: + * + +* Target dir: `/srv/snowball/snowball-deployment` + +* Cleanup an existing deployment if required: + + ```bash + cd /srv/snowball + + # Stop the deployment + laconic-so deployment --dir snowball-deployment stop --delete-volumes + + # Remove the deployment dir + sudo rm -rf snowball-deployment + + # Remove the existing spec file + rm snowball-spec.yml + ``` + +### Setup + +* Clone the stack repo: + + ```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` + ``` + +* Clone required repositories: + + ```bash + laconic-so --stack ~/cerc/snowballtools-base-api-stack/stack-orchestrator/stacks/snowballtools-base-backend setup-repositories --git-ssh --pull + + # This should clone the snowballtools-base repo at `/home/dev/cerc/snowballtools-base` + ``` + +* Build the container images: + + ```bash + laconic-so --stack ~/cerc/snowballtools-base-api-stack/stack-orchestrator/stacks/snowballtools-base-backend build-containers --force-rebuild + + # This should create the Docker images: "cerc/snowballtools-base-backend" and "cerc/snowballtools-base-backend-base" + ``` + +### Deployment + +* Create a spec file for the deployment: + + ```bash + cd /srv/snowball + + 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 + ``` + +* Edit network in the spec file to map container ports to host ports: + + ```bash + network: + ports: + snowballtools-base-backend: + - '8000:8000' + ``` + +* 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 + ``` + +* Create a file at `snowball-deployment/data/config/local.toml` with the config for the server: + + ```bash + [server] + host = "0.0.0.0" + port = 8000 + gqlPath = "/graphql" + [server.session] + secret = "" + appOriginUrl = "https://dashboard.pwa.laconic.com" + trustProxy = false + ... + ``` + +### Start + +* Start the deployment: + + ```bash + laconic-so deployment --dir snowball-deployment start + ``` + +* Check status: + + ```bash + # Follow logs for snowball container + laconic-so deployment --dir snowball-deployment logs snowballtools-base-backend -f + ``` + ## Domains / Port Mappings ```bash