After configuring the domain name3
This commit is contained in:
parent
7b6c6fd564
commit
85e7b9937e
@ -6,13 +6,13 @@
|
|||||||
|
|
||||||
| Build | Default without dart-define |
|
| Build | Default without dart-define |
|
||||||
|-------|-----------------------------|
|
|-------|-----------------------------|
|
||||||
| **Release** (`flutter build apk --release`) | `http://prediqo.redirectme.net:9080` |
|
| **Release** (`flutter build apk --release`) | `https://tloto.net` |
|
||||||
| **Debug / emulator** | `http://10.0.2.2:9080` |
|
| **Debug / emulator** | `http://10.0.2.2:9080` |
|
||||||
|
|
||||||
### Local device / custom host
|
### Local device / custom host
|
||||||
|
|
||||||
1. Copy `dart_defines.dev.example.json` → `dart_defines.dev.json`
|
1. Copy `dart_defines.dev.example.json` → `dart_defines.dev.json`
|
||||||
2. Set your API base, e.g. `http://prediqo.redirectme.net:9080` or `http://<PC_LAN_IP>:9080`
|
2. Set your API base, e.g. `https://tloto.net` or `http://<PC_LAN_IP>:9080`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
flutter run --dart-define-from-file=dart_defines.dev.json
|
flutter run --dart-define-from-file=dart_defines.dev.json
|
||||||
@ -21,10 +21,9 @@ flutter run --dart-define-from-file=dart_defines.dev.json
|
|||||||
### Release APK (production)
|
### Release APK (production)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Uses built-in production default, or pin explicitly:
|
|
||||||
flutter build apk --release --dart-define-from-file=dart_defines.prod.example.json
|
flutter build apk --release --dart-define-from-file=dart_defines.prod.example.json
|
||||||
```
|
```
|
||||||
|
|
||||||
Output: `build/app/outputs/flutter-apk/app-release.apk`
|
Output: `build/app/outputs/flutter-apk/app-release.apk`
|
||||||
|
|
||||||
An older APK built with only the emulator default (`10.0.2.2`) **cannot** reach the VPS — rebuild and reinstall.
|
Older APKs built with `redirectme`, `:9443`, or `10.0.2.2` must be rebuilt for `https://tloto.net`.
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"API_BASE_URL": "http://YOUR_PC_WIFI_IP:9080"
|
"API_BASE_URL": "https://tloto.net"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"API_BASE_URL": "https://tloto.net:9443",
|
"API_BASE_URL": "https://tloto.net",
|
||||||
"APP_ENV": "production",
|
"APP_ENV": "production",
|
||||||
"WS_ENABLED": "true"
|
"WS_ENABLED": "true"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,7 +74,7 @@ class AppConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Production API reached by release APKs on real devices (override with dart-define).
|
/// Production API reached by release APKs on real devices (override with dart-define).
|
||||||
static const String defaultProductionApiBaseUrl = 'https://tloto.net:9443';
|
static const String defaultProductionApiBaseUrl = 'https://tloto.net';
|
||||||
|
|
||||||
/// Emulator-only loopback to the host machine's Docker nginx.
|
/// Emulator-only loopback to the host machine's Docker nginx.
|
||||||
static const String defaultEmulatorApiBaseUrl = 'http://10.0.2.2:9080';
|
static const String defaultEmulatorApiBaseUrl = 'http://10.0.2.2:9080';
|
||||||
|
|||||||
108
scripts/check-ssl-expiry.sh
Normal file
108
scripts/check-ssl-expiry.sh
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Vérifie l'expiration des certificats Let's Encrypt et alerte si proche.
|
||||||
|
#
|
||||||
|
# Usage (VPS) :
|
||||||
|
# export NTFY_TOPIC=tloto-certs-CHOISIS-UN-SECRET # app ntfy (téléphone)
|
||||||
|
# export ALERT_EMAIL=admin@tloto.net # optionnel si `mail` est dispo
|
||||||
|
# export WARN_DAYS=30
|
||||||
|
# ./scripts/check-ssl-expiry.sh
|
||||||
|
#
|
||||||
|
# Crontab (tous les jours à 09:00) :
|
||||||
|
# 0 9 * * * WARN_DAYS=30 NTFY_TOPIC=tloto-certs-XXX \
|
||||||
|
# /home/projects/projects_repository/games-project/scripts/check-ssl-expiry.sh \
|
||||||
|
# >> /var/log/tloto-cert-check.log 2>&1
|
||||||
|
#
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
WARN_DAYS="${WARN_DAYS:-30}"
|
||||||
|
CRITICAL_DAYS="${CRITICAL_DAYS:-7}"
|
||||||
|
NTFY_TOPIC="${NTFY_TOPIC:-}"
|
||||||
|
ALERT_EMAIL="${ALERT_EMAIL:-}"
|
||||||
|
|
||||||
|
# volume:chemin_pem relatif sous /etc/letsencrypt/live/...
|
||||||
|
CHECKS=(
|
||||||
|
"games-project_letsencrypt:tloto.net/fullchain.pem"
|
||||||
|
"salon-management-full-project_letsencrypt:business-mgt.redirectme.net/fullchain.pem"
|
||||||
|
)
|
||||||
|
|
||||||
|
need_alert=0
|
||||||
|
report=""
|
||||||
|
|
||||||
|
days_left_for() {
|
||||||
|
local volume="$1"
|
||||||
|
local rel="$2"
|
||||||
|
docker run --rm -v "${volume}:/etc/letsencrypt:ro" alpine:3.20 \
|
||||||
|
sh -c "
|
||||||
|
apk add --no-cache openssl >/dev/null 2>&1
|
||||||
|
pem=/etc/letsencrypt/live/${rel}
|
||||||
|
if [ ! -f \"\$pem\" ]; then echo MISSING; exit 0; fi
|
||||||
|
end=\$(openssl x509 -in \"\$pem\" -noout -enddate | cut -d= -f2)
|
||||||
|
end_ts=\$(date -d \"\$end\" +%s)
|
||||||
|
now=\$(date +%s)
|
||||||
|
echo \$(( (end_ts - now) / 86400 ))
|
||||||
|
"
|
||||||
|
}
|
||||||
|
|
||||||
|
send_alert() {
|
||||||
|
local subject="$1"
|
||||||
|
local body="$2"
|
||||||
|
echo "ALERT: $subject"
|
||||||
|
echo "$body"
|
||||||
|
|
||||||
|
if [ -n "$NTFY_TOPIC" ]; then
|
||||||
|
curl -fsS -H "Title: $subject" -H "Priority: high" \
|
||||||
|
-d "$body" "https://ntfy.sh/${NTFY_TOPIC}" >/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$ALERT_EMAIL" ] && command -v mail >/dev/null 2>&1; then
|
||||||
|
printf '%s\n' "$body" | mail -s "$subject" "$ALERT_EMAIL" || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
for item in "${CHECKS[@]}"; do
|
||||||
|
vol="${item%%:*}"
|
||||||
|
rel="${item#*:}"
|
||||||
|
name="${rel%%/*}"
|
||||||
|
|
||||||
|
if ! docker volume inspect "$vol" >/dev/null 2>&1; then
|
||||||
|
line="SKIP $name — volume $vol introuvable"
|
||||||
|
report+="$line"$'\n'
|
||||||
|
echo "$line"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
left="$(days_left_for "$vol" "$rel" | tr -d '\r' | tail -n1)"
|
||||||
|
if [ "$left" = "MISSING" ] || ! [[ "$left" =~ ^-?[0-9]+$ ]]; then
|
||||||
|
line="ERROR $name — certificat illisible ($left)"
|
||||||
|
report+="$line"$'\n'
|
||||||
|
echo "$line"
|
||||||
|
need_alert=1
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
line="$name : ${left} jour(s) restant(s)"
|
||||||
|
report+="$line"$'\n'
|
||||||
|
echo "$line"
|
||||||
|
|
||||||
|
if [ "$left" -lt "$CRITICAL_DAYS" ]; then
|
||||||
|
need_alert=1
|
||||||
|
elif [ "$left" -lt "$WARN_DAYS" ]; then
|
||||||
|
need_alert=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$need_alert" -eq 1 ]; then
|
||||||
|
send_alert "Tloto/Salon — certificat SSL à renouveler" \
|
||||||
|
"Au moins un certificat expire bientôt (< ${WARN_DAYS} jours).
|
||||||
|
|
||||||
|
${report}
|
||||||
|
Action VPS Tloto :
|
||||||
|
cd ~/projects_repository/games-project && npm run ssl:dns-renew
|
||||||
|
(Puis TXT GoDaddy, Entrée seulement quand Dig/8.8.8.8 est OK.)
|
||||||
|
|
||||||
|
Date check : $(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "OK — aucun certificat sous le seuil ${WARN_DAYS} jours."
|
||||||
|
exit 0
|
||||||
Loading…
Reference in New Issue
Block a user