From dd9f3b0ff571d3ec24c73336c6140822b74edfd5 Mon Sep 17 00:00:00 2001 From: Simon C Date: Thu, 8 Dec 2022 15:42:09 +0100 Subject: [PATCH] feat: Update deploy --- .dockerignore | 4 -- .drone.yml | 42 +++++++++++++++ .gitignore | 1 + Dockerfile | 4 -- config.toml | 5 +- docker-compose.prod.yml | 19 ------- run | 54 ------------------- themes/casper/layouts/404.html | 2 +- themes/casper/layouts/_default/list.html | 2 +- themes/casper/layouts/page/cover.html | 2 +- themes/casper/layouts/page/index.html | 2 +- themes/casper/layouts/page/list.html | 4 +- themes/casper/layouts/page/single.html | 2 +- themes/casper/layouts/partials/header.html | 10 ++-- .../casper/layouts/partials/navigation.html | 2 +- 15 files changed, 60 insertions(+), 95 deletions(-) delete mode 100644 .dockerignore create mode 100644 .drone.yml delete mode 100644 Dockerfile delete mode 100644 docker-compose.prod.yml delete mode 100755 run diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index f205c0b..0000000 --- a/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything -** - -!public diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..3a3d2d6 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,42 @@ +--- +# drone encrypt kosssi/zebra.life $AWS_ACCESS_KEY_ID +kind: secret +name: PRODUCTION_AWS_ACCESS_KEY_ID +data: /SD/FNPyIA+RFjRlG6Fv07pvL69oJSrZ8bedU+B3xMhFWq/KkGxW4iFRQlTiPah8Ah8RmZsS + +--- +# drone encrypt kosssi/zebra.life $AWS_SECRET_ACCESS_KEY +kind: secret +name: PRODUCTION_AWS_SECRET_ACCESS_KEY +data: pP6xanltH9bamwETzJ1ZwJ1gJWyd2VpgolZ/KVP+obrwpkX6pjVNdlhXxfGrq3ks5wY+7qBP5Bu8WZpiNRc/gPKkvHCD32W0e8U3icOD1Xk02Zkldd4srO2V8Q0= + +--- +kind: pipeline +type: docker +name: prod + +platform: + os: linux + arch: arm64 + +steps: +- name: build website + image: klakegg/hugo:0.107.0-ext-debian-ci + commands: + - hugo --minify + +- name: deploy + image: klakegg/hugo:0.107.0-ext-debian-ci + environment: + AWS_ACCESS_KEY_ID: + from_secret: PRODUCTION_AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY: + from_secret: PRODUCTION_AWS_SECRET_ACCESS_KEY + commands: + - hugo deploy + +trigger: + event: + - push + branch: + - master diff --git a/.gitignore b/.gitignore index 5286546..c8ff03a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ public resources +.hugo_build.lock diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index be58b6f..0000000 --- a/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM registry.weko.io/nginx-lowtech:0.0.5 - -# Copie des sources du site -COPY public /usr/share/nginx/html diff --git a/config.toml b/config.toml index ebcd7cb..e2c6b43 100644 --- a/config.toml +++ b/config.toml @@ -4,7 +4,7 @@ title = "Zebra" paginate = 10 theme = "casper" canonifyurls = true -Copyright = "@ 2020" +Copyright = "@ 2022" [params] description = "Un mode de vie : le nomadisme" @@ -16,3 +16,6 @@ Copyright = "@ 2020" [markup.goldmark] [markup.goldmark.renderer] unsafe = true + +[[deployment.targets]] + URL = "s3://zebra.life?endpoint=http://10.20.20.10:3900&disableSSL=true&s3ForcePathStyle=true®ion=garage" diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml deleted file mode 100644 index d59d471..0000000 --- a/docker-compose.prod.yml +++ /dev/null @@ -1,19 +0,0 @@ -version: "3.8" - -networks: - default: - external: - name: traefik - -services: - zebra_life: - container_name: zebra_life - build: . - restart: always - labels: - traefik.enable: "true" - traefik.http.routers.zebra_life.rule: "Host(`zebra.life`)" - traefik.http.routers.zebra_life.entrypoints: "web" - volumes: - - /etc/timezone:/etc/timezone:ro - - /etc/localtime:/etc/localtime:ro diff --git a/run b/run deleted file mode 100755 index 61b497c..0000000 --- a/run +++ /dev/null @@ -1,54 +0,0 @@ -#!/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 - -DOCKER_CONTEXT=vert -START=`date +%s` - -help() { - echo - echo "💡 Aide 💡" - echo "----------" - echo - echo "Commandes :" - 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 -} - -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 -} - -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 - else - help - fi -else - help -fi - -END=`date +%s` -echo -echo "✨ Done in $((END-START))s" -echo diff --git a/themes/casper/layouts/404.html b/themes/casper/layouts/404.html index 0fb1b83..66ac520 100644 --- a/themes/casper/layouts/404.html +++ b/themes/casper/layouts/404.html @@ -16,7 +16,7 @@ {{ if .Site.Params.RSSLink}}   Subscribe {{else}} -   Subscribe +   Subscribe {{end}} {{end}} diff --git a/themes/casper/layouts/_default/list.html b/themes/casper/layouts/_default/list.html index 3b92122..a99f670 100644 --- a/themes/casper/layouts/_default/list.html +++ b/themes/casper/layouts/_default/list.html @@ -26,7 +26,7 @@ {{ if .Site.Params.RSSLink}}   Subscribe {{else}} -   Subscribe +   Subscribe {{end}} {{end}} diff --git a/themes/casper/layouts/page/cover.html b/themes/casper/layouts/page/cover.html index 54bf396..8a54978 100644 --- a/themes/casper/layouts/page/cover.html +++ b/themes/casper/layouts/page/cover.html @@ -22,7 +22,7 @@ {{ if .Site.Params.RSSLink}}   Subscribe {{else}} -   Subscribe +   Subscribe {{end}} {{end}} diff --git a/themes/casper/layouts/page/index.html b/themes/casper/layouts/page/index.html index 06504dc..fae12ee 100644 --- a/themes/casper/layouts/page/index.html +++ b/themes/casper/layouts/page/index.html @@ -20,7 +20,7 @@ {{ if .Site.Params.RSSLink}}   Subscribe {{else}} -   Subscribe +   Subscribe {{end}} {{end}} diff --git a/themes/casper/layouts/page/list.html b/themes/casper/layouts/page/list.html index 43d1a39..db7afb2 100644 --- a/themes/casper/layouts/page/list.html +++ b/themes/casper/layouts/page/list.html @@ -25,10 +25,10 @@ {{ if .Site.Params.RSSLink}}   Subscribe {{else}} -   Subscribe +   Subscribe {{end}} {{end}} -   Subscribe +   Subscribe
diff --git a/themes/casper/layouts/page/single.html b/themes/casper/layouts/page/single.html index 071281d..c240d92 100644 --- a/themes/casper/layouts/page/single.html +++ b/themes/casper/layouts/page/single.html @@ -23,7 +23,7 @@ {{ if .Site.Params.RSSLink}}   Subscribe {{else}} -   Subscribe +   Subscribe {{end}} {{end}} diff --git a/themes/casper/layouts/partials/header.html b/themes/casper/layouts/partials/header.html index 17d0d99..82c9447 100644 --- a/themes/casper/layouts/partials/header.html +++ b/themes/casper/layouts/partials/header.html @@ -7,7 +7,7 @@ {{ partial "twitter_card.html" . }} - + @@ -32,7 +32,7 @@ {{ end }} - {{ if ne .URL "/" }}{{ .Title }} · {{ end }}{{ .Site.Title }} + {{ if ne .Permalink "/" }}{{ .Title }} · {{ end }}{{ .Site.Title }} {{ if .IsPage }} @@ -67,14 +67,14 @@ {{ if .Site.Params.RSSLink}} {{else}} - {{ if ne .URL "/" }} + {{ if ne .Permalink "/" }} {{ end }} {{if .IsNode}} - + {{end}} {{end}} - {{.Hugo.Generator}} + {{ hugo.Generator }} diff --git a/themes/casper/layouts/partials/navigation.html b/themes/casper/layouts/partials/navigation.html index 5b137e5..268bb5b 100644 --- a/themes/casper/layouts/partials/navigation.html +++ b/themes/casper/layouts/partials/navigation.html @@ -18,7 +18,7 @@ {{ if .Site.Params.RSSLink}}
{{else}} - + {{end}}