Skip to content

Commit

Permalink
Setup nginx config
Browse files Browse the repository at this point in the history
  • Loading branch information
Sander Johansen committed Mar 4, 2025
1 parent 2bfd716 commit d3a9d0e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
36 changes: 24 additions & 12 deletions .github/workflows/update_primary_nginx.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: UNFINISHED - setup nginx from the configuration file
name: Deploy Nginx Configuration

on:
workflow_dispatch:
Expand All @@ -8,24 +8,36 @@ jobs:
runs-on: self-hosted

steps:
- name: Checkout repository
- name: Checkout Repository
uses: actions/checkout@v3
- name: Dotenv Action

- name: Load Environment Variables
uses: falti/dotenv-action@v1.1.4
with:
export-variables: true
keys-case: bypass

- name: Check environment variables
- name: Check Environment Variables
run: env

#Doesn't work properly, envsubst replaces all instances of $variable and ${variable}, but we want to keep e.g., $host as nginx variables
#- name: Create temporary nginx config file
# run: envsubst < ./nginx_template.txt > temp_default.conf
# Maybe look at https://www.baeldung.com/linux/envsubst-command to get an idea

- name: Copy temporary file to correct place
run: cp temp_default.conf /etc/nginx/conf.d/default.conf
- name: Generate Nginx Config with Environment Variables
run: envsubst '${PROD_PORT_PREFIX} ${DEV_PORT_PREFIX} ${STAG_PORT_PREFIX} ${GATEWAY_POSTFIX}' < nginx_template.txt > nginx_securefit.conf

- name: Show Generated Nginx Config (Before Deploy)
run: cat nginx_securefit.conf

- name: Validate Nginx Configuration (Before Deploy)
run: sudo nginx -t

- name: Show nginx file
- name: Copy Nginx Config to Server
run: |
sudo cp nginx_securefit.conf /etc/nginx/conf.d/nginx_securefit.conf
- name: Show Deployed Nginx Config
run: cat /etc/nginx/conf.d/default.conf

- name: Restart Nginx
run: sudo systemctl reload nginx

- name: Verify Nginx Status
run: sudo systemctl status nginx
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SecFit


SecFit (Secure Fitness) is a hybrid mobile application for fitness logging.

## Port mapping shenanigans
Expand Down

0 comments on commit d3a9d0e

Please sign in to comment.