Deploy services to test server via SSH. Builds Docker images locally, transfers them, and cleans up old images on both host and remote.
Deploy jamjam services (signaling-server, echo-server, cloudflared) to the test server.
Includes automatic cleanup of unused Docker images on both the local machine and remote server to prevent disk bloat.
Build both images locally for AMD64 platform (test server is x86_64):
docker build --platform linux/amd64 -f Dockerfile.signaling -t jamjam-signaling:latest .
docker build --platform linux/amd64 -f Dockerfile.echo -t jamjam-echo:latest .
Note: The --platform linux/amd64 flag is required when building on Apple Silicon (ARM64) Mac for deployment to x86_64 servers. If you encounter platform mismatch errors on the server, rebuild with --no-cache:
docker build --platform linux/amd64 --no-cache -f Dockerfile.signaling -t jamjam-signaling:latest .
docker build --platform linux/amd64 --no-cache -f Dockerfile.echo -t jamjam-echo:latest .
After building, remove dangling images on the local machine to prevent disk bloat:
docker image prune -f
This removes:
Report how much space was reclaimed.
Save and compress the images for transfer:
rm -f /tmp/jamjam-images.tar.gz
docker save jamjam-signaling:latest jamjam-echo:latest | gzip > /tmp/jamjam-images.tar.gz
ls -lh /tmp/jamjam-images.tar.gz
Report the file size to the user (typically ~35MB).
Run the Ansible playbook to deploy:
cd ansible && ansible-playbook -i inventory/test.yml playbooks/site.yml
This will:
.env file with environment variablesdocker-compose.ymlAfter deployment, remove unused images on the remote server:
ssh -i PrivateDocs/jamjam_vps [email protected] "docker image prune -f"
This removes old versions of images that are no longer tagged (replaced by the new deployment).
Report how much space was reclaimed on the server.
Remove the temporary image archive:
rm -f /tmp/jamjam-images.tar.gz
Check service status on the server:
ssh -i PrivateDocs/jamjam_vps [email protected] "cd /opt/jamjam && docker compose ps"
All three services should be running:
jamjam-signaling - healthyjamjam-echo - healthyjamjam-cloudflared - running (no healthcheck)Test the signaling server connection using the CLI:
cargo run --release --bin jamjam -- rooms --server wss://test-signaling-jamjam.koeda.me
Expected output:
INFO Connecting to signaling server: wss://test-signaling-jamjam.koeda.me
INFO Connected, listing rooms...
Available rooms:
xxxxxxxx - [BOT] Echo Server (1000ms delay) (1/10 peers)
If the Echo Server room appears, the deployment is successful.
| Item | Value |
|---|---|
| Host | 160.16.61.28 |
| User | ubuntu |
| SSH Key | PrivateDocs/jamjam_vps |
| App Directory | /opt/jamjam |
If deployment fails:
Platform mismatch error ("The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64)"):
--platform linux/amd64 --no-cache flagsCheck SSH connectivity:
ssh -i PrivateDocs/jamjam_vps [email protected] "echo OK"
Check Docker images on server:
ssh -i PrivateDocs/jamjam_vps [email protected] "docker images | grep jamjam"
Check container logs:
ssh -i PrivateDocs/jamjam_vps [email protected] "cd /opt/jamjam && docker compose logs --tail=50"