Add ops instructions to setup snowball backend stack

This commit is contained in:
Adw8 2024-10-18 18:30:11 +05:30 committed by Prathamesh Musale
parent 81923f5323
commit ed42cb1b2a

View File

@ -1117,6 +1117,110 @@
</details>
## snowballtools-base-api-stack
* Stack: <https://git.vdb.to/cerc-io/snowballtools-base-api-stack/src/branch/main/stack-orchestrator/stacks/snowballtools-base-backend>
* Source repos:
* <https://git.vdb.to/cerc-io/snowballtools-base>
* 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 = "<redacted>"
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