aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2020-03-02 07:52:54 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2020-03-02 07:52:54 +0100
commit163472bed90d2514e38ca9e3659fa3afe06a9f2e (patch)
tree521101fedf49a0b520b68dc277d2f1395a48f93a
parentc8c2cdf8d416f6a4a04a1765bce41a557df74566 (diff)
downloadinfrastructure-163472bed90d2514e38ca9e3659fa3afe06a9f2e.tar.gz
infrastructure-163472bed90d2514e38ca9e3659fa3afe06a9f2e.zip
webpull
-rw-r--r--consul/secrets/web/home_token.sample0
-rw-r--r--docker/webpull/.gitignore1
-rw-r--r--docker/webpull/Dockerfile.pug10
-rw-r--r--docker/webpull/README.md7
-rw-r--r--nomad/web_static.hcl17
5 files changed, 31 insertions, 4 deletions
diff --git a/consul/secrets/web/home_token.sample b/consul/secrets/web/home_token.sample
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/consul/secrets/web/home_token.sample
diff --git a/docker/webpull/.gitignore b/docker/webpull/.gitignore
new file mode 100644
index 0000000..ba2906d
--- /dev/null
+++ b/docker/webpull/.gitignore
@@ -0,0 +1 @@
+main
diff --git a/docker/webpull/Dockerfile.pug b/docker/webpull/Dockerfile.pug
new file mode 100644
index 0000000..9600f35
--- /dev/null
+++ b/docker/webpull/Dockerfile.pug
@@ -0,0 +1,10 @@
+FROM node:13.8-buster
+
+RUN apt-get update && \
+ apt-get install -y git && \
+ npm install -g pug-cli jstransformer-markdown-it
+
+COPY ./main /srv/httpd
+WORKDIR /srv
+CMD ["/srv/httpd"]
+
diff --git a/docker/webpull/README.md b/docker/webpull/README.md
index 386a7ef..351d300 100644
--- a/docker/webpull/README.md
+++ b/docker/webpull/README.md
@@ -1,3 +1,10 @@
# webpull
Webpull allows you to update your live website without deploying a new docker container but by simply calling an URL
+
+## Pug version
+
+```
+go build ./main.go
+sudo docker build -f ./Dockerfile.pug -t superboum/amd64_webpull_pug:v1
+```
diff --git a/nomad/web_static.hcl b/nomad/web_static.hcl
index 8e0042b..5a3b80f 100644
--- a/nomad/web_static.hcl
+++ b/nomad/web_static.hcl
@@ -11,14 +11,23 @@ job "web_static" {
task "server" {
driver = "docker"
config {
- image = "superboum/amd64_landing:v8"
+ image = "superboum/amd64_webpull_pug:v4"
port_map {
- web_port = 8043
+ web_port = 8080
}
}
+ template {
+ data = <<EOH
+WEBPULL_REPO="https://git.deuxfleurs.fr/Deuxfleurs/site.git"
+WEBPULL_TOKEN="{{ key "secrets/web/home_token" | trimSpace }}"
+EOH
+ destination = "secrets/env"
+ env = true
+ }
+
resources {
- memory = 20
+ memory = 200
network {
port "web_port" {}
}
@@ -29,7 +38,7 @@ job "web_static" {
"webstatic",
"traefik.enable=true",
"traefik.frontend.entryPoints=https,http",
- "traefik.frontend.rule=Host:deuxfleurs.fr,www.deuxfleurs.fr,deuxfleurs.org,www.deuxfleurs.org;Path:/,/robots.txt,/landing/arobase.png"
+ "traefik.frontend.rule=Host:deuxfleurs.fr,www.deuxfleurs.fr,deuxfleurs.org,www.deuxfleurs.org;PathPrefix:/"
]
port = "web_port"
address_mode = "host"