feat: Mise à jour automatique de staging

This commit is contained in:
Simon 2022-01-31 08:59:01 +01:00
parent b632f0f7a1
commit cb99e8cf4b
4 changed files with 75 additions and 6 deletions

View File

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

View File

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

View File

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

View File

@ -2,6 +2,7 @@
{{ $lastDayData := $json.overview.lastDayData.energy }}
{{ $lastMonthData := $json.overview.lastMonthData.energy }}
{{ $lifeTimeData := $json.overview.lifeTimeData.energy }}
{{ $lastUpdateTime := $json.overview.lastUpdateTime }}
<table class="monitoring">
<tr>
<th colspan="3">Production Greyzolon Duluth</th>
@ -12,6 +13,6 @@
<td>Production totale<strong>{{ lang.NumFmt 2 (div $lifeTimeData 1000000) "- . ," }} MWh</strong></td>
</tr>
<tr>
<td class="date" colspan="3">{{ $json.overview.lastUpdateTime | time.Format ":date_medium" }}</td>
<td class="date" colspan="3">{{ $lastUpdateTime | time.Format ":date_medium" }} à {{ replace ($lastUpdateTime | time.Format ":time_short") ":" "h" }}</td>
</tr>
</table>