From 2486a94d2198dcd122edf4b13b61062f2c329f80 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Mon, 18 Mar 2024 21:19:42 +0530 Subject: [PATCH] Add the service the serves status.ente.io --- infra/services/status/README.md | 39 +++++++++++++++++++++++ infra/services/status/uptime-kuma.conf | 19 +++++++++++ infra/services/status/uptime-kuma.service | 16 ++++++++++ 3 files changed, 74 insertions(+) create mode 100644 infra/services/status/README.md create mode 100644 infra/services/status/uptime-kuma.conf create mode 100644 infra/services/status/uptime-kuma.service diff --git a/infra/services/status/README.md b/infra/services/status/README.md new file mode 100644 index 000000000..51166f424 --- /dev/null +++ b/infra/services/status/README.md @@ -0,0 +1,39 @@ +# Status + +Our status page ([status.ente.io](https://status.ente.io)) is a self-hosted +[Uptime Kuma](https://github.com/louislam/uptime-kuma). + +## Installing + +Install [nginx](../nginx/README.md). + +Create a directory where Uptime Kuma will keep its state. This is the directory +we can optionally backup if we wish to preserve history and settings when moving +instances in the future. + +```sh +sudo mkdir -p /root/uptime-kuma +``` + +Add the service definition and nginx configuration. + +```sh +scp services/status/uptime-kuma.* : + +sudo mv uptime-kuma.service /etc/systemd/system/uptime-kuma.service +sudo mv uptime-kuma.nginx.conf /root/nginx/conf.d +``` + +Tell systemd to pick up new service definitions, enable the unit (so that it +automatically starts on boot), and start it this time around. + +```sh +sudo systemctl daemon-reload +sudo systemctl enable --now uptime-kuma +``` + +Restart nginx + +```sh +sudo systemctl restart nginx +``` diff --git a/infra/services/status/uptime-kuma.conf b/infra/services/status/uptime-kuma.conf new file mode 100644 index 000000000..6c3b08b33 --- /dev/null +++ b/infra/services/status/uptime-kuma.conf @@ -0,0 +1,19 @@ +# This file gets loaded in a top level http block by the default nginx.conf +# See infra/services/nginx/README.md for more details. + +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + ssl_certificate /etc/ssl/certs/cert.pem; + ssl_certificate_key /etc/ssl/private/key.pem; + + server_name status.ente.io; + + location / { + proxy_pass http://host.docker.internal:3001; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } +} diff --git a/infra/services/status/uptime-kuma.service b/infra/services/status/uptime-kuma.service new file mode 100644 index 000000000..11789d8c4 --- /dev/null +++ b/infra/services/status/uptime-kuma.service @@ -0,0 +1,16 @@ +[Unit] +Documentation=https://github.com/louislam/uptime-kuma +Requires=docker.service +After=docker.service + +[Install] +WantedBy=multi-user.target + +[Service] +ExecStartPre=docker pull louislam/uptime-kuma:1 +ExecStartPre=-docker stop uptime-kuma +ExecStartPre=-docker rm uptime-kuma +ExecStart=docker run --name uptime-kuma \ + -p 3001:3001 \ + -v /root/uptime-kuma:/app/data \ + louislam/uptime-kuma:1