38 lines
1.1 KiB
Markdown
38 lines
1.1 KiB
Markdown
---
|
|
description: how to deploy elmeg changes safely
|
|
---
|
|
|
|
# Elmeg Safe Deployment
|
|
|
|
## CRITICAL: Never wipe the database
|
|
|
|
When deploying changes to elmeg, **ONLY rebuild the backend and frontend containers**. The database must NEVER be rebuilt or recreated.
|
|
|
|
## Safe deployment command
|
|
|
|
```bash
|
|
# turbo
|
|
ssh nexus-vector "cd /srv/containers/elmeg-demo && git pull && docker compose up -d --build --no-deps backend frontend"
|
|
```
|
|
|
|
## DANGEROUS - Do NOT use these commands
|
|
|
|
```bash
|
|
# These will WIPE THE DATABASE:
|
|
docker compose up -d --build # Rebuilds ALL containers including db
|
|
docker compose down && docker compose up -d # Recreates all containers
|
|
docker compose up -d --force-recreate # Force recreates all
|
|
```
|
|
|
|
## Backup before any deployment (optional but recommended)
|
|
|
|
```bash
|
|
# turbo
|
|
ssh nexus-vector "docker exec elmeg-demo-db-1 pg_dump -U elmeg elmeg > /srv/containers/elmeg-demo/backup-\$(date +%Y%m%d-%H%M%S).sql"
|
|
```
|
|
|
|
## Restore from backup if needed
|
|
|
|
```bash
|
|
ssh nexus-vector "cat /srv/containers/elmeg-demo/backup-YYYYMMDD-HHMMSS.sql | docker exec -i elmeg-demo-db-1 psql -U elmeg elmeg"
|
|
```
|