Compare commits

..

10 Commits

Author SHA1 Message Date
Sergey Bolshakov aa76657ea9 подключение к бд через prisma 2026-03-10 23:21:45 +03:00
Иван f62c27f27c remove gitlab ci
CI / build-and-start (push) Successful in 46s Details
CI / deploy (push) Successful in 47s Details
2026-03-10 22:33:29 +03:00
Иван 28edaef77d fix deploy 3
CI / build-and-start (push) Successful in 46s Details
CI / deploy (push) Successful in 1m19s Details
2026-03-10 22:20:16 +03:00
Иван f887be2884 fix deploy 2
CI / build-and-start (push) Successful in 44s Details
CI / deploy (push) Failing after 1s Details
2026-03-10 22:18:15 +03:00
Иван b321c3a206 fix docker deploy
CI / build-and-start (push) Successful in 45s Details
CI / deploy (push) Failing after 5s Details
2026-03-10 22:15:28 +03:00
Иван aba3763294 add docker deploy
CI / build-and-start (push) Successful in 44s Details
CI / deploy (push) Failing after 13s Details
2026-03-10 22:11:32 +03:00
Иван e45fd58232 fix pipline 2
CI / build-and-start (push) Successful in 48s Details
2026-03-10 21:54:50 +03:00
Иван a4e3861725 fix pipline
CI / build-and-start (push) Has been cancelled Details
2026-03-10 21:50:22 +03:00
Иван bc358547b5 trigger pipeline
CI / build-and-start (push) Failing after 51s Details
2026-03-10 21:48:03 +03:00
Иван d68c0b5756 fix ci/cd 2 2026-03-10 21:44:04 +03:00
3 changed files with 29 additions and 67 deletions

View File

@ -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 }}

View File

@ -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

View File

@ -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: