aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md87
1 files changed, 87 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..d7259d7
--- /dev/null
+++ b/README.md
@@ -0,0 +1,87 @@
+# Guestbook
+
+Standalone guestbook server meant to be paired up with a static website.
+
+# Usage
+
+## Configuration
+
+Edit `/etc/guestbook.toml`
+
+```toml
+# the idea is to have a single database but different
+# tables for each guestbook (if any)
+
+[database]
+# Supported - MySQL/MariaDB
+username = "guestbook"
+password = "guestbookpass"
+location = "tcp(127.0.0.1:3306)"
+db_name = "guestbook"
+params = "charset=utf8mb4&parseTime=True&loc=Local"
+
+# add as many as you like
+# avoid having hyphens in the name
+[my_guestbook]
+port = 2222
+path = "/sign"
+validation_string = ""
+success_redirect = "/success"
+error_redirect = "/error"
+template = """
+{{range .}}
+{{print "{{"}}
+ guestbook_entry(
+ name=\"{{.Name}}\",
+ website=\"{{.Website}}\",
+ message=\"{{.Message}}\"
+ )
+{{print "}}"}}
+{{end}}"""
+```
+
+## Starting with Systemd
+
+Then use this Systemd service:
+
+`/etc/systemd/system/my_guestbook-guestbook.service`
+
+Replace `my_guestbook` with your guestbook's name (as defined in `/etc/guestbook.toml`),
+create more `.service` files for as many guestbooks you want to have.
+
+```
+[Unit]
+Description=Guestbook for my_guestbook
+After=network.target
+StartLimitIntervalSec=0
+
+[Service]
+Type=simple
+Restart=on-failure
+RestartSec=1
+ExecStart=guestbook --guestbook my_guestbook
+
+[Install]
+WantedBy=multi-user.target
+```
+
+Then, reload the daemon and start the guestbook:
+
+```fish
+systemctl daemon-reload
+systemctl enable --now my_guestbook-guestbook
+```
+
+## Reading entries
+
+```fish
+guestbook dump -g my_guestbook
+```
+
+## Licence
+
+Licenced under GNU General Public Licence
+
+GNU GPL License: [LICENSE](LICENSE)
+
+Copyright (c) 2025 Vidhu Kant Sharma