It's like del.icio.us of the past but you can host it yourself!
Create a new build:
make
Switch to the new directory and setup the database. This will create a new SQLite database file (bland.db) including all the necessary tables:
cd ./build
./bland -db ~/db/bland.db -setup
Now you can run the server:
./bland -db ~/db/bland.db -addr localhost:9999
Note that the database file is outside the build directory. This is because make
removes everything in the build directory on each run so keeping your database file in there is just asking for trouble.
To start a development server run this:
go run . -dev -db bland.db -addr localhost:9999
If you have nodemon installed you can watch for changes and reload the server automatically:
nodemon --exec go run . -dev -db bland.db -addr localhost:9999 --signal SIGTERM --ext html,go
If you, like me, have a JSON file with data from Pinboard you can import it into your database while setting it up:
./bland -db bland.db -setup -seed /path/to/pinboard_export.json
For longer running instances I highly recommend running Bland as a background service and putting it behind a reverse proxy server such as Nginx or Caddy.
First, create a new file in the /lib/systemd/system
directory named bland.service
and make it something like this (this assumes your build
directory is in /home/anton/srv/bland
and your database file is /home/anton/db/bland.db
):
[Unit]
Description=bland
[Service]
Type=simple
Restart=always
RestartSec=5s
WorkingDirectory=/home/anton/srv/bland
ExecStart=/home/anton/srv/bland/bland -addr localhost:9999 -db /home/anton/db/bland.db
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
Save this file. You can now start Bland in the background by running:
sudo service bland start
You can now put Bland behind a reverse proxy server. If you have Caddy installed it's as simple as adding this to your Caddyfile:
myblanddomain.ts.net {
reverse_proxy localhost:9999
}
If you want to use Nginx, check out this excellent guide from DigitalOcean: How To Deploy a Go Web Application Using Nginx on Ubuntu.
Enjoy!