feat: publish CodexPi contest snapshot
Some checks are pending
Qualité / tests (push) Waiting to run
Some checks are pending
Qualité / tests (push) Waiting to run
This commit is contained in:
57
scripts/install.sh
Normal file
57
scripts/install.sh
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
BASE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
if [[ "$(id -u)" == "0" ]]; then echo "CodexPi ne doit pas être installé ou lancé en root." >&2; exit 1; fi
|
||||
cd "$BASE"
|
||||
|
||||
# Active le garde-fou versionné qui refuse les secrets dans les commits.
|
||||
git config core.hooksPath .githooks
|
||||
|
||||
# The Docker deployment never uses a project-local Python environment.
|
||||
for legacy_venv in "$BASE/.venv" "$BASE/.venv-delete-on-pi"; do
|
||||
resolved_venv="$(realpath -m -- "$legacy_venv")"
|
||||
if [[ "$resolved_venv" != "$BASE/.venv" && "$resolved_venv" != "$BASE/.venv-delete-on-pi" ]]; then
|
||||
echo "Refus de supprimer un chemin inattendu: $resolved_venv" >&2
|
||||
exit 1
|
||||
fi
|
||||
[[ ! -e "$resolved_venv" ]] || rm -rf -- "$resolved_venv"
|
||||
done
|
||||
|
||||
"$BASE/scripts/audit.sh"
|
||||
command -v docker >/dev/null || { echo "Docker est requis" >&2; exit 1; }
|
||||
docker compose version >/dev/null || { echo "Le plugin Docker Compose est requis" >&2; exit 1; }
|
||||
docker info >/dev/null || { echo "Docker n'est pas accessible à l'utilisateur $(id -un)" >&2; exit 1; }
|
||||
|
||||
[[ -f .env ]] || cp .env.example .env
|
||||
mkdir -p data
|
||||
mkdir -p "$HOME/.codex" "$HOME/.claude" "$HOME/.config/opencode" "$HOME/.config/gh" "$HOME/.local/share/opencode"
|
||||
chmod 700 data
|
||||
chmod 600 .env
|
||||
|
||||
ensure_env() {
|
||||
local key="$1" value="$2"
|
||||
grep -q "^${key}=" .env || printf '\n%s=%s\n' "$key" "$value" >> .env
|
||||
}
|
||||
ensure_env PUID "$(id -u)"
|
||||
ensure_env PGID "$(id -g)"
|
||||
ensure_env DOCKER_GID "$(stat -c '%g' /var/run/docker.sock)"
|
||||
ensure_env CODEXPI_PROXY_PORT 8765
|
||||
ensure_env CODEXPI_BIND_ADDRESS 0.0.0.0
|
||||
ensure_env CODEXPI_HOME "$HOME"
|
||||
|
||||
"$BASE/scripts/compose.sh" build
|
||||
"$BASE/scripts/compose.sh" run --rm django-web python3 manage.py migrate --noinput
|
||||
"$BASE/scripts/compose.sh" up -d
|
||||
if command -v systemctl >/dev/null 2>&1 && [[ -d /run/systemd/system ]]; then
|
||||
"$BASE/scripts/install-boot-service.sh"
|
||||
else
|
||||
echo "Avertissement : systemd est absent ; l’auto-réparation de l’accès Docker ne peut pas être activée." >&2
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Installation Docker terminée."
|
||||
echo "Ouvrez l'application pour lancer l'assistant et créer le premier administrateur."
|
||||
echo "État des services: ./scripts/compose.sh ps"
|
||||
echo "Santé locale: curl http://127.0.0.1:8765/proxy-health"
|
||||
echo "Accès réseau local: http://IP_DU_PI:8765"
|
||||
Reference in New Issue
Block a user