Compare commits

..

15 Commits

Author SHA1 Message Date
45cee0785f Update CI workflow to reflect new container registry path
All checks were successful
CI/CD / test-backend (pull_request) Successful in 9s
CI/CD / test-frontend (pull_request) Successful in 10s
CI/CD / build-and-deploy (pull_request) Successful in 25s
CI/CD Pipeline / Overall Status ✅ Все проверки прошли успешно
CI/CD / pr-status (pull_request) Successful in 1s
2026-04-03 15:27:56 +03:00
832568450a Update CI workflow to use new container naming and registry path
Some checks failed
CI/CD / test-backend (pull_request) Successful in 9s
CI/CD / test-frontend (pull_request) Successful in 10s
CI/CD / build-and-deploy (pull_request) Failing after 17s
CI/CD Pipeline / Overall Status ✅ Все проверки прошли успешно
CI/CD / pr-status (pull_request) Successful in 1s
- Changed container name from 'fastapi-container' to 'fastapi-test-container' for clarity.
- Updated image tag to reference the new registry path 'git.rlkdev.ru/RLK/fastapi-app:latest'.
- Adjusted logs check to reflect the new container name for successful application startup detection.
2026-04-03 15:23:23 +03:00
cc14322c12 Refactor Dockerfile and CI workflow for improved dependency management and cleanup
All checks were successful
CI/CD / test-frontend (pull_request) Successful in 10s
CI/CD / test-backend (pull_request) Successful in 28s
CI/CD Pipeline / Overall Status ✅ Все проверки прошли успешно
CI/CD / pr-status (pull_request) Successful in 1s
CI/CD / build-and-deploy (pull_request) Successful in 26s
- Updated Dockerfile to optimize layer caching by copying requirements.txt before application code.
- Added caching for pip packages in CI workflow to speed up dependency installation.
- Implemented cleanup of dangling Docker images post-deployment.
2026-04-02 18:50:50 +03:00
4e8300f6f0 Refactor CI workflow to improve container readiness check and remove pip caching step
All checks were successful
CI/CD / test-backend (pull_request) Successful in 7s
CI/CD / test-frontend (pull_request) Successful in 9s
CI/CD / build-and-deploy (pull_request) Successful in 1m4s
CI/CD Pipeline / Overall Status ✅ Все проверки прошли успешно
CI/CD / pr-status (pull_request) Successful in 1s
- Replaced the pip caching step with a direct installation of dependencies.
- Enhanced the container readiness check by implementing a timeout mechanism that waits for application startup logs instead of a fixed number of attempts.
2026-04-02 18:35:27 +03:00
b64d49ddaa Update Dockerfile to reference requirements from the api directory
Some checks failed
CI/CD / test-backend (pull_request) Successful in 30s
CI/CD / test-frontend (pull_request) Successful in 9s
CI/CD / build-and-deploy (pull_request) Failing after 2m0s
CI/CD Pipeline / Overall Status ✅ Все проверки прошли успешно
CI/CD / pr-status (pull_request) Successful in 1s
2026-04-02 18:22:42 +03:00
8616f59c95 docker fix
Some checks failed
CI/CD / test-backend (pull_request) Successful in 30s
CI/CD / test-frontend (pull_request) Successful in 10s
CI/CD / build-and-deploy (pull_request) Failing after 32s
CI/CD Pipeline / Overall Status ✅ Все проверки прошли успешно
CI/CD / pr-status (pull_request) Successful in 1s
2026-04-02 18:18:25 +03:00
edb83e0fad cache test
Some checks failed
CI/CD / test-backend (pull_request) Successful in 1m25s
CI/CD / test-frontend (pull_request) Successful in 9s
CI/CD / pr-status (pull_request) Has been cancelled
CI/CD / build-and-deploy (pull_request) Has been cancelled
2026-04-02 18:15:01 +03:00
1ccdd8c66a fix cd
Some checks failed
CI/CD / test-backend (pull_request) Successful in 7s
CI/CD / test-frontend (pull_request) Successful in 10s
CI/CD / build-and-deploy (pull_request) Failing after 1m45s
CI/CD Pipeline / Overall Status ✅ Все проверки прошли успешно
CI/CD / pr-status (pull_request) Successful in 1s
2026-04-02 17:43:45 +03:00
34640858d8 fix dockerfile
Some checks failed
CI/CD / test-backend (pull_request) Successful in 7s
CI/CD / test-frontend (pull_request) Successful in 10s
CI/CD / build-and-deploy (pull_request) Failing after 41s
CI/CD Pipeline / Overall Status ✅ Все проверки прошли успешно
CI/CD / pr-status (pull_request) Successful in 1s
2026-04-02 17:30:26 +03:00
3359d088e9 add dockerfile
Some checks failed
CI/CD / test-backend (pull_request) Successful in 7s
CI/CD / test-frontend (pull_request) Successful in 9s
CI/CD / build-and-deploy (pull_request) Failing after 15s
CI/CD Pipeline / Overall Status ✅ Все проверки прошли успешно
CI/CD / pr-status (pull_request) Successful in 1s
2026-04-02 17:28:32 +03:00
8874cea21d fix registry login
Some checks failed
CI/CD / test-backend (pull_request) Successful in 9s
CI/CD / test-frontend (pull_request) Successful in 10s
CI/CD / build-and-deploy (pull_request) Failing after 16s
CI/CD Pipeline / Overall Status ✅ Все проверки прошли успешно
CI/CD / pr-status (pull_request) Successful in 1s
2026-04-02 17:14:48 +03:00
c185b62441 test build and deploy
Some checks failed
CI/CD / test-backend (pull_request) Successful in 7s
CI/CD / test-frontend (pull_request) Successful in 9s
CI/CD / build-and-deploy (pull_request) Failing after 2m38s
CI/CD Pipeline / Overall Status ✅ Все проверки прошли успешно
CI/CD / pr-status (pull_request) Successful in 1s
2026-04-02 17:10:21 +03:00
867fcaa722 edit prekol ac dc
All checks were successful
CI/CD / test-backend (pull_request) Successful in 9s
CI/CD / test-frontend (pull_request) Successful in 10s
CI/CD Pipeline / Overall Status ✅ Все проверки прошли успешно
CI/CD / pr-status (pull_request) Successful in 1s
2026-04-02 16:47:23 +03:00
b3eaf03627 Add manual archiving workflow to Gitea CI
All checks were successful
CI/CD / test-backend (pull_request) Successful in 7s
CI/CD / test-frontend (pull_request) Successful in 9s
CI/CD Pipeline / Overall Status ✅ Все проверки прошли успешно
CI/CD / pr-status (pull_request) Successful in 1s
- Introduced a new workflow for manual archiving, allowing users to trigger the creation of archives for the api and web directories.
- The workflow includes steps for code checkout and artifact upload with a retention policy of 7 days.
2026-03-24 13:21:48 +03:00
288a2d81a1 Refactor CI workflow to localize job names in Russian and remove deprecated multistep and test workflows. Update artifact upload step to ensure clarity in job descriptions.
All checks were successful
CI/CD / test-backend (pull_request) Successful in 6s
CI/CD / test-frontend (pull_request) Successful in 9s
CI/CD Pipeline / Overall Status ✅ Все проверки прошли успешно
CI/CD / pr-status (pull_request) Successful in 1s
CI/CD / create-archives (pull_request) Has been skipped
2026-03-24 13:11:46 +03:00
5 changed files with 125 additions and 418 deletions

