aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: d7259d7822654c757090e5616b1db8f12cc0b030 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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