summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2023-07-01 07:34:41 +0200
committerAlan Pearce2023-07-01 07:34:41 +0200
commit57e251e122e0f0d54c90103380aa83f80f0651fb (patch)
tree90b2e6089c5397f18e3a00b88951b099fca5382c
parenta19a4d5172e0bc2be93b646600b6d7cd3c360f3d (diff)
downloadwebsite-57e251e122e0f0d54c90103380aa83f80f0651fb.tar.lz
website-57e251e122e0f0d54c90103380aa83f80f0651fb.tar.zst
website-57e251e122e0f0d54c90103380aa83f80f0651fb.zip
Deploy to fly.io
-rw-r--r--.dockerignore3
-rw-r--r--.envrc1
-rw-r--r--Caddyfile13
-rw-r--r--Dockerfile6
-rw-r--r--fly.toml31
5 files changed, 52 insertions, 2 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..ee13087
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,3 @@
+*
+!Caddyfile
+!public
diff --git a/.envrc b/.envrc
index 3550a30..6a4286b 100644
--- a/.envrc
+++ b/.envrc
@@ -1 +1,2 @@
 use flake
+export SITE_ROOT=public
diff --git a/Caddyfile b/Caddyfile
index 6e62a6d..df931b5 100644
--- a/Caddyfile
+++ b/Caddyfile
@@ -1,5 +1,14 @@
-http:// {
-	root * public/
+{
+	admin off
+	persist_config off
+}
+
+:9091 {
+	metrics
+}
+
+:8080 {
+	root * {$SITE_ROOT}
 	file_server {
 		precompressed br zstd gzip
 	}
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..a0285f8
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,6 @@
+FROM docker.io/caddy:2-alpine
+
+COPY Caddyfile /etc/caddy/
+COPY public /srv
+
+EXPOSE 9091/tcp
diff --git a/fly.toml b/fly.toml
new file mode 100644
index 0000000..e6363d2
--- /dev/null
+++ b/fly.toml
@@ -0,0 +1,31 @@
+# fly.toml file generated for alanpearce-eu on 2023-06-30T19:28:33+02:00
+
+app = "alanpearce-eu"
+kill_signal = "SIGINT"
+kill_timeout = 5
+primary_region = "ams"
+
+[metrics]
+  port = 9091
+  path = "/metrics"
+
+[env]
+  SITE_ROOT = "/srv"
+
+[http_service]
+  internal_port = 8080
+  force_https = true
+  auto_stop_machines = true
+  auto_start_machines = true
+  min_machines_running = 1
+  [http_service.concurrency]
+    type = "requests"
+    soft_limit = 2000
+    hard_limit = 2500
+  [[http_service.checks]]
+    grace_period = "10s"
+    interval = "30s"
+    method = "GET"
+    timeout = "5s"
+    path = "/"
+