Deploying Wyn Applications
Deploy your Wyn app to any server with one command.
Setup
Add a [deploy] section to your wyn.toml:
toml
[project]
name = "myapp"
version = "1.0.0"
entry = "src/main.wyn"
[deploy.dev]
host = "dev.example.com"
user = "deploy"
key = "~/.ssh/id_ed25519"
path = "/opt/myapp"
os = "linux"
pre = "systemctl stop myapp"
post = "systemctl start myapp"
[deploy.prod]
host = "example.com"
user = "deploy"
key = "~/.ssh/id_ed25519"
path = "/opt/myapp"
os = "linux"
pre = "systemctl stop myapp"
post = "systemctl start myapp"Deploy
sh
wyn deploy dev # Deploy to dev
wyn deploy prod # Deploy to production
wyn deploy dev --dry-run # Preview without executingWhat Happens
- Cross-compiles your app for the target OS
- Runs the
precommand on the server (e.g., stop the service) - Uploads the binary via SCP
- Runs the
postcommand (e.g., start the service)
Other Commands
sh
wyn ssh dev # SSH into the dev server
wyn logs dev # Tail the service logsSystemd Service
Create /etc/systemd/system/myapp.service on the server:
ini
[Unit]
Description=My Wyn App
[Service]
ExecStart=/opt/myapp/myapp
Restart=always
User=deploy
[Install]
WantedBy=multi-user.targetThen: sudo systemctl enable myapp