SPB Git

Repository Public

node-setup.sh 2.4 KB 53 lines shellscript

1#!/bin/zsh2# =============================================================================3#                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : MacLustr Social Engine & Remote Navigator8# File             : scripts/node-setup.sh9# Module           : scripts10# Repository       : https://git.spboucher.ai/maclustr-social11# Project Website  : https://social.spboucher.ai12# Created          : 2026-12-0113# Last Modified    : 2026-12-0114#15# Author           : Simon-Pierre Boucher16# Position         : Professor of Finance17# Institution      : Université du Québec en Outaouais (UQO)18# Organization     : SP Boucher19# Website          : https://spboucher.ai20# Git              : https://git.spboucher.ai21#22# Preferred Contact: admin@spboucher.ai23# Technical Contact: dev@spboucher.ai24# Security/Admin   : admin@spboucher.ai25#26# Copyright (c) 202627# Simon-Pierre Boucher28# All rights reserved where applicable. This file is governed by the29# applicable project license, copyright notices and relevant law.30# Existing third-party rights and notices remain unaffected.31#32# License          : None specified (no license file in this repository)33#34# Do not embed credentials, private keys, access tokens,35# certificates or confidential personal information.36#37# =============================================================================38# END OF SP BOUCHER SOURCE HEADER39# =============================================================================4041# Idempotent node preparation (mld post_sync hook). Creates the database, the keys (never overwritten),42# applies migrations and seeds. Does NOT touch any browser profile.43set -euo pipefail44cd "${0:A:h}/.."45source scripts/prod-env.sh46DB="$MLS_DB_NAME"47mkdir -p "$MLS_DATA_DIR" "$MLS_CONFIG_DIR" "$MLS_BACKUP_DIR"; chmod 700 "$MLS_DATA_DIR" "$MLS_CONFIG_DIR" "$MLS_BACKUP_DIR"48psql -Atc "SELECT 1 FROM pg_database WHERE datname='$DB'" postgres | grep -q 1 || { createdb "$DB"; echo "  base $DB créée"; }49[ -f "$MLS_CONFIG_DIR/backup.key" ] || { (umask 077; openssl rand -hex 32 > "$MLS_CONFIG_DIR/backup.key"); echo "  clé de sauvegarde créée — COPIEZ-LA hors du nœud"; }50node dist/migrate.mjs up51node dist/cli.mjs seed >/dev/null && echo "  graines ok"52echo "  node-setup ok"53
Files main
Menu

Theme