arrow-right-arrow-leftMigration from Legacy Deployment

Migrate from the legacy stackai-auto-docker deployment to the unified CLI

Migrate from the legacy stackai-auto-dockerarrow-up-right deployment to the unified StackAI CLI.

Prerequisites

  • Access to your existing stackai-auto-docker deployment

  • Your StackAI License Key and Azure Registry credentials

  • Root/sudo access on the server

Migration Steps

1

Install the CLI

curl -sSf https://install.stack.ai | bash
stackai --version
2

Initialize

stackai init

Follow the prompts to configure your public host, registry credentials, and service URLs.

3

Stop Old Deployment

triangle-exclamation
cd /path/to/stackai-auto-docker
docker compose down
docker ps  # Verify no stackai containers running
4

Import Data

cd /path/to/stackai-auto-docker
sudo stackai system import --force

Use --dry-run first to preview what will be migrated.

5

Start and Verify

stackai deploy start
stackai deploy status

Access your domain to verify data migrated correctly.

TLS Certificates

If you have Let's Encrypt certificates:

sudo cp -L /etc/letsencrypt/live/DOMAIN/fullchain.pem ~/.config/stackai/config/nginx/certs/stackai.crt
sudo cp -L /etc/letsencrypt/live/DOMAIN/privkey.pem ~/.config/stackai/config/nginx/certs/stackai.key
sudo chown $USER:$USER ~/.config/stackai/config/nginx/certs/*
stackai deploy restart nginx

Rollback

Your old deployment is preserved. To rollback:


FAQ

chevron-rightWhy does import require sudo?hashtag

Docker volumes (MongoDB, PostgreSQL, etc.) are owned by root. The CLI detects SUDO_USER and writes to the correct user directory, then fixes file ownership automatically after import.

chevron-rightWhat data gets migrated?hashtag

Data Volumes:

Source
Destination

mongodb/mongodb_data/

data/mongodb/

weaviate/weaviate_data/

data/weaviate/

supabase/volumes/db/data/supabase/postgresql/

data/supabase/postgresql/

supabase/volumes/storage/

data/supabase/storage/

temporalio/volumes/postgres/

data/temporal/

Configuration:

Source
Destination

stackend/*.toml

config/stackend/

nginx/*.conf

config/nginx/

supabase/volumes/db/*.sql

config/supabase/db/

Environment Variables:

All .env files (mongodb/, supabase/, stackend/, stackweb/, weaviate/, unstructured/) are merged into ~/.config/stackai/.env. Secrets are encrypted in secrets.vault.

chevron-rightHow do I renew Let's Encrypt certificates after migration?hashtag
chevron-rightCan I generate self-signed certificates instead?hashtag

Browsers will show a security warning with self-signed certificates.

chevron-rightHow long does migration take for large datasets (50GB+)?hashtag

The import uses staged sync and 8MB buffered I/O for efficiency:

  • 10-15 minutes per 100GB on SSD

  • Progress bars show per-volume status

  • Most copying happens before services stop, minimizing downtime

chevron-rightMongoDB won't start after migrationhashtag

The database was likely running during import, causing journal corruption.

Fix:

chevron-right"CLI not initialized" error during importhashtag

Run stackai init before importing. The import command requires the CLI to be fully initialized first.

chevron-rightPermission denied on vault filehashtag

File ownership wasn't fixed properly. Run:

chevron-rightPort already in usehashtag

Old containers are still running. Stop them:

Last updated