feat: Modification du déploiement

This commit is contained in:
Simon 2022-12-08 14:16:22 +01:00
parent a7a1f1d25f
commit 8627f0fcd0
6 changed files with 62 additions and 101 deletions

View File

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

View File

@ -1,20 +1,14 @@
--- ---
# drone encrypt kosssi/histoiredunpied $REGISTRY_PASSWORD # drone encrypt weko/histoiredunpied $AWS_ACCESS_KEY_ID
kind: secret kind: secret
name: REGISTRY_PASSWORD name: PRODUCTION_AWS_ACCESS_KEY_ID
data: OEvQkKRQWXNAFMEVYWrKqKjawvzeccLVCpYLHew8kufit+xxvbsePwcTI1+D1QWVLqJp8k8ShISD3xyzxp7wqXcV0hsF3kYcsxc7zg5y data: /xI53R4q+LG5Hyo4m58pqTkwAtRXwRq81J4xdgjNrKIjsMdr9tZ+WQDU9UDlQ6AmbiVPgB03
--- ---
# drone encrypt kosssi/histoiredunpied $REGISTRY_USER # drone encrypt weko/histoiredunpied $AWS_SECRET_ACCESS_KEY
kind: secret kind: secret
name: REGISTRY_USER name: PRODUCTION_AWS_SECRET_ACCESS_KEY
data: cMOL24CRvJvIFwxXp6G/oyekU7g8G/8UJJ3XuoRsbK2bZA== data: s8r0O9MmAlItowihl8mpx5BfoBwpTngxnIjATbkwpBadx3K3vPoClO9f4I1sfRl8ANn84Jp8VioMynvNUyw1+283O0qmMtvLPm54KZ4fqh/pxJoT35lur/2hKug=
---
# drone encrypt kosssi/histoiredunpied "{\"auths\":{\"https://registry.weko.io\":{\"auth\":\"$(echo -n "$REGISTRY_USER:$REGISTRY_PASSWORD" | base64)\",\"email\":\"$REGISTRY_USER\"}}}"
kind: secret
name: REGISTRY_CONFIG
data: HGEQqB3NrTqH2dF715fgDCNWDmQXRY1psgbYd0IH9O4eByqXdPBWAY5QUI8J3IxK7IpWObB418jWqwPUAVegzOEAn/bAn1PUVOV+cjG1PfbbvHIUFyYvCojGmf2p+NucXACo3KrebrnPpf6lUvftH9xWLLFW3e/ECnSq9rq5v0xh1fFwlghkwjjxOEfDHhlHx+eXlSY6nEuNH2svl1wo11xTqemSOPgGlpzJ
--- ---
kind: pipeline kind: pipeline
@ -26,28 +20,61 @@ platform:
arch: arm64 arch: arm64
steps: steps:
- name: install - name: install submodule
image: registry.weko.io/hugo image: drone/git
commands: commands:
- git submodule update --init - 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
- name: hugo-node_modules
path: /drone/src/node_modules
commands:
- npm i
- (cd themes/hugo-theme-lowtech && npm i) - (cd themes/hugo-theme-lowtech && npm i)
- npm run build
- name: build website
image: klakegg/hugo:0.107.0-ext-debian-ci
commands:
- hugo --minify --environment production
- name: Typo + purgecss
image: node:current-alpine
volumes:
- name: hugo-theme-lowtech_node_modules
path: /drone/src/themes/hugo-theme-lowtech/node_modules
- name: hugo-node_modules
path: /drone/src/node_modules
commands:
- node themes/hugo-theme-lowtech/scripts/typo
- node_modules/.bin/purgecss --css public/css/*.css --content public/index.html --output public/css/
- 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 --environment production
when: when:
branch: branch:
- master - master
- name: docker trigger:
image: plugins/docker event:
settings: - push
username: branch:
from_secret: REGISTRY_USER - master
password:
from_secret: REGISTRY_PASSWORD
repo: registry.weko.io/histoiredunpied
registry: registry.weko.io
auto_tag: true
tags:
- latest
image_pull_secrets: volumes:
- REGISTRY_CONFIG - name: hugo-theme-lowtech_node_modules
host:
path: /tmp/drone/cache/weko/histoiredunpied_com/themes/hugo-theme-lowtech
- name: hugo-node_modules
host:
path: /tmp/drone/cache/weko/histoiredunpied_com/node_modules

View File

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

View File

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

View File

@ -1,61 +0,0 @@
version: "3.8"
volumes:
histoiredunpied-log-volume:
name: histoiredunpied-log-volume
histoiredunpied-stats:
name: histoiredunpied-stats
services:
# histoiredunpied-autopush:
# container_name: histoiredunpied-autopush
# image: registry.weko.io/autopush
# restart: always
# depends_on:
# - histoiredunpied
# environment:
# GIT_USER: ${GIT_USER}
# GIT_URL: ${GIT_URL}
# GIT_REPOSITORY: ${GIT_REPOSITORY}
# DOWNLOAD_URL: ${DOWNLOAD_URL}
# WEBDAV_URL: ${WEBDAV_URL}
# labels:
# com.centurylinklabs.watchtower.enable: true
# volumes:
# - /etc/timezone:/etc/timezone:ro
# - /etc/localtime:/etc/localtime:ro
histoiredunpied-logs:
container_name: histoiredunpied-logs
image: registry.weko.io/goaccess:1.4.6
restart: always
# depends_on:
# - histoiredunpied-autopush
volumes:
- histoiredunpied-log-volume:/var/log/nginx
- histoiredunpied-stats:/usr/share/nginx/html/stats
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
labels:
com.centurylinklabs.watchtower.enable: true
histoiredunpied:
container_name: histoiredunpied
image: registry.weko.io/histoiredunpied
restart: always
volumes:
- histoiredunpied-log-volume:/var/log/nginx
- histoiredunpied-stats:/usr/share/nginx/html/stats
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
labels:
traefik.enable: "true"
traefik.http.routers.histoiredunpied.rule: "Host(`histoiredunpied.com`)"
traefik.http.routers.histoiredunpied.entrypoints: "web"
com.centurylinklabs.watchtower.enable: true
networks:
default:
external:
name: traefik

View File

@ -8,9 +8,6 @@
"build": "rm -rf public && hugo -D --minify && node themes/hugo-theme-lowtech/scripts/typo && purgecss --css public/css/*.css --content public/index.html --output public/css/", "build": "rm -rf public && hugo -D --minify && node themes/hugo-theme-lowtech/scripts/typo && purgecss --css public/css/*.css --content public/index.html --output public/css/",
"favicon": "convert static/icon.png -resize 32x32 -colors 16 \\( -clone 0 -resize 16x16 -extent 16x16 \\) \\( -clone 0 -resize 32x32 -extent 32x32 \\) -delete 0 static/favicon.ico", "favicon": "convert static/icon.png -resize 32x32 -colors 16 \\( -clone 0 -resize 16x16 -extent 16x16 \\) \\( -clone 0 -resize 32x32 -extent 32x32 \\) -delete 0 static/favicon.ico",
"svgo": "svgo */**.svg", "svgo": "svgo */**.svg",
"deploy": "docker-compose up -d --build",
"ftp-deploy": "lftp -u $HISTOIREDUNPIED_FTP_USER,$HISTOIREDUNPIED_FTP_PASSWORD $HISTOIREDUNPIED_FTP_HOST -e 'mirror -e -R ./public /www ; quit'",
"ftp-htaccess": "lftp -u $HISTOIREDUNPIED_FTP_USER,$HISTOIREDUNPIED_FTP_PASSWORD $HISTOIREDUNPIED_FTP_HOST -e 'put ./.htaccess ; quit'",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"author": "Simon <simon@lamelio.fr>", "author": "Simon <simon@lamelio.fr>",