# 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}}\", time=\"{{.Time}}\" ) {{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 ``` ## Nginx configuration Pass exactly the desired url to the guestbook server. Replace port and the path to match your configuration. ``` location = /guestbook/sign { proxy_pass http://localhost:2222/sign; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } ``` ## 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