add compute server pipeline
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user