aboutsummaryrefslogtreecommitdiff
path: root/_ops
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-11-27 00:48:59 +0700
committerShulhan <ms@kilabit.info>2023-12-01 13:17:30 +0700
commit115adf2ed71b602204cd9fedb0e046e731aa7e38 (patch)
treec9b7fdcdcee76d3f1178d5df3556754b1dff9cff /_ops
parent03021123170954e11d11e658f757c52df4177b22 (diff)
downloadawwan-115adf2ed71b602204cd9fedb0e046e731aa7e38.tar.xz
_ops: add awwan scripts to manage awwan.org website
Previously, this scripts is stored on my personal awwan workspace. As part of dog feeding, we expose how we manage awwan.org here, so people can see it as example of how awwan works.
Diffstat (limited to '_ops')
-rw-r--r--_ops/awwan.org/10_www-awwan.aww22
-rw-r--r--_ops/awwan.org/awwan.env2
-rw-r--r--_ops/awwan.org/etc/systemd/system/systemctl-restart@.service6
-rw-r--r--_ops/awwan.org/etc/systemd/system/www-awwan.path9
-rw-r--r--_ops/awwan.org/etc/systemd/system/www-awwan.service12
5 files changed, 51 insertions, 0 deletions
diff --git a/_ops/awwan.org/10_www-awwan.aww b/_ops/awwan.org/10_www-awwan.aww
new file mode 100644
index 0000000..fdfc7f3
--- /dev/null
+++ b/_ops/awwan.org/10_www-awwan.aww
@@ -0,0 +1,22 @@
+sudo mkdir -p /srv/awwan
+sudo chown ms:ms -R /srv/awwan
+sudo chmod +755 /srv/awwan
+
+#put!+0644 \
+ {{.ScriptDir}}/etc/systemd/system/systemctl-restart@.service \
+ /etc/systemd/system/systemctl-restart@.service
+
+sudo systemctl daemon-reload
+
+#put!+0644 \
+ {{.ScriptDir}}/etc/systemd/system/www-awwan.path \
+ /etc/systemd/system/www-awwan.path
+
+sudo systemctl enable --now www-awwan.path
+
+#put!+0644 \
+ {{.ScriptDir}}/etc/systemd/system/www-awwan.service \
+ /etc/systemd/system/www-awwan.service
+
+sudo systemctl enable --now www-awwan.service
+sudo systemctl status www-awwan.service
diff --git a/_ops/awwan.org/awwan.env b/_ops/awwan.org/awwan.env
new file mode 100644
index 0000000..1d6efcb
--- /dev/null
+++ b/_ops/awwan.org/awwan.env
@@ -0,0 +1,2 @@
+[awwan "www"]
+bin = /data/app/bin/www-awwan
diff --git a/_ops/awwan.org/etc/systemd/system/systemctl-restart@.service b/_ops/awwan.org/etc/systemd/system/systemctl-restart@.service
new file mode 100644
index 0000000..800316e
--- /dev/null
+++ b/_ops/awwan.org/etc/systemd/system/systemctl-restart@.service
@@ -0,0 +1,6 @@
+[Unit]
+Description=systemctl-restart@%i
+
+[Service]
+Type=oneshot
+ExecStart=/bin/systemctl restart %i
diff --git a/_ops/awwan.org/etc/systemd/system/www-awwan.path b/_ops/awwan.org/etc/systemd/system/www-awwan.path
new file mode 100644
index 0000000..e6ac1c4
--- /dev/null
+++ b/_ops/awwan.org/etc/systemd/system/www-awwan.path
@@ -0,0 +1,9 @@
+[Unit]
+Description="Watch www-awwan"
+
+[Path]
+PathChanged={{.Val "awwan:www:bin"}}
+Unit=systemctl-restart@%p.service
+
+[Install]
+WantedBy=multi-user.target
diff --git a/_ops/awwan.org/etc/systemd/system/www-awwan.service b/_ops/awwan.org/etc/systemd/system/www-awwan.service
new file mode 100644
index 0000000..82f3de7
--- /dev/null
+++ b/_ops/awwan.org/etc/systemd/system/www-awwan.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=www-awwan
+After=network-online.target
+
+[Service]
+Type=simple
+ExecStart={{.Val "awwan:www:bin"}}
+Restart=on-failure
+RestartSec=5
+
+[Install]
+WantedBy=default.target