Rechercher

PythonReactSEOPDF
GitHub Skill

test-server-deploy

Deploy services to test server via SSH. Builds Docker images locally, transfers them, and cleans up old images on both host and remote.

koedame☆ 0 Étoiles du dépôt0 Forks du dépôt

Installation

Suivez les instructions du dépôt pour votre agent. Consultez les fichiers et dépendances avant l’installation.

Voir la source ↗Guides

Instructions

Test Server Deploy

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.

Instructions

1. Build Docker Images

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 .
2. Cleanup Old Images (Host)

After building, remove dangling images on the local machine to prevent disk bloat:

docker image prune -f

This removes:

  • Intermediate build layers no longer used
  • Untagged images left behind by previous builds

Report how much space was reclaimed.

3. Export Images

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).

4. Deploy via Ansible

Run the Ansible playbook to deploy:

cd ansible && ansible-playbook -i inventory/test.yml playbooks/site.yml

This will:

  • Transfer the Docker images to the server
  • Load the images into Docker
  • Create/update .env file with environment variables
  • Create/update docker-compose.yml
  • Start or restart services
  • Wait for services to become healthy
5. Cleanup Old Images (Remote)

After deployment, remove unused images on the remote server:

ssh -i PrivateDocs/jamjam_vps ubuntu@160.16.61.28 "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.

6. Cleanup (Local Temp Files)

Remove the temporary image archive:

rm -f /tmp/jamjam-images.tar.gz
7. Verify Server Status

Check service status on the server:

ssh -i PrivateDocs/jamjam_vps ubuntu@160.16.61.28 "cd /opt/jamjam && docker compose ps"

All three services should be running:

  • jamjam-signaling - healthy
  • jamjam-echo - healthy
  • jamjam-cloudflared - running (no healthcheck)
8. Test CLI Connection

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.

Server Information

Item Value
Host 160.16.61.28
User ubuntu
SSH Key PrivateDocs/jamjam_vps
App Directory /opt/jamjam

Services Deployed

  • signaling-server - WebSocket signaling server (port 8080, localhost only)
  • echo-server - Audio echo test server (port 5000/UDP)
  • cloudflared - Cloudflare Tunnel for TLS termination

Troubleshooting

If deployment fails:

  1. Platform mismatch error ("The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64)"):

    • This occurs when building on Apple Silicon without specifying the target platform
    • Solution: Rebuild images with --platform linux/amd64 --no-cache flags
    • See Step 1 for the correct build commands
  2. Check SSH connectivity:

    ssh -i PrivateDocs/jamjam_vps ubuntu@160.16.61.28 "echo OK"
    
  3. Check Docker images on server:

    ssh -i PrivateDocs/jamjam_vps ubuntu@160.16.61.28 "docker images | grep jamjam"
    
  4. Check container logs:

    ssh -i PrivateDocs/jamjam_vps ubuntu@160.16.61.28 "cd /opt/jamjam && docker compose logs --tail=50"
    

Exemples

Consultez les exemples du dépôt source.

Voir la source ↗

Historique source

Date d’indexation
2026-01-20
Mise à jour de l’index
2026-01-26
Branch
main

Les dates concernent ce répertoire. Consultez le dépôt pour l’historique du code.

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!