Compare commits
1 Commits
aa76657ea9
...
9b416815ef
| Author | SHA1 | Date |
|---|---|---|
|
|
9b416815ef |
|
|
@ -6,13 +6,19 @@ on:
|
|||
|
||||
jobs:
|
||||
build-and-start:
|
||||
runs-on: [ubuntu-latest, docker]
|
||||
container:
|
||||
image: node:20-bookworm
|
||||
# Must match your runner's labels (e.g. from act_runner register --labels).
|
||||
# If your runner has other labels, replace with those (e.g. runs-on: my-runner).
|
||||
runs-on: [self-hosted]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: "npm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
|
|
@ -24,19 +30,3 @@ jobs:
|
|||
timeout 20 npm run start:prod || [ $? -eq 124 ]
|
||||
env:
|
||||
PORT: 4000
|
||||
|
||||
deploy:
|
||||
needs: build-and-start
|
||||
runs-on: [ubuntu-latest, docker]
|
||||
container:
|
||||
image: node:20-bookworm
|
||||
steps:
|
||||
- name: Install Docker
|
||||
run: apt-get update -qq && apt-get install -y -qq docker.io docker-compose
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Deploy
|
||||
run: docker-compose -p docker-stack up -d --build backend
|
||||
env:
|
||||
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
||||
UPLOADS_PATH: ${{ secrets.UPLOADS_PATH }}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
stages:
|
||||
- deploy
|
||||
|
||||
variables:
|
||||
COMPOSE_PROJECT_NAME: travelmarine-backend
|
||||
DOCKER_HOST: unix:///var/run/docker.sock
|
||||
|
||||
deploy:
|
||||
stage: deploy
|
||||
only:
|
||||
- main
|
||||
script:
|
||||
- docker compose -p "$COMPOSE_PROJECT_NAME" up -d --build
|
||||
environment:
|
||||
name: production
|
||||
url: http://89.169.188.2
|
||||
|
|
@ -1,18 +1,50 @@
|
|||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_DB: travelmarinedb
|
||||
POSTGRES_USER: yacht
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-change_me}
|
||||
volumes:
|
||||
- pg-data:/var/lib/postgresql/data
|
||||
ports:
|
||||
- '127.0.0.1:5432:5432'
|
||||
|
||||
backend:
|
||||
build: .
|
||||
restart: always
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
PORT: 4000
|
||||
DATABASE_URL: ${DATABASE_URL}
|
||||
UPLOAD_PATH: /app/uploads
|
||||
APP_URL: ${APP_URL:-https://api.travelmarine.ru}
|
||||
DATABASE_URL: postgresql://yacht:${POSTGRES_PASSWORD:-change_me}@postgres:5432/travelmarinedb
|
||||
UPLOAD_PATH: ./uploads
|
||||
APP_URL: http://localhost:4000
|
||||
volumes:
|
||||
- ${UPLOADS_PATH:-./uploads}:/app/uploads
|
||||
networks:
|
||||
- app-network
|
||||
- ./uploads:/app/uploads
|
||||
depends_on:
|
||||
- postgres
|
||||
ports:
|
||||
- '127.0.0.1:4000:4000'
|
||||
restart: always
|
||||
|
||||
networks:
|
||||
app-network:
|
||||
external: true
|
||||
pgbackup:
|
||||
image: prodrigestivill/postgres-backup-local:16
|
||||
restart: always
|
||||
depends_on:
|
||||
- postgres
|
||||
environment:
|
||||
POSTGRES_HOST: postgres
|
||||
POSTGRES_DB: yachtbooking
|
||||
POSTGRES_USER: yacht
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-change_me}
|
||||
SCHEDULE: '0 3 * * *'
|
||||
BACKUP_KEEP_DAYS: 7
|
||||
BACKUP_KEEP_WEEKS: 4
|
||||
BACKUP_KEEP_MONTHS: 3
|
||||
BACKUP_DIR: /backups
|
||||
volumes:
|
||||
- pg-backups:/backups
|
||||
|
||||
volumes:
|
||||
pg-data:
|
||||
pg-backups:
|
||||
|
|
|
|||
Loading…
Reference in New Issue