feat/fix: apply NAT IP only AWS to LOKI request by Caddy (#13) #11
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 }} | |
EOF | |
- name: Check if Caddy containers are running | |
id: check-caddy-container | |
run: | | |
{ | |
echo 'stdout<<EOF' | |
docker compose --profile caddy ps -q | |
echo EOF | |
} >> "$GITHUB_OUTPUT" | |
- name: when caddy container down, caddy up | |
if: steps.check-caddy-container.outputs.stdout == '' | |
run: | | |
docker compose --profile caddy up -d --no-recreate | |
- name: Copy Caddyfile into Caddy Container | |
env: | |
AWS_REQ_IP: ${{ secrets.AWS_NAT_IP }} | |
run: | | |
docker cp ./Caddyfile caddy:/etc/caddy/Caddyfile | |
- name: Gracefully reload Caddy | |
run: | | |
docker exec -w /etc/caddy caddy caddy reload | |
- name: Run Docker Compose Of Log | |
run: | | |
docker compose --profile log up -d | |