This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
name: Test & Deploy to Snapdeploy
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build-test-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
# ---------- Сборка основного образа ----------
|
||||
- name: Build eventhub image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: docker/Dockerfile
|
||||
load: true
|
||||
tags: eventhub:latest
|
||||
|
||||
# ---------- Сборка тестового образа поверх eventhub ----------
|
||||
- name: Build API test image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: docker/ApiTests.Dockerfile
|
||||
load: true
|
||||
tags: eventhub-api-tests:latest
|
||||
|
||||
# ---------- Запуск тестов ----------
|
||||
- name: Run API tests
|
||||
run: |
|
||||
docker run --rm eventhub-api-tests:latest
|
||||
|
||||
# ---------- Пуш основного образа в Registry (опционально) ----------
|
||||
- name: Push eventhub image to Gitea Registry
|
||||
if: success()
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: git.sabilin.com/eventhub/eventhub:test
|
||||
|
||||
# ---------- Деплой на Snapdeploy ----------
|
||||
- name: Deploy to Snapdeploy
|
||||
if: success()
|
||||
run: |
|
||||
# TODO: замените на реальный вызов API Snapdeploy
|
||||
echo "Deploying to Snapdeploy test environment..."
|
||||
# curl -X POST https://api.snapdeploy.dev/deploy \
|
||||
# -H "Authorization: Bearer ${{ secrets.SNAPDEPLOY_TOKEN }}" \
|
||||
# ...
|
||||
@@ -0,0 +1,47 @@
|
||||
name: Deploy to Stage
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
deploy-stage:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: git.sabilin.com
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push eventhub
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: git.sabilin.com/eventhub/eventhub:stage
|
||||
|
||||
- name: Build and push bot-emulator
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: ./docker/bot-emulator-users
|
||||
push: true
|
||||
tags: git.sabilin.com/eventhub/bot-emulator-users:stage
|
||||
|
||||
- name: Deploy to stage server
|
||||
uses: appleboy/ssh-action@v0.1.5
|
||||
with:
|
||||
host: ${{ secrets.STAGE_SSH_HOST }}
|
||||
username: ${{ secrets.STAGE_SSH_USER }}
|
||||
key: ${{ secrets.STAGE_SSH_PRIVATE_KEY }}
|
||||
script: |
|
||||
cd /opt/eventhub-stage
|
||||
docker pull git.sabilin.com/eventhub/eventhub:stage
|
||||
docker pull git.sabilin.com/eventhub/bot-emulator-users:stage
|
||||
docker stack deploy -c docker-compose.stage.yml eventhub-stage --with-registry-auth
|
||||
@@ -0,0 +1,12 @@
|
||||
RELEASE_COOKIE=FuNHSU3SIiW8ICu2XIbl0pvpxAhpBvO2Wki7CT6q2bpHDSlQ8p7gtUgjnyXpPJU5
|
||||
GRAFANA_ADMIN_PASSWORD=admin
|
||||
JWT_SECRET=IDhKNFRLZFDYgPvVXwg4T7hAviQ2I1VGeEn5vXufQXK3AAErZuhMWy8J1uxJ0kGF
|
||||
TRAEFIK_LOG_PATH=/app/traefik/logs/access.log
|
||||
ADMIN_SUPER_EMAIL=superadmin@eventhub.local
|
||||
ADMIN_SUPER_PASSWORD=123456
|
||||
ADMIN_EMAIL=admin@eventhub.local
|
||||
ADMIN_PASSWORD=123456
|
||||
ADMIN_MODER_EMAIL=moderator@eventhub.local
|
||||
ADMIN_MODER_PASSWORD=123456
|
||||
ADMIN_SUPPORT_EMAIL=support@eventhub.local
|
||||
ADMIN_SUPPORT_PASSWORD=123456
|
||||
@@ -0,0 +1,81 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
# ================== Балансировщик ==================
|
||||
traefik:
|
||||
image: traefik:latest
|
||||
command:
|
||||
- "--log.level=DEBUG"
|
||||
- "--api.insecure=true"
|
||||
- "--providers.docker=true"
|
||||
- "--providers.docker.exposedbydefault=false"
|
||||
- "--entrypoints.web.address=:80"
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
||||
networks:
|
||||
- eventhub-net
|
||||
deploy:
|
||||
replicas: 1
|
||||
restart_policy:
|
||||
condition: any
|
||||
|
||||
# ================== Кластер EventHub ==================
|
||||
eventhub:
|
||||
image: git.sabilin.com/eventhub/eventhub:stage
|
||||
hostname: "eventhub-node{{.Task.Slot}}"
|
||||
environment:
|
||||
- NODE_NAME=eventhub-node{{.Task.Slot}}
|
||||
- RELEASE_COOKIE=${RELEASE_COOKIE}
|
||||
- JWT_SECRET=${JWT_SECRET}
|
||||
- ADMIN_SUPER_EMAIL=${ADMIN_SUPER_EMAIL}
|
||||
- ADMIN_SUPER_PASSWORD=${ADMIN_SUPER_PASSWORD}
|
||||
- ADMIN_EMAIL=${ADMIN_EMAIL}
|
||||
- ADMIN_PASSWORD=${ADMIN_PASSWORD}
|
||||
- CLUSTER_MODE=true
|
||||
- DNS_NAME=eventhub-node
|
||||
networks:
|
||||
eventhub-net:
|
||||
aliases:
|
||||
- eventhub-node
|
||||
volumes:
|
||||
- eventhub-data:/app/data
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
deploy:
|
||||
replicas: 1
|
||||
endpoint_mode: dnsrr
|
||||
restart_policy:
|
||||
condition: any
|
||||
|
||||
# ================== Эмулятор ботов ==================
|
||||
bot-emulator-users:
|
||||
image: git.sabilin.com/eventhub/bot-emulator-users:stage
|
||||
environment:
|
||||
- ADMIN_API_HOST=http://eventhub-node:8445
|
||||
- CLIENT_API_HOST=http://eventhub-node:8080
|
||||
- ADMIN_EMAIL=${ADMIN_EMAIL}
|
||||
- ADMIN_PASSWORD=${ADMIN_PASSWORD}
|
||||
- BOT_PASSWORD=${BOT_PASSWORD}
|
||||
- STARTUP_DELAY=30
|
||||
- DEBUG=true
|
||||
networks:
|
||||
- eventhub-net
|
||||
depends_on:
|
||||
- eventhub
|
||||
deploy:
|
||||
replicas: 0
|
||||
restart_policy:
|
||||
condition: any
|
||||
|
||||
networks:
|
||||
eventhub-net:
|
||||
driver: overlay
|
||||
|
||||
volumes:
|
||||
eventhub-data:
|
||||
Reference in New Issue
Block a user