Skip to content

Commit

Permalink
Second commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritzs committed Mar 3, 2025
1 parent 3ba5cc7 commit f7df476
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions .github/workflows/update_primary_nginx.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
name: UNFINISHED - setup nginx from the configuration file
name: Deploy nginx configuration to TDT4242 server

on:
push:
branches:
- main
workflow_dispatch:

jobs:
deploy:
deploy-nginx:
runs-on: self-hosted

steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -16,16 +19,14 @@ jobs:
export-variables: true
keys-case: bypass

- 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: Deploy nginx configuration file
run: |
sudo cp ./nginx/nginx.conf /etc/nginx/conf.d/default.conf
sudo systemctl reload nginx
- name: Show nginx file
run: cat /etc/nginx/conf.d/default.conf
run: |
cat /etc/nginx/conf.d/default.conf
sudo nginx -t
sudo systemctl status nginx
echo "Nginx is running correctly"

0 comments on commit f7df476

Please sign in to comment.