Open singhalkarun opened 3 months ago
Setting up BharatSahAIyak/devops repo(branch bhasai-internal) on the new machine.
Setup docker and daemon using make target on the new machine
sudo apt install make
make install-docker
make setup-daemon
Setup ssh for migration script
ssh-keygen -t rsa -b 4096 -C "Migration Key"
cat ~/.ssh/id_rsa.pub
cd ~/.ssh
echo "paste_the_copied_public_key_here" >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
Setup Samagra-Development/devops on host machine to use the migration script
Test the script using a demo volume
docker volume create demo_volume
make migrate-volume
Add all the necessary environment variables to .env file on the target machine
AI_SERVICES=
DEFAULT_GITHUB_BRANCH=
DOCKER_REGISTRY_URL=
env=
org=
POSTGRES_USER= POSTGRES_PASSWORD=
VAULT_USERNAME= VAULT_PASSWORD=
MINIO_ROOT_USER= MINIO_ROOT_PASSWORD= MINIO_ACCESS_KEY= MINIO_SECRET_KEY=
CLICKHOUSE_DB= CLICKHOUSE_USER= CLICKHOUSE_PASSWORD=
SUPERSET_DATABASE_PASSWORD= SUPERSET_ENV= SUPERSET_SECRET_KEY= SUPERSET_ADMIN_PASSWORD= SUPERSET_TALISMAN_ENABLED= SUPERSET_EMBEDDING_DOMAIN= SUPERSET_ENABLE_CORS= SUPERSET_ENABLE_TEMPLATE_PROCESSING= SUPERSET_DASHBOARD_FILTERS_EXPOSE= SUPERSET_ENABLE_RBAC_ACCESS=
- Stop the service on the host machine before migration of volume
- `docker stop <container_id>`
- Run the script to migrate the volume, keep the name same(as per the project name **-p bhasai**)
- ` make migrate-volume `
- deploy the service on the new machine after its volume is migrated
- `make deploy [services=<service_name>]`
- Update the URL from the lb machine ( Karun)
- Update the IP and minio URL in valut wherever required
exmaple:
![image](https://github.com/user-attachments/assets/68a5da1e-1d3b-4665-ba87-5c4e47de231b)
### List of volumes
- bhasai_db
- bhasai_redis
- bhasai_redis_conf
- bhasai_minio
- bhasai_vault
- bhasai_clickhouse
- fusionauth_es
- fusionauth_db
# Downtime
- Migrating at time of low usage
- Incremental backup
Move all the services which are not moved to K8S to use this repository (update volume names as needed), this should be done with minimum downtime. Plan the process and risks.
https://docs.google.com/spreadsheets/d/1Ojpea-LoP0055R9mzikwUuiF9r0ey2URYm7ONj5gxMc/edit?gid=0#gid=0