Add automated deployment via Woodpecker CI

This commit is contained in:
Elara 2023-02-12 00:20:16 -08:00
parent c651c05cfb
commit 29e008c590
3 changed files with 73 additions and 0 deletions

View File

26
.woodpecker.yml Normal file
View File

@ -0,0 +1,26 @@
pipeline:
build:
image: klakegg/hugo:ext-alpine-ci
commands:
- hugo
- tar czvf site.tar.gz public/
upload:
image: plugins/s3
settings:
endpoint: https://api.minio.arsenm.dev
path_style: true
bucket: site
access_key: AkdgUdmzEJBoiYa2
secret_key:
from_secret: minio_secret_key
source: site.tar.gz
target: /
deploy:
image: loq9/drone-nomad
settings:
addr: http://192.168.100.62:4646
template: template.nomad
environment:
- PLUGIN_WATCH_DEPLOYMENT=true

47
template.nomad Normal file
View File

@ -0,0 +1,47 @@
job "site" {
region = "global"
datacenters = ["dc1"]
type = "service"
group "site" {
count = 2
network {
port "nginx" {
to = 80
}
}
task "nginx" {
driver = "docker"
config {
image = "nginx:latest"
ports = ["nginx"]
volumes = ["local/site/public:/usr/share/nginx/html:ro"]
}
artifact {
source = "https://api.minio.arsenm.dev/site/site.tar.gz"
destination = "local/site"
}
service {
name = "site"
port = "nginx"
tags = [
"traefik.enable=true",
"traefik.http.middlewares.site-redir.redirectRegex.regex=^https://arsenm\\.dev",
"traefik.http.middlewares.site-redir.redirectRegex.replacement=https://www.arsenm.dev",
"traefik.http.middlewares.site-redir.redirectRegex.permanent=true",
"traefik.http.routers.site.rule=Host(`arsenm.dev`) || Host(`www.arsenm.dev`)",
"traefik.http.routers.site.middlewares=site-redir",
"traefik.http.routers.site.tls.certResolver=letsencrypt",
]
}
}
}
}