diff --git a/.dockerignore b/.dockerignore index 9c703f9..f205c0b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,4 @@ +# Ignore everything ** !public diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..0bf5d83 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false \ No newline at end of file diff --git a/.env b/.env index 30cf197..aaa6992 100644 --- a/.env +++ b/.env @@ -1,16 +1,4 @@ -# DOCKER - -DOCKER_HOST=ssh://kosssi@vert:42422 -TRAEFIK_NETWORK_NAME=traefik - - -## PROD - -PROD_URL=lestoitsduval.fr -PROD_CONTAINER_NAME=ltdv-prod - - -## STAGING - -STAGING_URL=staging.lestoitsduval.fr -STAGING_CONTAINER_NAME=ltdv-staging +DOCKER_CONTEXT=vert +NAME=ltdv +URL=lestoitsduval.fr +STATS_CONTAINER=ltdv-stats diff --git a/.gitignore b/.gitignore index 48b1cca..b45f0b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ public resources -node_modules +backups diff --git a/.htaccess b/.htaccess deleted file mode 100644 index 62663dd..0000000 --- a/.htaccess +++ /dev/null @@ -1,10 +0,0 @@ -Errordocument 404 /404.html -RewriteEngine On - -## http -> https -RewriteCond %{HTTPS} off -RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] - -## www -> no-www -RewriteCond %{HTTP_HOST} ^www\.(.*)$ -RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L] diff --git a/README.md b/README.md index 1d30de3..ae30a49 100644 --- a/README.md +++ b/README.md @@ -2,20 +2,3 @@ Voici le nouveau site internet des Toits du Val. Il est fait pour utiliser très peu de ressource énergétique. Ce site est auto hébergé sur du matériel ouvert. - -## Suivi de l'installation - -Création du site : - -```sh -hugo new site lestoitsduval -cd lestoitsduval -git init -``` - -Ajout du thème : - -```sh -cd themes -git submodule add https://git.weko.io/kosssi/hugo-theme-lowtech.git -``` diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index af8a097..2b4e5b2 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,36 +1,39 @@ version: "3.8" volumes: - ltdv-prod-stats: - name: ltdv-prod-stats - ltdv-prod-logs: - name: ltdv-prod-logs + ltdv-log: + name: ltdv-log + ltdv-stats: + name: ltdv-stats services: ltdv-prod: - container_name: ${PROD_CONTAINER_NAME} + container_name: ltdv-prod build: . restart: always labels: traefik.enable: "true" - traefik.http.routers.ltdv-prod.rule: "Host(`${PROD_URL}`)" + traefik.http.routers.ltdv-prod.rule: "Host(`${URL}`)" traefik.http.routers.ltdv-prod.entrypoints: "web" volumes: - - ltdv-prod-logs:/var/log/nginx - - ltdv-prod-stats:/usr/share/nginx/html/stats + - ltdv-log:/var/log/nginx + - ltdv-stats:/usr/share/nginx/html/stats - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro - ltdv-prod-logs: - container_name: ltdv-prod-logs + ltdv-stats: + container_name: ltdv-stats image: registry.weko.io/goaccess:1.4.6 restart: always depends_on: - ltdv-prod volumes: - - ltdv-prod-logs:/var/log/nginx - - ltdv-prod-stats:/usr/share/nginx/html/stats + - ltdv-log:/var/log/nginx + - ltdv-stats:/usr/share/nginx/html/stats - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro - labels: - com.centurylinklabs.watchtower.enable: true + +networks: + default: + external: + name: traefik diff --git a/docker-compose.staging.yml b/docker-compose.staging.yml index 958f50f..00a84bd 100644 --- a/docker-compose.staging.yml +++ b/docker-compose.staging.yml @@ -1,13 +1,18 @@ version: "3.8" +networks: + default: + external: + name: traefik + services: ltdv-staging: - container_name: ${STAGING_CONTAINER_NAME} + container_name: ltdv-staging build: . restart: always labels: traefik.enable: "true" - traefik.http.routers.ltdv-staging.rule: "Host(`${STAGING_URL}`)" + traefik.http.routers.ltdv-staging.rule: "Host(`staging.${URL}`)" traefik.http.routers.ltdv-staging.entrypoints: "web" volumes: - /etc/timezone:/etc/timezone:ro diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 92d6eb1..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: "3.8" - -networks: - default: - external: - name: ${TRAEFIK_NETWORK_NAME} diff --git a/package.json b/package.json deleted file mode 100644 index 5d222de..0000000 --- a/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "lestoitsduval", - "version": "0.1.0", - "description": "Source code of lestoitsduval.fr", - "scripts": { - "start": "hugo server", - "serve": "(cd public && python3 -m http.server 8080)", - "staging": "rm -rf public && hugo -D --minify --environment staging && node themes/hugo-theme-lowtech/scripts/typo && docker-compose -f docker-compose.yml -f docker-compose.staging.yml up -d --build --force-recreate", - "prod": "rm -rf public && hugo --minify --environment production && node themes/hugo-theme-lowtech/scripts/typo && docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d --build --force-recreate", - "favicon": "convert content/lestoitsduval-icon.png -resize 32x32 -colors 16 \\( -clone 0 -resize 16x16 -extent 16x16 \\) \\( -clone 0 -resize 32x32 -extent 32x32 \\) -delete 0 static/favicon.ico", - "svgo": "svgo */**.svg", - "ftp-deploy": "lftp -u $LESTOITSDUVAL_FTP_USER,$LESTOITSDUVAL_FTP_PASSWORD $LESTOITSDUVAL_FTP_HOST -e 'mirror -e -R ./public /www ; quit'", - "ftp-htaccess": "lftp -u $LESTOITSDUVAL_FTP_USER,$LESTOITSDUVAL_FTP_PASSWORD $LESTOITSDUVAL_FTP_HOST -e 'put ./.htaccess ; quit'", - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "Simon ", - "license": "GPL-3.0" -} diff --git a/run b/run new file mode 100755 index 0000000..45e360b --- /dev/null +++ b/run @@ -0,0 +1,16 @@ +#!/bin/bash + +# -e Exit immediately if a command exits with a non-zero status. +# -u Treat unset variables as an error when substituting. +set -eu + +. ./.env +. ./themes/hugo-theme-lowtech/scripts/run + +if [ $# -ge 1 ]; then + $@ +else + help_generic +fi + +end diff --git a/themes/hugo-theme-lowtech b/themes/hugo-theme-lowtech index d740c03..fabb09e 160000 --- a/themes/hugo-theme-lowtech +++ b/themes/hugo-theme-lowtech @@ -1 +1 @@ -Subproject commit d740c03ae509bc625f0c12313d6c9dd9fe1b8e9d +Subproject commit fabb09ed12fd7fa2c3dba834cafe0c42b30d9b96