Add ops instructions to setup snowball frontend and backend #32

Merged
nabarun merged 21 commits from deep-stack/testnet-laconicd-stack:ag-snowball-docs into main 2024-10-30 10:16:29 +00:00
2 changed files with 55 additions and 19 deletions
Showing only changes of commit 7ed1f1e029 - Show all commits

View File

@ -1241,27 +1241,27 @@
<details open> <details open>
<summary>snowball-backend</summary> <summary>snowball-backend</summary>
## Snowball Backend ## Deploy Backend
* Stack: <https://git.vdb.to/cerc-io/snowballtools-base-api-stack/src/branch/main/stack-orchestrator/stacks/snowballtools-base-backend> * Stack: <https://git.vdb.to/cerc-io/snowballtools-base-api-stack/src/branch/main/stack-orchestrator/stacks/snowballtools-base-backend>
* Source repo: <https://git.vdb.to/cerc-io/snowballtools-base> * Source repo: <https://git.vdb.to/cerc-io/snowballtools-base>
* Target dir: `/srv/snowball/snowball-deployment` * Target dir: `/srv/deploy-backend/backend-deployment`
* Cleanup an existing deployment if required: * Cleanup an existing deployment if required:
```bash ```bash
cd /srv/snowball cd /srv/deploy-backend
# Stop the deployment # 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 # Remove the deployment dir
sudo rm -rf snowball-deployment sudo rm -rf backend-deployment
# Remove the existing spec file # Remove the existing spec file
rm snowball-deployment-spec.yml rm backend-deployment-spec.yml
``` ```
### Setup ### Setup
@ -1271,7 +1271,7 @@
```bash ```bash
laconic-so fetch-stack git.vdb.to/cerc-io/snowballtools-base-api-stack --pull 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: * Clone required repositories:
@ -1290,39 +1290,75 @@
# This should create the Docker images: "cerc/snowballtools-base-backend" and "cerc/snowballtools-base-backend-base" # 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 ### Deployment
* Create a spec file for the deployment: * Create a spec file for the deployment:
```bash ```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 ```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: network:
ports: ports:
snowballtools-base-backend: deploy-backend:
- '8000:8000' - '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: * Create a deployment from the spec file:
```bash ```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: * Fetch the config template file for the snowball backend:
```bash ```bash
# Place in snowball deployment directory # 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 * Create a new account and fetch the private key
@ -1405,21 +1441,21 @@
``` ```
* Update `/srv/snowball/snowball-deployment/data/config/local.toml`. Replace `<redacted>` with your credentials. Use the `userKey`, `bondId` and `authority` that you set up * Update `/srv/snowball/snowball-deployment/data/config/prod.toml`. Replace `<redacted>` with your credentials. Use the `userKey`, `bondId` and `authority` that you set up
### Start ### Start
* Start the deployment: * Start the deployment:
```bash ```bash
laconic-so deployment --dir snowball-deployment start laconic-so deployment --dir backend-deployment start
``` ```
* Check status: * Check status:
```bash ```bash
# Follow logs for snowball container # 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
``` ```
</details> </details>
@ -1427,7 +1463,7 @@
<details open> <details open>
<summary>snowball-frontend</summary> <summary>snowball-frontend</summary>
## Snowball Frontend ## Deploy Frontend
* Source repo: <https://git.vdb.to/cerc-io/snowballtools-base> * Source repo: <https://git.vdb.to/cerc-io/snowballtools-base>