Compare commits
10 Commits
9b416815ef
...
aa76657ea9
| Author | SHA1 | Date |
|---|---|---|
|
|
aa76657ea9 | |
|
|
f62c27f27c | |
|
|
28edaef77d | |
|
|
f887be2884 | |
|
|
b321c3a206 | |
|
|
aba3763294 | |
|
|
e45fd58232 | |
|
|
a4e3861725 | |
|
|
bc358547b5 | |
|
|
d68c0b5756 |
|
|
@ -6,19 +6,13 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-start:
|
build-and-start:
|
||||||
# Must match your runner's labels (e.g. from act_runner register --labels).
|
runs-on: [ubuntu-latest, docker]
|
||||||
# If your runner has other labels, replace with those (e.g. runs-on: my-runner).
|
container:
|
||||||
runs-on: [self-hosted]
|
image: node:20-bookworm
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "20"
|
|
||||||
cache: "npm"
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
|
|
@ -30,3 +24,19 @@ jobs:
|
||||||
timeout 20 npm run start:prod || [ $? -eq 124 ]
|
timeout 20 npm run start:prod || [ $? -eq 124 ]
|
||||||
env:
|
env:
|
||||||
PORT: 4000
|
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 }}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
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,50 +1,18 @@
|
||||||
services:
|
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:
|
backend:
|
||||||
build: .
|
build: .
|
||||||
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
PORT: 4000
|
PORT: 4000
|
||||||
DATABASE_URL: postgresql://yacht:${POSTGRES_PASSWORD:-change_me}@postgres:5432/travelmarinedb
|
DATABASE_URL: ${DATABASE_URL}
|
||||||
UPLOAD_PATH: ./uploads
|
UPLOAD_PATH: /app/uploads
|
||||||
APP_URL: http://localhost:4000
|
APP_URL: ${APP_URL:-https://api.travelmarine.ru}
|
||||||
volumes:
|
volumes:
|
||||||
- ./uploads:/app/uploads
|
- ${UPLOADS_PATH:-./uploads}:/app/uploads
|
||||||
depends_on:
|
networks:
|
||||||
- postgres
|
- app-network
|
||||||
ports:
|
|
||||||
- '127.0.0.1:4000:4000'
|
|
||||||
restart: always
|
|
||||||
|
|
||||||
pgbackup:
|
networks:
|
||||||
image: prodrigestivill/postgres-backup-local:16
|
app-network:
|
||||||
restart: always
|
external: true
|
||||||
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