From cb99e8cf4bddbdc11a188a72206f7464efc74b4e Mon Sep 17 00:00:00 2001 From: Simon C Date: Mon, 31 Jan 2022 08:59:01 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20Mise=20=C3=A0=20jour=20automatique=20de?= =?UTF-8?q?=20staging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .drone.yml | 68 +++++++++++++++++++++++++++++++- docker-compose.prod.yml | 2 +- docker-compose.staging.yml | 8 ++-- layouts/partials/monitoring.html | 3 +- 4 files changed, 75 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index b85652e..8c47d3a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -31,7 +31,7 @@ data: 1aojESEVwAY0jmHQfpWt5bGbbnMtFiv6mQMEQjC368oJZeMSFPTZL9/mTQAAqSbEHyEHV1r19H --- kind: pipeline type: docker -name: default +name: prod platform: os: linux @@ -93,3 +93,69 @@ volumes: - name: hugo-theme-lowtech_node_modules host: path: /tmp/drone/cache/weko/lestoitsduval/themes/hugo-theme-lowtech + +--- +kind: pipeline +type: docker +name: staging + +platform: + os: linux + arch: arm64 + +steps: +- name: install submodule + image: drone/git + commands: + - git config --global http.sslverify false + - git submodule update --init + +- name: install npm + image: node:current-alpine + volumes: + - name: hugo-theme-lowtech_node_modules + path: /drone/src/themes/hugo-theme-lowtech/node_modules + environment: + DIRECTUS_URL: + from_secret: DIRECTUS_URL + DIRECTUS_TOKEN: + from_secret: DIRECTUS_TOKEN + commands: + - (cd themes/hugo-theme-lowtech && npm i) + - DRAFT=true node scripts/directus-to-markdown/index.js + +- name: build website + image: jakejarvis/hugo-extended + commands: + - hugo --minify --buildDrafts --buildFuture --environment staging + +- name: typo + image: node:current-alpine + volumes: + - name: hugo-theme-lowtech_node_modules + path: /drone/src/themes/hugo-theme-lowtech/node_modules + commands: + - node themes/hugo-theme-lowtech/scripts/typo + +- name: push docker image on registry + image: plugins/docker + settings: + username: + from_secret: REGISTRY_USER + password: + from_secret: REGISTRY_PASSWORD + repo: registry.weko.io/lestoitsduval + registry: registry.weko.io + tags: + - staging + +image_pull_secrets: +- REGISTRY_CONFIG + +volumes: +- name: hugo-theme-directus-import_node_modules + host: + path: /tmp/drone/cache/weko/lestoitsduval/themes/hugo-theme-directus-import +- name: hugo-theme-lowtech_node_modules + host: + path: /tmp/drone/cache/weko/lestoitsduval/themes/hugo-theme-lowtech diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 32005ec..187a99e 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -10,7 +10,7 @@ services: ltdv-prod: container_name: ltdv-prod build: . - image: registry.weko.io/lestoitsduval + image: registry.weko.io/lestoitsduval:prod restart: always labels: - "traefik.enable=true" diff --git a/docker-compose.staging.yml b/docker-compose.staging.yml index a342766..6675869 100644 --- a/docker-compose.staging.yml +++ b/docker-compose.staging.yml @@ -8,11 +8,13 @@ services: ltdv-staging: container_name: ltdv-staging build: . + image: registry.weko.io/lestoitsduval:staging restart: always labels: - traefik.enable: "true" - traefik.http.routers.ltdv-staging.rule: "Host(`staging.${URL}`)" - traefik.http.routers.ltdv-staging.entrypoints: "web" + - "traefik.enable=true" + - "traefik.http.routers.ltdv-staging.rule=Host(`staging.${URL}`)" + - "traefik.http.routers.ltdv-staging.entrypoints=web" + - "com.centurylinklabs.watchtower.enable=true" volumes: - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro diff --git a/layouts/partials/monitoring.html b/layouts/partials/monitoring.html index 5fa7e50..1f2b36e 100644 --- a/layouts/partials/monitoring.html +++ b/layouts/partials/monitoring.html @@ -2,6 +2,7 @@ {{ $lastDayData := $json.overview.lastDayData.energy }} {{ $lastMonthData := $json.overview.lastMonthData.energy }} {{ $lifeTimeData := $json.overview.lifeTimeData.energy }} +{{ $lastUpdateTime := $json.overview.lastUpdateTime }} @@ -12,6 +13,6 @@ - +
Production Greyzolon DuluthProduction totale{{ lang.NumFmt 2 (div $lifeTimeData 1000000) "- . ," }} MWh
{{ $json.overview.lastUpdateTime | time.Format ":date_medium" }}{{ $lastUpdateTime | time.Format ":date_medium" }} à {{ replace ($lastUpdateTime | time.Format ":time_short") ":" "h" }}