View File

@@ -0,0 +1,20 @@
name: Ручная архивация
on:
workflow_dispatch: # только ручной запуск
jobs:
create-archives:
runs-on: ubuntu-latest
steps:
- name: Проверка кода
uses: actions/checkout@v4
- name: Загрузка артифакта
uses: actions/upload-artifact@v3
with:
name: build-artifacts-${{ github.run_id }}
path: |
api/
web/
retention-days: 7

View File

@@ -12,76 +12,129 @@ jobs:
test-backend: test-backend:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Проверка кода
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set up Python - name: Настройка Python
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: '3.11' python-version: '3.11'
- name: Install dependencies - name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('api/requirements.txt') }}
- name: Установка зависимостей
run: | run: |
cd api cd api
pip install -r requirements.txt pip install -r requirements.txt
- name: Verify build - name: Подтверждение сборки
run: | run: |
python -c "from api.main import app" python -c "from api.main import app"
- name: Run tests - name: Запуск тестов
run: | run: |
pytest -q pytest -q
test-frontend: test-frontend:
needs: test-backend
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Проверка кода
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set up Node.js - name: Настройка Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: '20' node-version: '20'
- name: Install dependencies - name: Установка зависимостей
run: | run: |
cd web cd web
npm ci npm ci
- name: Build frontend - name: Сборка фронта
run: | run: |
cd web cd web
npm run build npm run build
create-archives: build-and-deploy:
needs: [test-backend, test-frontend] needs: test-backend
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: always() && !cancelled() if: success() # Запускается только если тесты прошли успешно
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
# - name: Create archives - name: Set up Docker Buildx
# run: | uses: docker/setup-buildx-action@v3
# echo "Creating full-build.zip with api and web..."
# # Создаём единый архив, включающий папки api и web, с исключениями
# zip -r full-build.zip api/ web/ \
# -x "api/*.pyc" "api/*__pycache__*" "api/.git*" "api/.pytest_cache*" \
# -x "web/node_modules/*" "web/.git*" "web/dist/*" "web/*.log" \
# || echo "Warning: zip command had issues"
# # Проверяем, что файл создан
# ls -la full-build.zip
- name: Upload artifacts - name: Log in to container registry
uses: actions/upload-artifact@v3 uses: docker/login-action@v3
with: with:
name: build-artifacts-${{ github.run_id }} registry: git.rlkdev.ru # Замените на ваш Gitea registry
path: | username: ${{ secrets.REGISTRY_USERNAME }}
api/ password: ${{ secrets.REGISTRY_TOKEN }}
web/
retention-days: 7 - name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('api/requirements.txt') }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
tags: git.rlkdev.ru/rlk/fastapi-app:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
- name: Stop and remove old container
run: |
docker stop fastapi-test-container || true
docker rm fastapi-test-container || true
- name: Run new container
run: |
docker run -d \
--name fastapi-test-container \
-p 8080:8000 \
--restart unless-stopped \
git.rlkdev.ru/rlk/fastapi-app:latest
- name: Wait for container to be ready
run: |
timeout=60
interval=2
elapsed=0
while [ $elapsed -lt $timeout ]; do
if docker logs fastapi-test-container 2>&1 | grep -q "Application startup complete"; then
echo "Application startup detected in logs"
echo "Deployment successful!"
exit 0
fi
echo "Waiting for startup log... ($elapsed/$timeout sec)"
sleep $interval
elapsed=$((elapsed + interval))
done
echo "Timeout: Application startup not detected in logs"
docker logs fastapi-container
exit 1
- name: Clean up dangling images
run: |
echo "Removing old dangling images..."
docker image prune -f
echo "Current images after cleanup:"
docker images
# Явный статус для PR # Явный статус для PR
pr-status: pr-status:
@@ -89,7 +142,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: always() && github.event_name == 'pull_request' if: always() && github.event_name == 'pull_request'
steps: steps:
- name: Check status and update PR - name: Проверка статуса и обновление PR
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
@@ -97,11 +150,11 @@ jobs:
if [[ "${{ needs.test-backend.result }}" == "success" ]] && \ if [[ "${{ needs.test-backend.result }}" == "success" ]] && \
[[ "${{ needs.test-frontend.result }}" == "success" ]]; then [[ "${{ needs.test-frontend.result }}" == "success" ]]; then
STATE="success" STATE="success"
DESCRIPTION="✅ All checks passed successfully" DESCRIPTION="✅ Все проверки прошли успешно"
EXIT_CODE=0 EXIT_CODE=0
else else
STATE="failure" STATE="failure"
DESCRIPTION="❌ Some checks failed" DESCRIPTION="❌ Некоторые проверки сломались"
EXIT_CODE=1 EXIT_CODE=1
fi fi
@@ -125,54 +178,3 @@ jobs:
# Выходим с соответствующим кодом, чтобы блокировать PR при неудаче # Выходим с соответствующим кодом, чтобы блокировать PR при неудаче
exit $EXIT_CODE exit $EXIT_CODE
# Опционально: добавляем комментарий в PR при неудаче
comment-on-failure:
needs: [test-backend, test-frontend, pr-status]
runs-on: ubuntu-latest
if: failure() && github.event_name == 'pull_request'
steps:
- name: Add failure comment to PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Определяем какие проверки не прошли
BACKEND_STATUS="${{ needs.test-backend.result }}"
FRONTEND_STATUS="${{ needs.test-frontend.result }}"
COMMENT="## ❌ Проверки не пройдены!
### Результаты проверок:
| Проверка | Статус |
|----------|--------|
| **Backend tests** | $( [ "$BACKEND_STATUS" = "success" ] && echo "✅ Успешно" || echo "❌ Ошибка" ) |
| **Frontend build** | $( [ "$FRONTEND_STATUS" = "success" ] && echo "✅ Успешно" || echo "❌ Ошибка" ) |
### Детали:
- **Ветка**: ${{ github.head_ref }}
- **Коммит**: \`${{ github.event.pull_request.head.sha }}\`
- **Запуск**: [Смотреть детали](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
Пожалуйста, исправьте ошибки перед слиянием. 🚨"
# Находим PR номер
PR_NUMBER=$(jq --raw-output .number "$GITHUB_EVENT_PATH")
# Добавляем комментарий
curl -X POST "${{ github.api_url }}/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"body\": $(echo "$COMMENT" | jq -Rs .)}"
echo "Comment added to PR #$PR_NUMBER"
# Опционально: удаляем старые артефакты
cleanup:
needs: [create-archives, pr-status]
runs-on: ubuntu-latest
if: always()
steps:
- name: Clean up old artifacts
run: |
echo "Cleaning up temporary files"
# Здесь можно добавить логику очистки, если нужно

View File

@@ -1,314 +0,0 @@
# name: Release pipeline
# on:
# workflow_dispatch:
# env:
# WEB_IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-web
# WORKER_IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-worker
# PROJECT_DIR: /home/${{ secrets.USER }}/tatikoma
# jobs:
# build-and-push:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Log in to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_PASSWORD }}
# - name: Build and push tatikoma-web image
# uses: docker/build-push-action@v5
# with:
# context: .
# file: ./Dockerfile.web
# push: true
# tags: |
# ${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-web:latest
# cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-web:latest
# cache-to: type=inline
# - name: Build and push tatikoma-worker image
# uses: docker/build-push-action@v5
# with:
# context: .
# file: ./Dockerfile.worker
# push: true
# tags: |
# ${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-worker:latest
# cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-worker:latest
# cache-to: type=inline
# - name: Verify push
# run: |
# echo "Docker images successfully built and pushed to Docker Hub"
# echo "Images:"
# echo "- ${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-web:latest"
# echo "- ${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-worker:latest"
# build-and-push-send-success-message:
# runs-on: ubuntu-latest
# needs: build-and-push
# if: success()
# steps:
# - name: Send success message
# uses: appleboy/telegram-action@master
# with:
# to: ${{ secrets.TELEGRAM_TO }}
# token: ${{ secrets.TELEGRAM_TOKEN }}
# format: markdown
# message: |
# *${{ github.workflow }}*
# ✅ New images pushed to Dockerhub 🐳
# Images:
# - `${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-web:latest`
# - `${{ secrets.DOCKERHUB_USERNAME }}/tatikoma-worker:latest`
# Status: Success
# build-and-push-send-failure-message:
# runs-on: ubuntu-latest
# needs: build-and-push
# if: failure()
# steps:
# - name: Send failure message
# uses: appleboy/telegram-action@master
# with:
# to: ${{ secrets.TELEGRAM_TO }}
# token: ${{ secrets.TELEGRAM_TOKEN }}
# format: markdown
# message: |
# *${{ github.workflow }}*
# ❌ Error creating and pushing docker images
# [View failed workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
# deploy:
# name: Deploy to server
# runs-on: ubuntu-latest
# needs: build-and-push
# if: success()
# outputs:
# container_status: ${{ steps.get_status.outputs.status }}
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Create project directory
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.HOST }}
# username: ${{ secrets.USER }}
# password: ${{ secrets.SSH_PASSWORD }}
# script: |
# set -e
# echo "Creating project directory..."
# mkdir -p tatikoma/liquibase
# mkdir -p tatikoma/liquibase/changelog
# - name: Copy project files
# shell: bash
# run: |
# # Копируем docker-compose.yml
# sshpass -p "${{ secrets.SSH_PASSWORD }}" scp -o StrictHostKeyChecking=no \
# docker-compose.yml \
# ${{ secrets.USER }}@${{ secrets.HOST }}:tatikoma/
# # Копируем liquibase файлы
# sshpass -p "${{ secrets.SSH_PASSWORD }}" scp -o StrictHostKeyChecking=no \
# -r ./liquibase/changelog/ \
# ${{ secrets.USER }}@${{ secrets.HOST }}:tatikoma/liquibase/
# # Копируем nginx конфиги
# sshpass -p "${{ secrets.SSH_PASSWORD }}" scp -o StrictHostKeyChecking=no \
# -r ./nginx/ \
# ${{ secrets.USER }}@${{ secrets.HOST }}:tatikoma/
# - name: Create or update environment file
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.HOST }}
# username: ${{ secrets.USER }}
# password: ${{ secrets.SSH_PASSWORD }}
# script: |
# set -e
# cd tatikoma
# rm -f .env
# touch .env
# echo "${{ secrets.ENV_FILE }}" >> .env
# echo "Environment file created/updated"
# - name: Prepare directories
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.HOST }}
# username: ${{ secrets.USER }}
# password: ${{ secrets.SSH_PASSWORD }}
# script: |
# set -e
# cd tatikoma
# mkdir -p {nginx/ssl,nginx/htpasswd,uptime-kuma-data}
# - name: Setup authentication
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.HOST }}
# username: ${{ secrets.USER }}
# password: ${{ secrets.SSH_PASSWORD }}
# script: |
# set -e
# cd tatikoma
# echo "Setting up authentication..."
# mkdir -p nginx/htpasswd
# if ! command -v htpasswd &> /dev/null; then
# echo "Installing apache2-utils..."
# apt-get update && apt-get install -y apache2-utils
# fi
# # Используем echo для передачи пароля через stdin
# # Это безопаснее, чем передавать как аргумент
# htpasswd -b -c nginx/htpasswd/.htpasswd "${{ secrets.UPTIME_KUMA_USER }}" "${{ secrets.UPTIME_KUMA_PASSWORD }}"
# echo "Authentication setup complete"
# - name: Setup SSL certificates (if not exists)
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.HOST }}
# username: ${{ secrets.USER }}
# password: ${{ secrets.SSH_PASSWORD }}
# script: |
# set -e
# cd tatikoma
# echo "Checking SSL certificates..."
# # Проверяем существование SSL сертификатов
# if [ ! -f "nginx/ssl/live/${{ secrets.HOST }}/privkey.pem" ]; then
# echo "ERROR: SSL certificates not found!"
# echo "Please generate SSL certificates manually first:"
# echo "mkdir -p nginx/ssl/live/${{ secrets.HOST }}/"
# echo "Then place privkey.pem and fullchain.pem in that directory"
# exit 1
# else
# echo "SSL certificates found, continuing..."
# fi
# - name: Log in to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_PASSWORD }}
# - name: Clean up old images and containers
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.HOST }}
# username: ${{ secrets.USER }}
# password: ${{ secrets.SSH_PASSWORD }}
# script: |
# set -e
# echo "Stopping and removing Tatikoma containers..."
# docker stop tatikoma_web tatikoma_liquibase tatikoma_worker tatikoma_nginx tatikoma_uptime_kuma 2>/dev/null || true
# docker rm tatikoma_web tatikoma_liquibase tatikoma_worker tatikoma_nginx tatikoma_uptime_kuma 2>/dev/null || true
# echo "Cleaning up old Docker images..."
# docker images lulufox/tatikoma-web --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}\t{{.CreatedAt}}" || true
# docker images lulufox/tatikoma-worker --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}\t{{.CreatedAt}}" || true
# docker rmi $(docker images lulufox/tatikoma-web -q) 2>/dev/null || true
# docker rmi $(docker images lulufox/tatikoma-worker -q) 2>/dev/null || true
# docker image prune -f
# - name: Pull latest images
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.HOST }}
# username: ${{ secrets.USER }}
# password: ${{ secrets.SSH_PASSWORD }}
# script: |
# set -e
# echo "Pulling latest Docker images..."
# docker pull lulufox/tatikoma-web:latest
# docker pull lulufox/tatikoma-worker:latest
# - name: Run migrations
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.HOST }}
# username: ${{ secrets.USER }}
# password: ${{ secrets.SSH_PASSWORD }}
# script: |
# set -e
# cd tatikoma
# echo "Running migrations..."
# docker compose up -d liquibase
# - name: Start application services
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.HOST }}
# username: ${{ secrets.USER }}
# password: ${{ secrets.SSH_PASSWORD }}
# script: |
# set -e
# cd tatikoma
# echo "Starting all services..."
# docker compose up -d
# echo "Waiting for services to start..."
# sleep 30
# echo "Current Tatikoma containers status:"
# docker ps --filter "name=tatikoma" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
# echo "Nginx configuration test:"
# docker exec tatikoma_nginx nginx -t || true
# - name: Get container status
# id: get_status
# run: |
# sleep 15
# status=$(sshpass -p "${{ secrets.SSH_PASSWORD }}" ssh -o StrictHostKeyChecking=no \
# ${{ secrets.USER }}@${{ secrets.HOST }} \
# "docker ps -a --filter "name=tatikoma" --format 'table {{.Names}}\t{{.Status}}'")
# echo "status<<EOF" >> $GITHUB_OUTPUT
# echo "$status" >> $GITHUB_OUTPUT
# echo "EOF" >> $GITHUB_OUTPUT
# send_message:
# runs-on: ubuntu-latest
# needs: deploy
# if: always()
# steps:
# - name: send message
# uses: appleboy/telegram-action@master
# with:
# to: ${{ secrets.TELEGRAM_TO }}
# token: ${{ secrets.TELEGRAM_TOKEN }}
# format: markdown
# message: |
# *${{ github.workflow }}*
# Репозиторий: \`${{ github.repository }}\`
# Статус контейнеров:
# ```
# ${{ needs.deploy.outputs.container_status || 'Не удалось получить статус' }}
# ```
# Uptime Kuma доступен по: https://${{ secrets.HOST }}

View File

@@ -1,17 +0,0 @@
# name: Test Workflow
# on:
# push:
# jobs:
# test:
# runs-on: ubuntu-latest
# steps:
# - name: Print environment variables
# run: |
# echo "GITHUB_REPOSITORY: $GITHUB_REPOSITORY"
# echo "GITHUB_SHA: $GITHUB_SHA"
# echo "GITHUB_REF: $GITHUB_REF"
# echo "GITHUB_ACTOR: $GITHUB_ACTOR"
# echo "PATH: $PATH"

16
Dockerfile Normal file
View File

@@ -0,0 +1,16 @@
FROM python:3.11-slim
WORKDIR /app
# 1. Копируем только файл с зависимостями (меняется редко)
COPY api/requirements.txt requirements.txt
# 2. Устанавливаем зависимости (слой кэшируется, пока не изменился requirements.txt)
RUN pip install --no-cache-dir -r requirements.txt
# 3. Копируем весь остальной код (меняется часто)
COPY api/ api/
EXPOSE 8000
CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000"]