diff options
| author | Shulhan <ms@kilabit.info> | 2023-11-27 00:48:59 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-12-01 13:17:30 +0700 |
| commit | 115adf2ed71b602204cd9fedb0e046e731aa7e38 (patch) | |
| tree | c9b7fdcdcee76d3f1178d5df3556754b1dff9cff | |
| parent | 03021123170954e11d11e658f757c52df4177b22 (diff) | |
| download | awwan-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.
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | .ssh/config | 2 | ||||
| -rw-r--r-- | Makefile | 7 | ||||
| -rw-r--r-- | _ops/awwan.org/10_www-awwan.aww | 22 | ||||
| -rw-r--r-- | _ops/awwan.org/awwan.env | 2 | ||||
| -rw-r--r-- | _ops/awwan.org/etc/systemd/system/systemctl-restart@.service | 6 | ||||
| -rw-r--r-- | _ops/awwan.org/etc/systemd/system/www-awwan.path | 9 | ||||
| -rw-r--r-- | _ops/awwan.org/etc/systemd/system/www-awwan.service | 12 |
8 files changed, 61 insertions, 0 deletions
@@ -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 @@ -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 |
