Add the missing api/web deployment path on top of the existing image build CI. - deploy/jorgecuadros-app.stack.yml: PROD app stack (api + web) pulling the git.mancinas.io registry images. Does not ship mysql/minio (separate stacks); API reaches them via DATABASE_URL / S3_ENDPOINT. API pinned to the jorgecuadros_db node for stable ingest/backup volumes; web is stateless. - deploy/jorgecuadros-app.env.example: documented stack env template. - .gitea/workflows/deploy.yml: manual (workflow_dispatch) deploy to Portainer via cssnr/portainer-stack-deploy-action. Inputs: image tag + scope (app = web+api, full = db+minio+app, applied db->minio->app). Make the web API origin runtime-configurable instead of build-baked: the root layout injects window.__API_ORIGIN__ from the API_ORIGIN env (force-dynamic) and lib/api.ts resolves it at runtime, so one built image serves any deployment. Also: dev.sh to run both dev servers (frees stale ports first) and move local dev to ports web 4500 / api 4501. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
51 lines
1.1 KiB
Bash
Executable File
51 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Start the development servers (API + web).
|
|
# Runs both in parallel and shuts both down on Ctrl-C.
|
|
#
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
WEB_PORT=4500
|
|
API_PORT=4501
|
|
|
|
api_pid=""
|
|
web_pid=""
|
|
|
|
# Free a port by killing whatever is listening on it (stale dev servers).
|
|
free_port() {
|
|
local port="$1"
|
|
local pids
|
|
pids="$(lsof -tiTCP:"$port" -sTCP:LISTEN 2>/dev/null || true)"
|
|
if [ -n "$pids" ]; then
|
|
echo "Freeing port $port (killing: $pids)"
|
|
kill $pids 2>/dev/null || true
|
|
sleep 1
|
|
fi
|
|
}
|
|
|
|
# Kill the child servers once, on Ctrl-C or exit.
|
|
cleanup() {
|
|
trap - EXIT INT TERM
|
|
echo ""
|
|
echo "Shutting down dev servers..."
|
|
[ -n "$api_pid" ] && kill "$api_pid" 2>/dev/null || true
|
|
[ -n "$web_pid" ] && kill "$web_pid" 2>/dev/null || true
|
|
}
|
|
trap cleanup EXIT INT TERM
|
|
|
|
free_port "$API_PORT"
|
|
free_port "$WEB_PORT"
|
|
|
|
echo "Starting API -> http://localhost:$API_PORT"
|
|
pnpm --filter @jorgecuadros/api start:dev &
|
|
api_pid=$!
|
|
|
|
echo "Starting web -> http://localhost:$WEB_PORT"
|
|
pnpm --filter @jorgecuadros/web dev &
|
|
web_pid=$!
|
|
|
|
# Wait for both. Ctrl-C fires the trap, which kills them.
|
|
wait
|