Repository Public
1#!/bin/zsh2# =============================================================================3# SP BOUCHER | INFRASTRUCTURE & AUTOMATION4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project : MacLustr Social Engine & Remote Navigator8# File : scripts/push-to-node.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# Laptop → private repo → node. The node has no route to the repo by itself: the gateway (M1M32) pushes the commit42# into the node's clone over the LAN, then the node fast-forwards and rebuilds.43# usage: push-to-node.sh [--no-restart]44set -euo pipefail45NODE=m4ml; NODE_IP=$(ssh $NODE "ipconfig getifaddr en0 || ipconfig getifaddr en1")46git push -q origin main47ssh M1M32 "git --git-dir ~/srv/git-private/maclustr-social.git push -q ssh://$NODE_IP/Users/simon-pierreboucher/apps/maclustr-social main:refs/remotes/origin/main"48ssh $NODE 'export PATH=/opt/homebrew/bin:/opt/homebrew/opt/postgresql@17/bin:$PATH; cd ~/apps/maclustr-social && PREV=$(git rev-parse --short HEAD 2>/dev/null || echo none) && git reset -q --hard refs/remotes/origin/main && pnpm install --frozen-lockfile --silent 2>&1 | tail -1; pnpm build >/dev/null && source scripts/prod-env.sh && node dist/migrate.mjs up && echo "nœud : $PREV → $(git rev-parse --short HEAD)"'49[[ "${1:-}" == "--no-restart" ]] && exit 050ssh $NODE 'export PATH=/opt/homebrew/bin:$PATH; cd ~/apps/maclustr-social && pm2 restart maclustr-social maclustr-social-gateway maclustr-social-scheduler --update-env >/dev/null; pm2 ls | grep -q mls-staging-api && { source scripts/staging-env.sh; node dist/migrate.mjs up; pm2 restart mls-staging-api mls-staging-gateway mls-staging-scheduler mls-staging-fixtures --update-env >/dev/null; }; for l in "" -staging; do launchctl kickstart -k "gui/$(id -u)/ai.spboucher.maclustr-navigator-worker$l" 2>/dev/null || true; done; sleep 3; source scripts/prod-env.sh; node dist/monitor.mjs'51