Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyfok committed Dec 22, 2023
0 parents commit ae3321d
Show file tree
Hide file tree
Showing 9 changed files with 157 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/deploy-preview-site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Deploy preview site

on:
# Runs on pushes targeting the default branch
push:
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

# Default to bash
defaults:
run:
shell: bash

jobs:
# Build job
build:
env:
DOCKER_BUILDKIT: 1
TZ: America/Vancouver
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run "docker compose up" to start NGINX and PHP
run: docker compose up
- name: Mirror website to get static pages
run: wget -m -nH -P public http://localhost:8080/{,index-{en,fr}.php}
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./public

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/logs/
/public/
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "data"]
path = data
url = https://github.com/Volcano-Risk-Reduction-in-Canada/chis-website.git
branch = staging
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Government of Canada

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Acknowledgement of Docker PHP nginx setup

https://blog.devsense.com/2019/php-nginx-docker

with caveat: extra space needed to be removed from PHP section of docker-compose.yml:

```yaml
volumes:
- ./data/:/var/www/html/
- ./logs/php.log:/var/log/fpm-php.www.log
```
```yaml
volumes:
- ./data/:/var/www/html/
- ./logs/php.log:/var/log/fpm-php.www.log
```
## Troubleshooting (TODO)
Podman gives this error:
failed to write to /proc/self/oom_score_adj: Permission denied
See:
- https://github.com/containers/podman/issues/3024
1 change: 1 addition & 0 deletions data
Submodule data added at 39ee84
24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
services:
nginx:
build:
context: .
dockerfile: nginx/Dockerfile
ports:
- "8080:80"
networks:
- internal
volumes:
- ./data/:/var/www/html/
- ./logs/nginx:/var/log/nginx/

php:
image: php:8.1-fpm-alpine
networks:
- internal
volumes:
- ./data/:/var/www/html/
- ./logs/php.log:/var/log/fpm-php.www.log

networks:
internal:
driver: bridge
2 changes: 2 additions & 0 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM nginx:alpine
ADD nginx/default.conf /etc/nginx/conf.d
13 changes: 13 additions & 0 deletions nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
server {
listen 0.0.0.0:80;
root /var/www/html;
location / {
index index.php index.html;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
}

0 comments on commit ae3321d

Please sign in to comment.