Skip to content

Commit 0140c9b

Browse files
committed
test
0 parents  commit 0140c9b

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

.github/workflows/nginx-sync.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Sync NGINX Configs to Azure
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- configs/**
9+
10+
permissions:
11+
id-token: write
12+
contents: read
13+
14+
jobs:
15+
deploy:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository content
19+
uses: actions/checkout@v4
20+
21+
- name: Azure Login (with service principal credentials)
22+
run: |
23+
az login --service-principal \
24+
--username "${{ secrets.AZURE_CLIENT_ID }}" \
25+
--password "${{ secrets.AZURE_CLIENT_SECRET }}" \
26+
--tenant "${{ secrets.AZURE_TENANT_ID }}"
27+
28+
- name: Sync NGINX Config to Azure
29+
uses: nginxinc/[email protected]
30+
with:
31+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
32+
resource-group-name: ${{ secrets.AZURE_RESOURCE_GROUP_NAME }}
33+
nginx-deployment-name: ${{ secrets.NGINX_DEPLOYMENT_NAME }}
34+
nginx-config-directory-path: configs/
35+
nginx-root-config-file: nginx.conf
36+
transformed-nginx-config-directory-path: /etc/nginx/

configs/conf.d/proxy.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
proxy_set_header Host $host;
2+
proxy_set_header X-Real-IP $remote_addr;
3+
proxy_set_header X-Proxy-App app;
4+
proxy_set_header X-Git-App app;
5+
proxy_set_header Github-Run-Id 000000;
6+
proxy_buffering on;
7+
proxy_buffer_size 4k;
8+
proxy_buffers 8 8k;
9+
proxy_read_timeout 60s;

configs/nginx.conf

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
http {
2+
upstream app {
3+
zone app 64k;
4+
least_conn;
5+
server 10.0.1.4:8000;
6+
}
7+
8+
server {
9+
listen 80;
10+
server_name *.example.com;
11+
12+
location / {
13+
include /etc/nginx/conf.d/proxy.conf;
14+
proxy_pass http://app;
15+
health_check;
16+
}
17+
}
18+
19+
server {
20+
listen 443 ssl default_server;
21+
# listen 443;
22+
server_name example.com;
23+
24+
ssl_certificate /etc/nginx/ssl/000000/my-cert.crt;
25+
ssl_certificate_key /etc/nginx/ssl/000000/my-cert.key;
26+
27+
location / {
28+
include /etc/nginx/conf.d/proxy.conf;
29+
proxy_pass http://app;
30+
health_check;
31+
}
32+
}
33+
}
34+
35+
# Github sync

0 commit comments

Comments
 (0)