fix: port 3000 > 3020, APP_DIR /opt/cirux > /home/ubuntu/cirux
This commit is contained in:
+10
-7
@@ -18,13 +18,16 @@ ENV NEXT_PUBLIC_SUPABASE_ANON_KEY=$NEXT_PUBLIC_SUPABASE_ANON_KEY
|
||||
|
||||
RUN npm run build
|
||||
|
||||
# Next.js standalone creates a subdirectory named after the project folder.
|
||||
# We flatten it to a known location so the runner doesn't depend on the name.
|
||||
RUN echo "=== Standalone output structure ===" && \
|
||||
# Flatten standalone output — find the single subdir Next.js creates
|
||||
RUN set -e && \
|
||||
echo "=== Standalone output ===" && \
|
||||
ls -la /app/.next/standalone/ && \
|
||||
mkdir -p /app/.next/standalone-export && \
|
||||
cp -r /app/.next/standalone/*/ /app/.next/standalone-export/ && \
|
||||
ls -la /app/.next/standalone-export/
|
||||
STANDALONE_DIR=$(find /app/.next/standalone -maxdepth 1 -mindepth 1 -type d | head -1) && \
|
||||
echo "Copying from: $STANDALONE_DIR" && \
|
||||
cp -r "$STANDALONE_DIR"/* /app/.next/standalone-export/ && \
|
||||
ls -la /app/.next/standalone-export/ && \
|
||||
test -f /app/.next/standalone-export/server.js && echo "✅ server.js found" || (echo "❌ server.js NOT FOUND" && exit 1)
|
||||
|
||||
# ─── Stage 2: Production Runner ────────────────────────────────────────────
|
||||
FROM node:20-alpine AS runner
|
||||
@@ -38,10 +41,10 @@ ENV HOSTNAME=0.0.0.0
|
||||
RUN addgroup --system --gid 1001 nodejs
|
||||
RUN adduser --system --uid 1001 nextjs
|
||||
|
||||
# Copy flattened standalone output (server.js is now directly in /app)
|
||||
# Copy flattened standalone output (server.js directly in /app)
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone-export/ ./
|
||||
|
||||
# Copy static assets (images, fonts, etc.)
|
||||
# Copy static assets
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
|
||||
|
||||
+5
-5
@@ -5,7 +5,7 @@
|
||||
```
|
||||
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
|
||||
│ Internet │────▶│ Nginx (80/443) │───▶│ Next.js │
|
||||
│ │ │ Reverse Proxy │ │ (port 3000)│
|
||||
│ │ │ Reverse Proxy │ │ (port 3020)│
|
||||
└─────────────┘ └──────────────┘ └─────────────┘
|
||||
│
|
||||
┌──────┴──────┐
|
||||
@@ -19,8 +19,8 @@
|
||||
### 1. Clone & Prepare
|
||||
|
||||
```bash
|
||||
git clone <your-repo> /opt/cirux
|
||||
cd /opt/cirux
|
||||
git clone <your-repo> /home/ubuntu/cirux
|
||||
cd /home/ubuntu/cirux
|
||||
```
|
||||
|
||||
### 2. Configure Environment
|
||||
@@ -159,7 +159,7 @@ jobs:
|
||||
username: ${{ secrets.VPS_USER }}
|
||||
key: ${{ secrets.VPS_SSH_KEY }}
|
||||
script: |
|
||||
cd /opt/cirux
|
||||
cd /home/ubuntu/cirux
|
||||
git pull
|
||||
docker-compose down
|
||||
docker-compose build --no-cache
|
||||
@@ -189,7 +189,7 @@ docker-compose restart nginx
|
||||
### Health check fails
|
||||
```bash
|
||||
# Test locally
|
||||
curl http://localhost:3000/api/health
|
||||
curl http://localhost:3020/api/health
|
||||
# Should return {"status":"ok"}
|
||||
```
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
# ─── EnFlow Auto-Deploy Script ───────────────────────────────────────────────
|
||||
# Called by Gitea post-receive hook or manually
|
||||
# Usage: /opt/cirux/deploy-auto.sh
|
||||
# Usage: /home/ubuntu/cirux/deploy-auto.sh
|
||||
|
||||
set -e
|
||||
|
||||
@@ -40,7 +40,7 @@ sleep 10
|
||||
|
||||
RETRIES=5
|
||||
while [ $RETRIES -gt 0 ]; do
|
||||
if curl -sf http://localhost:3000/api/health > /dev/null 2>&1; then
|
||||
if curl -sf http://localhost:3020/api/health > /dev/null 2>&1; then
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') - Deploy successful ✅" >> "$LOG_FILE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ services:
|
||||
ports:
|
||||
- "127.0.0.1:3020:3020"
|
||||
healthcheck:
|
||||
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/api/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"]
|
||||
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3020/api/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
|
||||
@@ -9,7 +9,7 @@ set -e
|
||||
APP_DIR="/home/ubuntu/cirux"
|
||||
LOG_FILE="/var/log/cirux-deploy.log"
|
||||
BRANCH="main"
|
||||
DEPLOY_SCRIPT="/opt/cirux/deploy-auto.sh"
|
||||
DEPLOY_SCRIPT="/home/ubuntu/cirux/deploy-auto.sh"
|
||||
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') - Push received, starting deploy..." >> "$LOG_FILE"
|
||||
|
||||
@@ -22,7 +22,7 @@ while read oldrev newrev refname; do
|
||||
cd "$APP_DIR"
|
||||
|
||||
# Run deploy script
|
||||
/opt/cirux/deploy-auto.sh >> "$LOG_FILE" 2>&1
|
||||
/home/ubuntu/cirux/deploy-auto.sh >> "$LOG_FILE" 2>&1
|
||||
|
||||
# Verify health
|
||||
sleep 5
|
||||
|
||||
Reference in New Issue
Block a user