From 78a535d3a06ef5a10a4ca88322f374ddd85fd2ab Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Mon, 6 Jan 2025 13:10:45 -0700 Subject: [PATCH 1/4] Refactoring and updating code for deployment to a caprover server --- Dockerfile | 3 +++ captain-definition | 4 ++++ jnf.me.conf | 3 --- jnf.me.sconf | 25 ------------------------- local-test.sh | 4 ++++ nginx.conf | 14 ++++++++++++++ 6 files changed, 25 insertions(+), 28 deletions(-) create mode 100644 Dockerfile create mode 100644 captain-definition delete mode 100644 jnf.me.conf delete mode 100644 jnf.me.sconf create mode 100644 local-test.sh create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..99f2415 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM docker.io/nginx:1-alpine +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY ./www /www \ No newline at end of file diff --git a/captain-definition b/captain-definition new file mode 100644 index 0000000..04859b5 --- /dev/null +++ b/captain-definition @@ -0,0 +1,4 @@ +{ + "schemaVersion": 2, + "dockerfilePath": "./Dockerfile" +} \ No newline at end of file diff --git a/jnf.me.conf b/jnf.me.conf deleted file mode 100644 index bece0f7..0000000 --- a/jnf.me.conf +++ /dev/null @@ -1,3 +0,0 @@ -location / { - return 301 https://www.jnf.me$request_uri; -} \ No newline at end of file diff --git a/jnf.me.sconf b/jnf.me.sconf deleted file mode 100644 index 708728e..0000000 --- a/jnf.me.sconf +++ /dev/null @@ -1,25 +0,0 @@ -if ($host != www.jnf.me) { - return 301 https://www.jnf.me$request_uri; -} - -location / { - index index.php index.html index.htm; - try_files $uri /index.html; -} - -location /lucy { - index index.php index.html index.htm; - try_files $uri /lucy.html; -} - -location ~ \.php$ { - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - if (!-f $document_root$fastcgi_script_name) { - return 404; - } - - fastcgi_pass unix:/run/php/php7.4-fpm-ptools.jaywll.co.sock; - fastcgi_index index.php; - include /etc/nginx/fastcgi_params; - include /home/jason/conf/web/ptools.jaywll.co/nginx.fastcgi_cache.conf*; -} \ No newline at end of file diff --git a/local-test.sh b/local-test.sh new file mode 100644 index 0000000..2556f96 --- /dev/null +++ b/local-test.sh @@ -0,0 +1,4 @@ +# Script used to spin up a local webserver for development & testing + +#!/bin/bash +podman run -it --rm -p 3000:80 $(podman build -q .) \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..fc39fec --- /dev/null +++ b/nginx.conf @@ -0,0 +1,14 @@ +server { + listen 80; + root /www; + + location / { + index index.html; + try_files $uri /index.html; + } + + location /lucy { + index index.html; + try_files $uri /lucy.html; + } +} \ No newline at end of file -- 2.49.1 From 32af535a4cab6a7af1246e6a2cd593ddb3451e98 Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Sat, 16 Aug 2025 14:33:25 -0600 Subject: [PATCH 2/4] Removing caprover definitions and deployment code --- Dockerfile | 3 --- captain-definition | 4 ---- local-test.sh | 4 ---- nginx.conf | 14 -------------- 4 files changed, 25 deletions(-) delete mode 100644 Dockerfile delete mode 100644 captain-definition delete mode 100644 local-test.sh delete mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 99f2415..0000000 --- a/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM docker.io/nginx:1-alpine -COPY nginx.conf /etc/nginx/conf.d/default.conf -COPY ./www /www \ No newline at end of file diff --git a/captain-definition b/captain-definition deleted file mode 100644 index 04859b5..0000000 --- a/captain-definition +++ /dev/null @@ -1,4 +0,0 @@ -{ - "schemaVersion": 2, - "dockerfilePath": "./Dockerfile" -} \ No newline at end of file diff --git a/local-test.sh b/local-test.sh deleted file mode 100644 index 2556f96..0000000 --- a/local-test.sh +++ /dev/null @@ -1,4 +0,0 @@ -# Script used to spin up a local webserver for development & testing - -#!/bin/bash -podman run -it --rm -p 3000:80 $(podman build -q .) \ No newline at end of file diff --git a/nginx.conf b/nginx.conf deleted file mode 100644 index fc39fec..0000000 --- a/nginx.conf +++ /dev/null @@ -1,14 +0,0 @@ -server { - listen 80; - root /www; - - location / { - index index.html; - try_files $uri /index.html; - } - - location /lucy { - index index.html; - try_files $uri /lucy.html; - } -} \ No newline at end of file -- 2.49.1 From 560fc865b131ba8cbb21451e3613773a9a7dd08d Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Sat, 16 Aug 2025 14:45:17 -0600 Subject: [PATCH 3/4] Adding CI deployment job definitions for staging and production servers --- .gitea/workflows/release.yml | 22 ++++++++++++++++++++++ .gitea/workflows/stage.yml | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .gitea/workflows/release.yml create mode 100644 .gitea/workflows/stage.yml diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..ad7bbf8 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,22 @@ +name: Deploy to production webserver +run-name: ${{ gitea.actor }} is deploying to production environment +on: + push: + branches: [ staging ] + workflow_dispatch: + +jobs: + Deploy-To-Staging: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Deploy via SFTP + uses: appleboy/scp-action@master + with: + host: ${{ secrets.PRODUCTION_SFTP_HOST }} + username: ${{ secrets.PRODUCTION_SFTP_USERNAME }} + key: ${{ secrets.PRODUCTION_SFTP_PRIVATE_KEY }} + source: "www/" + target: "~/web/jnf.me/public_html/" + strip_components: 1 \ No newline at end of file diff --git a/.gitea/workflows/stage.yml b/.gitea/workflows/stage.yml new file mode 100644 index 0000000..d06c827 --- /dev/null +++ b/.gitea/workflows/stage.yml @@ -0,0 +1,22 @@ +name: Deploy to staging webserver +run-name: ${{ gitea.actor }} is deploying to staging environment +on: + push: + branches: [ staging ] + workflow_dispatch: + +jobs: + Deploy-To-Staging: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Deploy via SFTP + uses: appleboy/scp-action@master + with: + host: ${{ secrets.STAGING_SFTP_HOST }} + username: ${{ secrets.STAGING_SFTP_USERNAME }} + key: ${{ secrets.STAGING_SFTP_PRIVATE_KEY }} + source: "www/" + target: "~/web/jnf.dev.jnf.me/public_html/" + strip_components: 1 \ No newline at end of file -- 2.49.1 From 0ac9716ac3322c4e6248ad851fb555a99a9803c8 Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Sat, 16 Aug 2025 14:46:47 -0600 Subject: [PATCH 4/4] Updating CD job definition for deploying to production --- .gitea/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index ad7bbf8..7869181 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -2,11 +2,11 @@ name: Deploy to production webserver run-name: ${{ gitea.actor }} is deploying to production environment on: push: - branches: [ staging ] + branches: [ release ] workflow_dispatch: jobs: - Deploy-To-Staging: + Deploy-To-Production: runs-on: ubuntu-latest steps: - name: Check out repository code -- 2.49.1