This is a GuestBook for edmateo.site. It's only a shitty REST API
- GoLang
- PostgreSQL
Create a PostgreSQL database for storing guestbook entries:
su -c "createuser --pwprompt guestbook" postgres
su -c "psql -c 'CREATE DATABASE guestbook OWNER guestbook;'" postgres
Clone this repo to your server:
git clone https://github.com/ImnotEdMateo/guestbook.git
Navigate to the project directory and build the binary:
cd guestbook/
go build ./cmd/main
After building, you should see a main
binary in the project root.
To manage the application as a service, create a Systemd service file:
sudo vim /etc/systemd/system/guestbook.service
Add the following content to the file:
[Unit]
Description=GuestBook
After=network.target
[Service]
Environment=DB_HOST=yourhost
Environment=DB_USER=guestbook
Environment=DB_PASSWORD=yourpassword
Environment=DB_NAME=guestbook
Environment=DB_PORT=yourpostgresport
User=root
Type=simple
Restart=always
ExecStart=/absoulte/path/to/your/binary/main
[Install]
WantedBy=multi-user.target
Reload the Systemd daemon and start the GuestBook service:
sudo systemctl daemon-reload
sudo systemctl start guestbook
Open your browser and navigate to your server’s address on port 3000
. You should see an empty JSON response, indicating the API is running.