diff options
| -rw-r--r-- | files/uptime-kuma.conf | 27 | ||||
| -rw-r--r-- | install-uptime-kuma-playbook.yml | 39 | ||||
| -rw-r--r-- | inventory.ini | 3 |
3 files changed, 69 insertions, 0 deletions
diff --git a/files/uptime-kuma.conf b/files/uptime-kuma.conf new file mode 100644 index 0000000..77fff8e --- /dev/null +++ b/files/uptime-kuma.conf @@ -0,0 +1,27 @@ +server { + listen 80; + server_name status.bensanders.net; + + location / { + proxy_pass http://localhost:3001; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + 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; + + # Added WebSocket support + proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key; + proxy_set_header Sec-WebSocket-Version $http_sec_websocket_version; + proxy_set_header Sec-WebSocket-Extensions $http_sec_websocket_extensions; + + # Improve performance of this reverse proxy + proxy_buffering off; + } + + # Redirect HTTP to HTTPS if needed for encryption + # Uncomment the following lines if you have SSL enabled + # return 301 https://$host$request_uri; +}
\ No newline at end of file diff --git a/install-uptime-kuma-playbook.yml b/install-uptime-kuma-playbook.yml new file mode 100644 index 0000000..76c6e1b --- /dev/null +++ b/install-uptime-kuma-playbook.yml @@ -0,0 +1,39 @@ +--- +- name: Set up Uptime Kuma on all servers + hosts: hosts + remote_user: root + tasks: + - name: Install Needed Packages + ansible.builtin.apt: + update_cache: yes + pkg: + - nginx + - curl + - git + - name: Install NodeJS Source + ansible.builtin.shell: 'curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - && sudo apt' + - name: Install NodeJS + ansible.builtin.apt: + update_cache: yes + name: nodejs + - name: Clone Uptime Kuma + ansible.builtin.shell: 'cd /root/ && git clone https://github.com/louislam/uptime-kuma.git' + - name: Run NPM Commands + ansible.builtin.shell: 'cd /root/uptime-kuma/ && npm run setup && npm install pm2 -g' + - name: Install logrotate + ansible.builtin.shell: 'cd /root/uptime-kuma/ && pm2 install pm2-logrotate' + - name: Start Kuma Server + ansible.builtin.shell: 'cd /root/uptime-kuma/ && pm2 start server/server.js --name uptime-kuma && pm2 startup' + - name: NGINX Config + become: true + ansible.builtin.copy: + src: 'files/uptime-kuma.conf' + dest: /etc/nginx/conf.d/uptime-kuma.conf + owner: root + group: root + mode: '0644' + - name: Restart NGINX + ansible.builtin.systemd_service: + name: nginx + state: restarted + enabled: true diff --git a/inventory.ini b/inventory.ini index 44c3ab7..850bb8c 100644 --- a/inventory.ini +++ b/inventory.ini @@ -1,2 +1,5 @@ [hosts] 192.168.1.231 + +[public] +host.bensanders.net
\ No newline at end of file |
