27 lines
1.1 KiB
Bash
27 lines
1.1 KiB
Bash
#!/usr/bin/env bash
|
|
# Lance l'instance de test (LibreDesk v2.9.0, Postgres, Redis, Mailpit). Rien ne sort : le SMTP est Mailpit.
|
|
# bash instance-de-test/demarrer.sh <mot de passe System>
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
MDP="${1:?usage : demarrer.sh <mot de passe System>}"
|
|
|
|
if [ ! -f config.toml ]; then
|
|
curl -fsS -o config.toml https://raw.githubusercontent.com/abhinavxd/libredesk/v2.9.0/config.sample.toml
|
|
CLE=$(python3 -c 'import secrets; print(secrets.token_hex(16))')
|
|
sed -i "s/^encryption_key = .*/encryption_key = \"$CLE\"/" config.toml
|
|
echo "config.toml créé"
|
|
fi
|
|
|
|
LIBREDESK_SYSTEM_USER_PASSWORD="$MDP" docker compose -p ldtest up -d
|
|
|
|
for _ in $(seq 60); do
|
|
# une réponse HTTP, quelle qu'elle soit (401 sans connexion), suffit : le serveur écoute
|
|
if [ "$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:9100/api/v1/settings/general)" != "000" ]; then
|
|
echo "instance prête : http://127.0.0.1:9100 (Mailpit : http://127.0.0.1:9125)"
|
|
exit 0
|
|
fi
|
|
sleep 1
|
|
done
|
|
echo "LibreDesk ne répond pas après 60 s : docker logs ldtest_app" >&2
|
|
exit 1
|