Merge commit '2f56148fdbe1770635d4b5dc6296761f646a1c41'

This commit is contained in:
Alexa Amundson
2025-11-21 13:53:41 -06:00
6 changed files with 90 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
FROM node:18-alpine AS builder FROM node:20-alpine AS builder
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package*.json ./
@@ -7,16 +7,18 @@ RUN npm install
COPY . . COPY . .
RUN npm run build RUN npm run build
FROM node:18-alpine AS runner FROM node:20-alpine AS runner
WORKDIR /app WORKDIR /app
COPY package*.json ./ ENV NODE_ENV=production
RUN npm install --omit=dev
COPY --from=builder /app/.next ./.next # Copy standalone output
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/public ./public COPY --from=builder /app/public ./public
COPY --from=builder /app/next.config.* ./
ENV PORT=8080 # Railway provides PORT dynamically, but we can set a default
EXPOSE 8080 ENV PORT=3000
CMD ["npm", "start"] EXPOSE $PORT
CMD ["node", "server.js"]

View File

@@ -63,10 +63,54 @@ See `.env.example` for available variables. Key values:
- `/api/debug-env` safe environment surface for troubleshooting - `/api/debug-env` safe environment surface for troubleshooting
## Deployment (Railway) ## Deployment (Railway)
- Build command: `npm install && npm run build`
- Start command: `npm start` This repository is configured for deployment on [Railway](https://railway.app) with the following setup:
- Port: `8080`
- Healthcheck: `/api/health` ### Automatic Configuration
The repository includes Railway configuration files:
- `railway.toml` Railway deployment configuration (recommended)
- `railway.json` Legacy Railway configuration (deprecated but supported)
- `nixpacks.toml` Nixpacks build configuration
### Required Environment Variables
Set these in your Railway service settings:
- `NODE_ENV=production` (automatically set by Railway)
- `PORT` (automatically provided by Railway)
### Optional Environment Variables
For full functionality, configure:
- `SERVICE_BASE_URL` Public URL of this console (e.g., `https://console.blackroad.systems`)
- `OS_ROOT` Base BlackRoad OS root URL (e.g., `https://blackroad.systems`)
- `CORE_API_URL` Core API endpoint (optional)
- `AGENTS_API_URL` Agents API endpoint (optional)
- `PUBLIC_CONSOLE_URL` Public console URL (optional)
- `NEXT_PUBLIC_OS_ROOT` Client-side OS root URL
- `NEXT_PUBLIC_SERVICE_ID=console`
- `NEXT_PUBLIC_SERVICE_NAME="BlackRoad OS Prism Console"`
### Deployment Details
- **Build Command**: Automatically detected from `package.json` (`npm run build`)
- **Start Command**: Automatically detected from `package.json` (`npm start`)
- **Health Check**: `/api/health` (configured in `railway.toml`)
- **Port**: Dynamically assigned by Railway via `$PORT` environment variable
### Manual Deployment
If deploying manually or with custom settings:
1. Build: `npm install && npm run build`
2. Start: `npm start` (uses standalone Next.js server)
3. Ensure `PORT` environment variable is set
### Healthcheck Response
The `/api/health` endpoint returns:
```json
{
"ok": true,
"service": "console",
"status": "ok",
"environment": "production",
"version": "1.0.0"
}
```
## Additional Notes ## Additional Notes
- Base URL: https://console.blackroad.systems - Base URL: https://console.blackroad.systems

11
nixpacks.toml Normal file
View File

@@ -0,0 +1,11 @@
[phases.setup]
nixPkgs = ["nodejs-20_x"]
[phases.install]
cmds = ["npm ci"]
[phases.build]
cmds = ["npm run build"]
[start]
cmd = "npm start"

View File

@@ -6,7 +6,8 @@
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
"build": "next build", "build": "next build",
"start": "next start -p ${PORT:-3000}", "start": "node .next/standalone/server.js",
"start:dev": "next start -p ${PORT:-3000}",
"lint": "next lint" "lint": "next lint"
}, },
"keywords": [ "keywords": [

View File

@@ -8,5 +8,13 @@
"deploy": { "deploy": {
"healthcheckPath": "/api/health", "healthcheckPath": "/api/health",
"restartPolicyType": "ON_FAILURE" "restartPolicyType": "ON_FAILURE"
"builder": "NIXPACKS"
},
"deploy": {
"startCommand": "npm start",
"healthcheckPath": "/api/health",
"healthcheckTimeout": 100,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
} }
} }

10
railway.toml Normal file
View File

@@ -0,0 +1,10 @@
[build]
builder = "NIXPACKS"
buildCommand = "npm install && npm run build"
[deploy]
startCommand = "npm start"
healthcheckPath = "/api/health"
healthcheckTimeout = 100
restartPolicyType = "ON_FAILURE"
restartPolicyMaxRetries = 10