feat: Add drone deploy

This commit is contained in:
Simon 2022-12-05 15:02:52 +01:00
parent 233df17b62
commit fdf1bc7421
8 changed files with 147 additions and 68 deletions

View File

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

135
.drone.yml Normal file
View File

@ -0,0 +1,135 @@
---
# drone encrypt weko/weko.io $AWS_ACCESS_KEY_ID
kind: secret
name: STAGING_AWS_ACCESS_KEY_ID
data: WtVy8Op//nxf80WqKrVBUNucUohSNdfb+a6xBheoTJSktMo1R+MVj6vSsnyzRfeIjEX6oKBf
---
# drone encrypt weko/weko.io $AWS_SECRET_ACCESS_KEY
kind: secret
name: STAGING_AWS_SECRET_ACCESS_KEY
data: rrpzP1MZMKywkN1OppC9UaeLR1Zaa+Z9weQrduwUWX7YdSdwOKjxoYYRncV9leU8r9NGnJlIBtJaRA2I+FXPg/7q4ZhppAscDfcNxe1sug75Ni3exvYXeC0pbsU=
---
# drone encrypt weko/weko.io $AWS_ACCESS_KEY_ID
kind: secret
name: PRODUCTION_AWS_ACCESS_KEY_ID
data: hnpqmMR4M/j7dptGaUYX/OK/5zHRn2wsnorAwcakt76cl4AP0+so0rSqYcdVA05K8ER4PAkO
---
# drone encrypt weko/weko.io $AWS_SECRET_ACCESS_KEY
kind: secret
name: PRODUCTION_AWS_SECRET_ACCESS_KEY
data: NeDUFPKQazc+G7tILfKy4iNTildFBV3oPPn93NyIpu88xtQevk+Crg7km0z0yLevyTU//fkZ6fA9xw3bqWz7raSihzYn7V5TmStS57sykSglxWr0uPXkMazEKhg=
---
kind: pipeline
type: docker
name: prod
platform:
os: linux
arch: arm64
steps:
- name: install submodule
image: drone/git
commands:
- 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
commands:
- (cd themes/hugo-theme-lowtech && npm i)
- name: build website
image: klakegg/hugo:0.101.0-ext-debian-ci
commands:
- hugo --minify --environment production
- 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: deploy
image: klakegg/hugo:0.101.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 --environment production
trigger:
event:
- push
branch:
- main
volumes:
- name: hugo-theme-lowtech_node_modules
host:
path: /tmp/drone/cache/resilien/resilien_fr/themes/hugo-theme-lowtech
---
kind: pipeline
type: docker
name: staging
platform:
os: linux
arch: arm64
steps:
- name: install submodule
image: drone/git
commands:
- 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
commands:
- (cd themes/hugo-theme-lowtech && npm i)
- name: build website
image: klakegg/hugo:0.101.0-ext-debian-ci
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: deploy
image: klakegg/hugo:0.101.0-ext-debian-ci
environment:
AWS_ACCESS_KEY_ID:
from_secret: STAGING_AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: STAGING_AWS_SECRET_ACCESS_KEY
commands:
- hugo deploy --environment staging
trigger:
event:
- push
volumes:
- name: hugo-theme-lowtech_node_modules
host:
path: /tmp/drone/cache/resilien/resilien_fr/themes/hugo-theme-lowtech

4
.env
View File

@ -1,4 +0,0 @@
DOCKER_CONTEXT=vert.weko.resilien
NAME=vert.weko.resilien
URL=weko.io
STATS_CONTAINER=weko-stats

View File

@ -1,4 +0,0 @@
FROM registry.weko.io/nginx-lowtech:0.1.0
# Copie des sources du site
COPY public /usr/share/nginx/html

View File

@ -1 +1,7 @@
baseURL: https://weko.io/
deployment:
targets:
- name: production
URL: >-
s3://weko.io?endpoint=http://10.20.20.10:3900&disableSSL=true&s3ForcePathStyle=true&region=garage

View File

@ -1 +1,7 @@
baseURL: https://staging.weko.io/
deployment:
targets:
- name: staging
URL: >-
s3://staging.weko.io?endpoint=http://10.20.20.10:3900&disableSSL=true&s3ForcePathStyle=true&region=garage

View File

@ -1,37 +0,0 @@
version: "3.8"
volumes:
weko-log:
name: weko-log
weko-stats:
name: weko-stats
services:
weko-prod:
container_name: weko-prod
build: .
restart: always
labels:
traefik.enable: "true"
traefik.http.routers.weko.rule: "Host(`${URL}`)"
traefik.http.routers.weko.entrypoints: "web"
volumes:
- weko-log:/var/log/nginx
- weko-stats:/usr/share/nginx/html/stats
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
weko-stats:
container_name: weko-stats
image: registry.weko.io/goaccess:1.5.1
restart: always
volumes:
- weko-log:/var/log/nginx
- weko-stats:/usr/share/nginx/html/stats
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
networks:
default:
external:
name: traefik

View File

@ -1,19 +0,0 @@
version: "3.8"
networks:
default:
external:
name: traefik
services:
weko-staging:
container_name: weko-staging
build: .
restart: always
labels:
traefik.enable: "true"
traefik.http.routers.weko-staging.rule: "Host(`staging.${URL}`)"
traefik.http.routers.weko-staging.entrypoints: "web"
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro