Skip to content

fix(infra): start and restart all containers except for start-up cont… #39

fix(infra): start and restart all containers except for start-up cont…

fix(infra): start and restart all containers except for start-up cont… #39

Workflow file for this run

name: Local Deployment
on:
push:
branches: main
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Load dotenv from secret for Grafana Configuration
run: |
cat <<EOF > .env
# Sensitive configurations from GitHub Secrets
GF_SMTP_HOST = ${{ secrets.SMTP_HOST }}
GF_SMTP_USER = ${{ secrets.SMTP_USER }}
GF_SMTP_PASSWORD = ${{ secrets.SMTP_PASSWORD }}
GF_SMTP_FROM_ADDRESS = ${{ secrets.FROM_ADDRESS }}
MINIO_ROOT_USER = ${{ secrets.MINIO_ROOT_USER }}
MINIO_ROOT_PASSWORD = ${{ secrets.MINIO_ROOT_PASSWORD }}
MS_WEBHOOK_URL = ${{ secrets.MS_WEBHOOK_URL }}
GH_CLIENT_ID = ${{ secrets.GH_CLIENT_ID }}
GH_CLIENT_SECRET = ${{ secrets.GH_CLIENT_SECRET }}
EOF
- name: Check if initial containers are running
id: check-start-up-container
run: |
{
echo 'stdout<<EOF'
docker compose --profile start-up ps -q
echo EOF
} >> "$GITHUB_OUTPUT"
- name: when initial containers are not running, start start-up containers
if: steps.check-start-up-container.outputs.stdout == ''
run: >
docker compose --profile start-up up -d
- name: Start all containers except for start-up
run: |
docker compose --profile log --profile trace --profile metric up -d
- name: Restart all containers except for start-up
run: |
docker compose --profile log --profile trace --profile metric restart
- name: Set Caddyfile Environment Variables
run: |
sed -i 's/{$AWS_REQ_IP}/${{secrets.AWS_REQ_IP}}/' ./Caddyfile
- name: Copy Caddyfile into Caddy Container
run: |
docker cp ./Caddyfile caddy:/etc/caddy/Caddyfile
- name: Gracefully reload Caddy
run: |
docker exec -w /etc/caddy caddy caddy reload