From 8627f0fcd0b5e8b7a1f25eb426d9fe1656844a57 Mon Sep 17 00:00:00 2001 From: Simon C Date: Thu, 8 Dec 2022 14:16:22 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20Modification=20du=20d=C3=A9ploiement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 4 -- .drone.yml | 85 ++++++++++++++++++++++++------------ Dockerfile | 4 -- config/production/config.yml | 6 +++ docker-compose.yml | 61 -------------------------- package.json | 3 -- 6 files changed, 62 insertions(+), 101 deletions(-) delete mode 100644 .dockerignore delete mode 100644 Dockerfile delete mode 100644 docker-compose.yml 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 index 7f18adc..e258ac0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,20 +1,14 @@ --- -# drone encrypt kosssi/histoiredunpied $REGISTRY_PASSWORD +# drone encrypt weko/histoiredunpied $AWS_ACCESS_KEY_ID kind: secret -name: REGISTRY_PASSWORD -data: OEvQkKRQWXNAFMEVYWrKqKjawvzeccLVCpYLHew8kufit+xxvbsePwcTI1+D1QWVLqJp8k8ShISD3xyzxp7wqXcV0hsF3kYcsxc7zg5y +name: PRODUCTION_AWS_ACCESS_KEY_ID +data: /xI53R4q+LG5Hyo4m58pqTkwAtRXwRq81J4xdgjNrKIjsMdr9tZ+WQDU9UDlQ6AmbiVPgB03 --- -# drone encrypt kosssi/histoiredunpied $REGISTRY_USER +# drone encrypt weko/histoiredunpied $AWS_SECRET_ACCESS_KEY kind: secret -name: REGISTRY_USER -data: cMOL24CRvJvIFwxXp6G/oyekU7g8G/8UJJ3XuoRsbK2bZA== - ---- -# 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 +name: PRODUCTION_AWS_SECRET_ACCESS_KEY +data: s8r0O9MmAlItowihl8mpx5BfoBwpTngxnIjATbkwpBadx3K3vPoClO9f4I1sfRl8ANn84Jp8VioMynvNUyw1+283O0qmMtvLPm54KZ4fqh/pxJoT35lur/2hKug= --- kind: pipeline @@ -26,28 +20,61 @@ platform: arch: arm64 steps: -- name: install - image: registry.weko.io/hugo +- 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 + - name: hugo-node_modules + path: /drone/src/node_modules + commands: + - 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: branch: - master -- name: docker - image: plugins/docker - settings: - username: - from_secret: REGISTRY_USER - password: - from_secret: REGISTRY_PASSWORD - repo: registry.weko.io/histoiredunpied - registry: registry.weko.io - auto_tag: true - tags: - - latest +trigger: + event: + - push + branch: + - master -image_pull_secrets: -- REGISTRY_CONFIG +volumes: +- 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 diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index fe82c9c..0000000 --- a/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM registry.weko.io/nginx-lowtech:0.0.8 - -# Copie des sources du site -COPY public /usr/share/nginx/html diff --git a/config/production/config.yml b/config/production/config.yml index d065a65..a52798d 100644 --- a/config/production/config.yml +++ b/config/production/config.yml @@ -1 +1,7 @@ baseURL: https://histoiredunpied.com/ + +deployment: + targets: + - name: production + URL: >- + s3://histoiredunpied.com?endpoint=http://10.20.20.10:3900&disableSSL=true&s3ForcePathStyle=true®ion=garage diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 51481fc..0000000 --- a/docker-compose.yml +++ /dev/null @@ -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 diff --git a/package.json b/package.json index df18557..5031db9 100644 --- a/package.json +++ b/package.json @@ -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/", "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", - "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" }, "author": "Simon ",