feat(infra): set prometheus alertmanager and add container for checki… #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | |
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 |