chore: Upgrade process

This commit is contained in:
Simon 2021-04-27 11:10:34 +02:00
parent 76873d138b
commit e50b32a456
12 changed files with 57 additions and 85 deletions

View File

@ -1,3 +1,4 @@
# Ignore everything
**
!public

10
.editorconfig Normal file
View File

@ -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

20
.env
View File

@ -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

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
public
resources
node_modules
backups

View File

@ -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]

View File

@ -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
```

View File

@ -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

View File

@ -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

View File

@ -1,6 +0,0 @@
version: "3.8"
networks:
default:
external:
name: ${TRAEFIK_NETWORK_NAME}

View File

@ -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 <simon@lamelio.fr>",
"license": "GPL-3.0"
}

16
run Executable file
View File

@ -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

@ -1 +1 @@
Subproject commit d740c03ae509bc625f0c12313d6c9dd9fe1b8e9d
Subproject commit fabb09ed12fd7fa2c3dba834cafe0c42b30d9b96