Initial commit for iiEasy: all files included
This commit is contained in:
38
deploy-on-node.sh
Executable file
38
deploy-on-node.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
# Run this ON the Nomad node after sync-to-nomad.sh
|
||||
# Builds images locally and runs Nomad job
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
NOMAD_HOST="${NOMAD_HOST:-192.168.1.16}"
|
||||
STRAPI_PUBLIC_URL="${STRAPI_PUBLIC_URL:-http://${NOMAD_HOST}:1337}"
|
||||
|
||||
echo "=== iiEasy Build & Deploy (on node) ==="
|
||||
echo "Strapi URL: $STRAPI_PUBLIC_URL"
|
||||
echo ""
|
||||
|
||||
# 1. Build Docker images
|
||||
echo "Building frontend..."
|
||||
docker build --build-arg VITE_STRAPI_URL="$STRAPI_PUBLIC_URL" -t iieasy-frontend:latest .
|
||||
|
||||
echo "Building Strapi..."
|
||||
docker build -t iieasy-strapi:latest ./iiEasy
|
||||
|
||||
# 2. Create host volume dirs
|
||||
echo "Creating host volume dirs..."
|
||||
sudo mkdir -p /opt/nomad/iieasy/postgres-data /opt/nomad/iieasy/uploads
|
||||
sudo chmod -R 755 /opt/nomad/iieasy/postgres-data /opt/nomad/iieasy/uploads
|
||||
|
||||
# 3. Run Nomad job
|
||||
echo ""
|
||||
echo "Submitting Nomad job..."
|
||||
export NOMAD_ADDR="${NOMAD_ADDR:-http://127.0.0.1:4646}"
|
||||
nomad job run nomad/iieasy.nomad.hcl
|
||||
|
||||
echo ""
|
||||
echo "Done. Check: nomad job status iieasy"
|
||||
echo "Frontend: http://${NOMAD_HOST}:3000"
|
||||
echo "Strapi: http://${NOMAD_HOST}:1337/admin"
|
||||
Reference in New Issue
Block a user