From 5708a583d749f5ecb678b50d30b5046c98ba3201 Mon Sep 17 00:00:00 2001 From: Simon C Date: Mon, 14 Dec 2020 15:49:22 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20Utilisation=20des=20commandes=20g=C3=A9?= =?UTF-8?q?n=C3=A9riques?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 4 +++ docker-compose.prod.yml | 18 +++++++++++ run | 66 +++------------------------------------ themes/hugo-theme-lowtech | 2 +- 4 files changed, 28 insertions(+), 62 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..656ecdb --- /dev/null +++ b/.env @@ -0,0 +1,4 @@ +DOCKER_CONTEXT=vert +NAME=cremeaux +URL=cremeaux.fr +STATS_CONTAINER=crmx-stats diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index a0d6f22..73cadbd 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,5 +1,11 @@ version: "3.8" +volumes: + cremeaux-log: + name: cremeaux-log + cremeaux-stats: + name: cremeaux-stats + networks: default: external: @@ -15,5 +21,17 @@ services: traefik.http.routers.crmx-prod.rule: "Host(`cremeaux.fr`)" traefik.http.routers.crmx-prod.entrypoints: "web" volumes: + - cremeaux-log:/var/log/nginx + - cremeaux-stats:/usr/share/nginx/html/stats + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + + crmx-stats: + container_name: crmx-stats + image: registry.weko.io/goaccess + restart: always + volumes: + - cremeaux-log:/var/log/nginx + - cremeaux-stats:/usr/share/nginx/html/stats - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro diff --git a/run b/run index b47c93a..86f6a2d 100755 --- a/run +++ b/run @@ -4,8 +4,8 @@ # -u Treat unset variables as an error when substituting. set -eu -DOCKER_CONTEXT=vert -START=`date +%s` +. ./.env +. ./themes/hugo-theme-lowtech/scripts/run help() { echo @@ -13,13 +13,8 @@ help() { echo "----------" echo echo "Commandes :" - echo "- ./run install 📦 Installation des dépendances" - echo "- ./run dev 🚧 Lancement du serveur pour le développement" - echo "- ./run dev production 🚧 Lancement du serveur pour le développement sans les brouillons" - echo "- ./run prod 🚀 Déploiement du site en mode production" - echo "- ./run staging 🚀 Déploiement du site en mode staging" echo "- ./run favicon 🎨 Création du favicon" - echo + help_generic } favicon() { @@ -27,61 +22,10 @@ favicon() { convert -density 300 -define icon:auto-resize=48,32,16 -background none static/icons/blason-512x512.png static/favicon.ico } -prod() { - echo - echo "🚀 Déploiement du site en mode production 🚀" - echo - rm -rf public - hugo --minify --environment production - node themes/hugo-theme-lowtech/scripts/typo - #DATE=`date +\"%Y0101\"` && find public -exec touch -d $DATE {} + - docker-compose --context $DOCKER_CONTEXT -f docker-compose.prod.yml up -d --build --force-recreate -} - -staging() { - echo - echo "🚀 Déploiement du site en mode staging 🚀" - echo - rm -rf public - hugo --minify --environment staging - node themes/hugo-theme-lowtech/scripts/typo - #DATE=`date +\"%Y0101\"` && find public -exec touch -d $DATE {} + - docker-compose --context $DOCKER_CONTEXT -f docker-compose.staging.yml up -d --build --force-recreate -} - -install() { - echo "📦 Installation des dépendances 📦" - echo "----------------------------------" - echo - echo "- Récupération du theme" - git submodule update --init - echo "- Installation des dépendances node du theme" - cd themes/hugo-theme-lowtech && npm i -} - if [ $# -ge 1 ]; then - if [ $1 == "dev" ]; then - if [ $# -ge 2 ] && [ $2 == "production" ]; then - echo "🚧 Lancement du serveur pour le développement sans les brouillons" - hugo server - else - echo "🚧 Lancement du serveur pour le développement" - hugo server -D - fi - elif [ $1 == "prod" ]; then - prod - elif [ $1 == "staging" ]; then - staging - elif [ $1 == "install" ]; then - install - elif [ $1 == "favicon" ]; then - favicon - fi + $@ else help fi -END=`date +%s` -echo -echo "✨ Done in $((END-START))s" -echo +end diff --git a/themes/hugo-theme-lowtech b/themes/hugo-theme-lowtech index fb07c3d..c49f8d0 160000 --- a/themes/hugo-theme-lowtech +++ b/themes/hugo-theme-lowtech @@ -1 +1 @@ -Subproject commit fb07c3d0c5149512247340e5a7023b9ddc5c11a6 +Subproject commit c49f8d025070cd59f60dc974d2290099e5615988