Skip to content

Commit 66e0f1a

Browse files
committed
Update readme to include certificates and latest tag
1 parent f5088f5 commit 66e0f1a

File tree

1 file changed

+73
-5
lines changed

1 file changed

+73
-5
lines changed

README.md

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# NGINX for Azure Deployment Action
22

3-
This action supports managing the configuration of an [NGINX for Azure](https://docs.nginx.com/nginx-for-azure/quickstart/overview/) deployment in a GitHub repository. It enables continuous deployment through GitHub workflows to automatically update the NGINX for Azure deployment when changes are made to the NGINX configuration files stored in the respository.
3+
This action supports managing the configuration of an [NGINX for Azure](https://docs.nginx.com/nginx-for-azure/quickstart/overview/) deployment in a GitHub repository. It enables continuous deployment through GitHub workflows to automatically update the NGINX for Azure deployment when changes are made to the NGINX configuration files stored in the respository. Additionally, one can update NGINX certificates that are already present in Azure key vault.
44

55
## Connecting to Azure
66

@@ -34,7 +34,7 @@ jobs:
3434
creds: ${{ secrets.AZURE_CREDENTIALS }}
3535

3636
- name: 'Sync the NGINX configuration from the GitHub repository to the NGINX for Azure deployment'
37-
uses: nginxinc/nginx-for-azure-deploy-action@v0.1.0
37+
uses: nginxinc/nginx-for-azure-deploy-action@v0.3.0
3838
with:
3939
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
4040
resource-group-name: ${{ secrets.AZURE_RESOURCE_GROUP_NAME }}
@@ -76,7 +76,7 @@ jobs:
7676
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
7777

7878
- name: 'Sync the NGINX configuration from the GitHub repository to the NGINX for Azure deployment'
79-
uses: nginxinc/nginx-for-azure-deploy-action@v0.1.0
79+
uses: nginxinc/nginx-for-azure-deploy-action@v0.3.0
8080
with:
8181
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
8282
resource-group-name: ${{ secrets.AZURE_RESOURCE_GROUP_NAME }}
@@ -85,6 +85,49 @@ jobs:
8585
nginx-root-config-file: nginx.conf
8686
transformed-nginx-config-directory-path: /etc/nginx/
8787
```
88+
89+
### Sample workflow that updates config files and certificates
90+
91+
```yaml
92+
# File: .github/workflows/nginxForAzureDeploy.yml
93+
name: Sync NGINX configuration and certificate to NGINX for Azure - multi file
94+
on:
95+
push:
96+
branches:
97+
- main
98+
paths:
99+
- config/**
100+
101+
permissions:
102+
id-token: write
103+
contents: read
104+
105+
jobs:
106+
Deploy-NGINX-Configuration:
107+
runs-on: ubuntu-latest
108+
steps:
109+
- name: 'Checkout repository'
110+
uses: actions/checkout@v2
111+
112+
- name: 'Run Azure Login using OIDC'
113+
uses: azure/login@v1
114+
with:
115+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
116+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
117+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
118+
119+
- name: "Sync NGINX configuration and certificate to NGINX for Azure - multi file"
120+
uses: nginxinc/[email protected]
121+
with:
122+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
123+
resource-group-name: ${{ secrets.AZURE_RESOURCE_GROUP_NAME }}
124+
nginx-deployment-name: ${{ secrets.NGINX_DEPLOYMENT_NAME }}
125+
nginx-deployment-location: ${{ secrets.NGINX_DEPLOYMENT_LOCATION }}
126+
nginx-config-directory-path: config/
127+
nginx-root-config-file: nginx.conf
128+
transformed-nginx-config-directory-path: /etc/nginx/
129+
nginx-certificates: '[{"certificateName": "$NGINX_CERT_NAME", "keyvaultSecret": "https://$NGINX_VAULT_NAME.vault.azure.net/secrets/$NGINX_CERT_NAME", "certificateVirtualPath": "/etc/nginx/ssl/my-cert.crt", "keyVirtualPath": "/etc/nginx/ssl/my-cert.key" } ]'
130+
```
88131
## Handling NGINX configuration file paths
89132
90133
To facilitate the migration of the existing NGINX configuration, NGINX for Azure supports multiple-files configuration with each file uniquely identified by a file path, just like how NGINX configuration files are created and used in a self-hosting machine. An NGINX configuration file can include another file using the [include directive](https://docs.nginx.com/nginx/admin-guide/basic-functionality/managing-configuration-files/). The file path used in an `include` directive can either be an absolute path or a relative path to the [prefix path](https://www.nginx.com/resources/wiki/start/topics/tutorials/installoptions/).
@@ -100,7 +143,7 @@ To use this action to sync the configuration files from this example, the direct
100143

101144
```yaml
102145
- name: 'Sync the NGINX configuration from the GitHub repository to the NGINX for Azure deployment'
103-
uses: nginxinc/nginx-for-azure-deploy-action@v0.1.0
146+
uses: nginxinc/nginx-for-azure-deploy-action@v0.3.0
104147
with:
105148
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
106149
resource-group-name: ${{ secrets.AZURE_RESOURCE_GROUP_NAME }}
@@ -132,7 +175,7 @@ The action supports an optional input `transformed-nginx-config-directory-path`
132175

133176
```yaml
134177
- name: 'Sync the NGINX configuration from the Git repository to the NGINX for Azure deployment'
135-
uses: nginxinc/nginx-for-azure-deploy-action@v0.1.0
178+
uses: nginxinc/nginx-for-azure-deploy-action@v0.3.0
136179
with:
137180
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
138181
resource-group-name: ${{ secrets.AZURE_RESOURCE_GROUP_NAME }}
@@ -147,3 +190,28 @@ The transformed paths of the two configuration files in the NGINX for Azure depl
147190
|--------------------------------------|-----------------------------------|---------------------------------------------|
148191
| /etc/nginx/nginx.conf | /config/nginx.conf | /etc/nginx/nginx.conf |
149192
| /etc/nginx/sites-enabled/mysite.conf | /config/sites-enabled/mysite.conf | /etc/nginx/sites-enabled/mysite.conf |
193+
194+
## Handling NGINX certificates
195+
196+
Since certificates are secrets, it is assumed they are stored in Azure key vault. One can provide multiple certificate entries to the github action as an array of JSON objects with keys:
197+
198+
`certificateName`- A unique name for the certificate entry
199+
200+
`keyvaultSecret`- The secret ID for the certificate on Azure key vault
201+
202+
`certificateVirtualPath`- This path must match one or more ssl_certificate directive file arguments in your Nginx configuration; and must be unique between certificates within the same deployment
203+
204+
`keyVirtualPath`- This path must match one or more ssl_certificate_key directive file arguments in your Nginx configuration; and must be unique between certificates within the same deployment
205+
206+
See the example below
207+
208+
```yaml
209+
- name: "Sync NGINX certificates to NGINX for Azure"
210+
uses: nginxinc/[email protected]
211+
with:
212+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
213+
resource-group-name: ${{ secrets.AZURE_RESOURCE_GROUP_NAME }}
214+
nginx-deployment-name: ${{ secrets.NGINX_DEPLOYMENT_NAME }}
215+
nginx-deployment-location: ${{ secrets.NGINX_DEPLOYMENT_LOCATION }}
216+
nginx-certificates: '[{"certificateName": "$NGINX_CERT_NAME", "keyvaultSecret": "https://$NGINX_VAULT_NAME.vault.azure.net/secrets/$NGINX_CERT_NAME", "certificateVirtualPath": "/etc/nginx/ssl/my-cert.crt", "keyVirtualPath": "/etc/nginx/ssl/my-cert.key" } ]'
217+
```

0 commit comments

Comments
 (0)