forked from syntaxbullet/aurorabot
Compare commits
2 Commits
e252d6e00a
...
2b60883173
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b60883173 | ||
|
|
c2d67d7435 |
102
.github/workflows/deploy.yml
vendored
102
.github/workflows/deploy.yml
vendored
@@ -100,105 +100,3 @@ jobs:
|
|||||||
bash shared/scripts/test-sequential.sh
|
bash shared/scripts/test-sequential.sh
|
||||||
env:
|
env:
|
||||||
NODE_ENV: test
|
NODE_ENV: test
|
||||||
|
|
||||||
# ==========================================================================
|
|
||||||
# Build Job
|
|
||||||
# ==========================================================================
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: test
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
outputs:
|
|
||||||
image_tag: ${{ steps.meta.outputs.tags }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Log in to Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
||||||
tags: |
|
|
||||||
type=sha,prefix=
|
|
||||||
type=raw,value=latest
|
|
||||||
|
|
||||||
- name: Build and Push Docker Image
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./Dockerfile.prod
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
|
|
||||||
# ==========================================================================
|
|
||||||
# Deploy Job
|
|
||||||
# ==========================================================================
|
|
||||||
deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: build
|
|
||||||
environment: production
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Deploy to Production Server
|
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.VPS_HOST }}
|
|
||||||
username: ${{ secrets.VPS_USER }}
|
|
||||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
||||||
script: |
|
|
||||||
cd ~/Aurora
|
|
||||||
|
|
||||||
# Pull latest code
|
|
||||||
git pull origin main
|
|
||||||
|
|
||||||
# Pull latest Docker image
|
|
||||||
docker compose -f docker-compose.prod.yml pull 2>/dev/null || true
|
|
||||||
|
|
||||||
# Build and restart containers
|
|
||||||
docker compose -f docker-compose.prod.yml build --no-cache
|
|
||||||
docker compose -f docker-compose.prod.yml down
|
|
||||||
docker compose -f docker-compose.prod.yml up -d
|
|
||||||
|
|
||||||
# Wait for health checks
|
|
||||||
sleep 15
|
|
||||||
|
|
||||||
# Verify deployment
|
|
||||||
docker ps | grep aurora
|
|
||||||
|
|
||||||
# Cleanup old images
|
|
||||||
docker image prune -f
|
|
||||||
|
|
||||||
- name: Verify Deployment
|
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.VPS_HOST }}
|
|
||||||
username: ${{ secrets.VPS_USER }}
|
|
||||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
||||||
script: |
|
|
||||||
# Check if app container is healthy
|
|
||||||
if docker ps | grep -q "aurora_app.*healthy"; then
|
|
||||||
echo "✅ Deployment successful - aurora_app is healthy"
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "⚠️ Health check pending, checking container status..."
|
|
||||||
docker ps | grep aurora
|
|
||||||
docker logs aurora_app --tail 20
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|||||||
@@ -92,11 +92,12 @@ import { createWebServer } from "./server";
|
|||||||
describe("Settings API", () => {
|
describe("Settings API", () => {
|
||||||
let serverInstance: WebServerInstance;
|
let serverInstance: WebServerInstance;
|
||||||
const PORT = 3009;
|
const PORT = 3009;
|
||||||
const BASE_URL = `http://localhost:${PORT}`;
|
const HOSTNAME = "127.0.0.1";
|
||||||
|
const BASE_URL = `http://${HOSTNAME}:${PORT}`;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
jest.clearAllMocks();
|
jest.clearAllMocks();
|
||||||
serverInstance = await createWebServer({ port: PORT });
|
serverInstance = await createWebServer({ port: PORT, hostname: HOSTNAME });
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export async function createWebServer(config: WebServerConfig = {}): Promise<Web
|
|||||||
|
|
||||||
// Manage build process in development
|
// Manage build process in development
|
||||||
let buildProcess: Subprocess | undefined;
|
let buildProcess: Subprocess | undefined;
|
||||||
const isDev = process.env.NODE_ENV !== "production";
|
const isDev = process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test";
|
||||||
|
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
logger.info("web", "Starting Web Bundler in Watch Mode...");
|
logger.info("web", "Starting Web Bundler in Watch Mode...");
|
||||||
|
|||||||
Reference in New Issue
Block a user