Skip to content

chore(infra): restart container when action runs (#46) #35

chore(infra): restart container when action runs (#46)

chore(infra): restart container when action runs (#46) #35

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 }}
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 all containers
if: steps.check-start-up-container.outputs.stdout == ''
run: >
docker compose --profile start-up --profile log
--profile trace --profile metric up -d
- name: Restart containers for Log (Loki, Minio)
run: |
docker compose --profile log restart
- name: Restart containers Of Trace (Tempo, Minio)
run: |
docker compose --profile trace restart
- name: Restart containers for Metric (Prometheus)
run: |
docker compose --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