aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--.ssh/config2
-rw-r--r--Makefile7
-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
8 files changed, 61 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 13e93ea..62d8336 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
*.lck
*.log
+/.cache
/CHANGELOG.html
/README.html
/_AUR/*.tar.zst
diff --git a/.ssh/config b/.ssh/config
new file mode 100644
index 0000000..59328e7
--- /dev/null
+++ b/.ssh/config
@@ -0,0 +1,2 @@
+Host awwan.org
+ Hostname awwan.org
diff --git a/Makefile b/Makefile
index 9601a15..e3c26f0 100644
--- a/Makefile
+++ b/Makefile
@@ -96,9 +96,16 @@ test-all:
build-www: embed
go build ./internal/cmd/www-awwan/
+.PHONY: serve-www
serve-www:
go run ./internal/cmd/www-awwan -dev
+.PHONY: install-www
+install-www: build-www
+ mkdir -p /data/app/bin/
+ rsync --progress ./www-awwan /data/app/bin/
+
+.PHONY: deploy-www
deploy-www: GOOS=linux GOARCH=amd64 CGO_ENABLED=0
deploy-www: build-www
rsync --progress ./www-awwan awwan.org:/data/app/bin/
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