migrate¶
The fujin migrate command converts older Fujin configuration formats to the current file-based structure.
Overview¶
Older versions of Fujin used a template-based approach where processes and sites were defined in fujin.toml. The current version uses a file-based approach with actual systemd unit files in .fujin/systemd/.
This command automates the migration process.
When to Use¶
Run this command if your fujin.toml contains any of these deprecated sections:
[processes.xxx]- Process definitions[[sites]]- Caddy site configuration[webserver]- Webserver settingsrelease_command- Pre-deployment command
Usage¶
Basic migration¶
fujin migrate
This will:
Generate
.fujin/systemd/directory with service filesGenerate
.fujin/Caddyfilefrom sites configurationUpdate
fujin.toml(remove old sections, add[replicas]if needed)
Dry run (preview changes)¶
fujin migrate --dry-run
Shows what files would be created/modified without making any changes.
Create backup¶
fujin migrate --backup
Creates fujin.toml.backup before making changes.
Example¶
Before migration (old format):
app = "myapp"
build_command = "uv build"
distfile = "dist/myapp-{version}-py3-none-any.whl"
installation_mode = "python-package"
release_command = "myapp migrate"
[processes.web]
command = ".venv/bin/gunicorn myapp.wsgi:app --bind localhost:8000"
listen = "localhost:8000"
[processes.worker]
command = ".venv/bin/celery -A myapp worker"
replicas = 2
[[sites]]
domains = ["myapp.com"]
routes = { "/" = "web" }
[[hosts]]
address = "myapp.com"
user = "deploy"
After migration (file-based):
app = "myapp"
build_command = "uv build"
distfile = "dist/myapp-{version}-py3-none-any.whl"
installation_mode = "python-package"
[replicas]
worker = 2
[[hosts]]
address = "myapp.com"
user = "deploy"
.fujin/
├── Caddyfile
└── systemd/
├── web.service
└── worker@.service
What Gets Migrated¶
Processes → Service files:
Each [processes.xxx] entry becomes a .fujin/systemd/xxx.service file. If replicas > 1, it becomes xxx@.service (template unit).
release_command → ExecStartPre:
The release_command is converted to ExecStartPre directives in the web service file.
Sites → Caddyfile:
The [[sites]] configuration becomes a .fujin/Caddyfile with:
- Domain configuration
- Route handling (reverse proxy, static files)
Replicas → [replicas] section:
Services with replicas > 1 are tracked in a new [replicas] section.
Removed:
apps_dirfrom host configs (now fixed at/opt/fujin)[webserver]sectionrelease_command(moved to service file)
Next Steps¶
After migration:
Review generated files in
.fujin/systemd/Customize service files if needed (security directives, resource limits)
Review
.fujin/CaddyfileTest deployment:
fujin deploy