rps-royale/docs/DEPLOYMENT.md
Ubuntu 1224ea28a6
Some checks are pending
Deploy to VPS / deploy (push) Waiting to run
feat: integrate blockchain commit-reveal + on-chain match creation
- Update RPSArena.sol: move bet payment to commit() instead of createMatch()
- Fix Hardhat tests to match new contract API (7/7 passing)
- Deploy updated contract to local Hardhat node (0xe7f1725...)
- Add blockchain service (server) listening to contract events
- Create matches on-chain from server matchmaking handler
- Frontend calls contract directly for commit/reveal via MetaMask
- Add Prisma DB persistence for match results and player stats
- Copy ABI to shared package for frontend/server consumption
- Update deployment docs and architecture docs

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 03:27:51 +00:00

1.7 KiB

Déploiement — The Arena RPS Royale

Prérequis

  • Docker & Docker Compose
  • Nginx Proxy Manager (déjà présent sur le VPS)
  • Forgejo (git.cosmolan.fr) pour le repo et le wiki

Configuration Nginx Proxy Manager

Ajouter deux hosts proxy :

  1. jeu.cosmolan.fr

    • Scheme: http
    • Forward Hostname: rps-web
    • Forward Port: 3000
    • WebSocket Support: ON
    • SSL: Let's Encrypt
  2. api.jeu.cosmolan.fr

    • Scheme: http
    • Forward Hostname: rps-server
    • Forward Port: 3001
    • WebSocket Support: ON
    • SSL: Let's Encrypt

Variables d'environnement

Copier .env.example vers .env et remplir les valeurs :

DATABASE_URL=postgresql://rpsuser:rpspass@rps-db:5432/rpsdb?schema=public
REDIS_URL=redis://rps-redis:6379
HARDHAT_RPC_URL=http://hardhat-node:8545
PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
CONTRACT_ADDRESS=0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
NEXT_PUBLIC_CONTRACT_ADDRESS=0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
CORS_ORIGIN=https://jeu.cosmolan.fr

Déploiement manuel

cd /home/ubuntu/apps/rps-royale
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d --build

Déploiement automatique (CI/CD)

Le fichier .forgejo/workflows/deploy.yml configure Forgejo Actions pour :

  1. Build à chaque push sur main
  2. Déploiement SSH sur le VPS

Configurer les secrets dans Forgejo :

  • VPS_HOST : IP du VPS
  • VPS_USER : ubuntu
  • VPS_SSH_KEY : clé SSH privée pour le déploiement

Commandes utiles

# Voir les logs
docker-compose logs -f rps-server

# Redémarrer un service
docker-compose restart rps-web

# Entrer dans le conteneur DB
docker-compose exec rps-db psql -U rpsuser -d rpsdb