From b8015c8a38088d5ecd8e11ad40ac3498874d2c5d Mon Sep 17 00:00:00 2001 From: Cedric Date: Thu, 11 Jun 2026 17:29:06 +0200 Subject: [PATCH] 0.1.7: deploy via cursor --- .env | 16 ++++++++++++++++ deploy.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 .env create mode 100644 deploy.sh diff --git a/.env b/.env new file mode 100644 index 0000000..7d77fd3 --- /dev/null +++ b/.env @@ -0,0 +1,16 @@ +# MountyCrawl — configuration de déploiement (NAS) +# Sur le serveur, depuis la racine du dépôt cloné : +# ./deploy.sh +# +# Ou en une ligne (après git push depuis ton PC) : +# source .env && cd "$NAS_PROJECT_DIR" && git pull "$GIT_REMOTE" "$GIT_BRANCH" && cd "$NAS_COMPOSE_DIR" && docker compose build --no-cache && docker compose up -d + +NAS_PROJECT_DIR=/home/perco/projects/mountycrawl +NAS_COMPOSE_DIR=/opt/container/mountycrawl +GIT_REMOTE=origin +GIT_BRANCH=master + +# true = écrase les modifs locales sur le NAS avant git pull (si pull bloqué) +DEPLOY_DISCARD_LOCAL=false + +SITE_URL=https://mountycrawl.nas.percolouco.com diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..4ddcb57 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# Déploie MountyCrawl sur le NAS (à lancer sur le serveur, dans le clone Git). +set -euo pipefail + +ROOT="$(cd "$(dirname "$0")" && pwd)" +if [[ -f "$ROOT/.env" ]]; then + set -a + # shellcheck disable=SC1091 + source "$ROOT/.env" + set +a +fi + +PROJECT_DIR="${NAS_PROJECT_DIR:-/home/perco/projects/mountycrawl}" +COMPOSE_DIR="${NAS_COMPOSE_DIR:-/opt/container/mountycrawl}" +REMOTE="${GIT_REMOTE:-origin}" +BRANCH="${GIT_BRANCH:-master}" + +echo "▶ Pull du code dans $PROJECT_DIR …" +cd "$PROJECT_DIR" +if [[ "${DEPLOY_DISCARD_LOCAL:-false}" == "true" ]]; then + git checkout -- . +fi +git pull "$REMOTE" "$BRANCH" + +echo "▶ Build Docker dans $COMPOSE_DIR …" +cd "$COMPOSE_DIR" +docker compose build --no-cache +docker compose up -d + +echo "" +echo "✅ Déploiement terminé." +if [[ -n "${SITE_URL:-}" ]]; then + echo " Site : $SITE_URL" +fi +echo " Vérif : docker compose -f $COMPOSE_DIR/docker-compose.yml exec mountycrawl grep APP_VERSION /app/js/game.js"