add compute server pipeline
dev / deploy (push) Failing after 3m20s
compute / deploy (push) Successful in 2m51s

This commit is contained in:
Daniil
2026-05-14 02:10:53 +03:00
parent ccb97eba2e
commit a2d92a4da9
2 changed files with 78 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
name: compute
on:
push:
branches:
- master
workflow_dispatch:
jobs:
deploy:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Write env file
run: |
test -n "${{ secrets.ENV_COMPUTE }}"
umask 077
printf '%s\n' "${{ secrets.ENV_COMPUTE }}" > .env
- name: Deploy backend on compute server
run: docker compose -f docker-compose.compute.yml up -d --build --remove-orphans
+56
View File
@@ -0,0 +1,56 @@
x-backend: &backend
image: cofee-backend:compute
build:
context: .
dockerfile: Dockerfile
target: prod
env_file:
- .env
restart: unless-stopped
volumes:
- ~/storage/cofee_backend_compute_api/.certs:/app/.certs:ro
- ~/storage/cofee_backend_compute_api/.artifacts:/app/.artifacts
networks:
- services_local
services:
api:
<<: *backend
container_name: cofee_backend_compute_api
ports:
- "${API_HOST:-0.0.0.0}:${API_PORT:-8000}:8000"
healthcheck:
test: [
"CMD",
"python",
"-c",
"import urllib.request;
urllib.request.urlopen('http://localhost:8000/api/health/')",
]
interval: 30s
timeout: 5s
retries: 3
start_period: 30s
worker:
<<: *backend
container_name: cofee_backend_compute_worker
command:
[
"dramatiq",
"cpv3.modules.tasks.service",
"--processes",
"1",
"--threads",
"2",
]
healthcheck:
test: ["CMD-SHELL", "pgrep -f dramatiq || exit 1"]
interval: 30s
timeout: 5s
retries: 3
start_period: 30s
networks:
services_local:
external: true