SPB Git

Repository Public

dev-stack.sh 3.3 KB 69 lines shellscript

1#!/bin/zsh2# =============================================================================3#                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : MacLustr SMS Gateway8# File             : ios/Scripts/dev-stack.sh9# Description      : Monte (start) ou démonte (stop) la pile locale jetable :10#                    serveur sur 8781, base maclustr_sms_ios_test, téléphone11#                    simulé. Aucun SMS réel, jamais la production. usage :12#                    dev-stack.sh start|stop|token13# Module           : ios14# Repository       : https://git.spboucher.ai/maclustr-sms15# Project Website  : https://sms.spboucher.ai16# Created          : 2026-11-3017# Last Modified    : 2026-11-3018#19# Author           : Simon-Pierre Boucher20# Position         : Professor of Finance21# Institution      : Université du Québec en Outaouais (UQO)22# Organization     : SP Boucher23# Website          : https://spboucher.ai24# Git              : https://git.spboucher.ai25#26# Preferred Contact: admin@spboucher.ai27# Technical Contact: dev@spboucher.ai28# Security/Admin   : admin@spboucher.ai29#30# Copyright (c) 202631# Simon-Pierre Boucher32# All rights reserved where applicable. This file is governed by the33# applicable project license, copyright notices and relevant law.34# Existing third-party rights and notices remain unaffected.35#36# License          : None specified (no license file in this repository)37#38# Do not embed credentials, private keys, access tokens,39# certificates or confidential personal information.40#41# =============================================================================42# END OF SP BOUCHER SOURCE HEADER43# =============================================================================4445set -euo pipefail46ROOT="$(cd "$(dirname "$0")/../.." && pwd)"; SELF="$ROOT/ios/Scripts/dev-stack.sh"; cd "$ROOT"47export SMS_TEST_PORT=8781 SMS_TEST_DB=postgres://127.0.0.1/maclustr_sms_ios_test48PIDF=ios/build/dev-stack.pid49case "${1:-start}" in50  start)51    mkdir -p ios/build52    psql -d postgres -tAc "select 1 from pg_database where datname='maclustr_sms_ios_test'" | grep -q 1 || createdb maclustr_sms_ios_test53    "$SELF" stop >/dev/null 2>&1 || true54    rm -f ios/build/dev-session.txt55    # tail -f /dev/null garde l'entrée standard ouverte (le script y lit des commandes de pilotage)56    (tail -f /dev/null | node --import tsx ios/Scripts/dev-stack.ts > ios/build/dev-stack.log 2>&1) &57    echo $! > $PIDF58    for i in {1..100}; do [ -s ios/build/dev-session.txt ] && break; sleep 0.2; done59    [ -s ios/build/dev-session.txt ] || { echo "la pile n'a pas démarré :"; tail -5 ios/build/dev-stack.log; exit 1; }60    tail -1 ios/build/dev-stack.log ;;61  stop)62    pgrep -f "ios/Scripts/dev-stack.ts" | xargs -r kill 2>/dev/null || true63    # attendre que le port soit réellement libéré (sinon le prochain démarrage échoue en EADDRINUSE)64    for i in {1..50}; do P=$(lsof -nP -tiTCP:8781 -sTCP:LISTEN || true); [ -z "$P" ] && break; kill $P 2>/dev/null || true; sleep 0.2; done65    rm -f $PIDF ios/build/dev-session.txt; echo "pile arrêtée" ;;66  drop) "$SELF" stop; dropdb --if-exists maclustr_sms_ios_test; echo "base supprimée" ;;67  token) cat ios/build/dev-session.txt ;;68esac69
Files main
Menu

Theme