valueof / bland

Self-hosted bookmarks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bland

It's like del.icio.us of the past but you can host it yourself!

Screenshot of Bland, from October 22nd, 2022

Quick Start

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.

Development

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

Optional

Import from Pinboard

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

Run Bland in the background

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.

On Ubuntu Linux

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!

About

Self-hosted bookmarks


Languages

Language:Go 73.3%Language:HTML 13.1%Language:JavaScript 6.8%Language:CSS 6.3%Language:Makefile 0.4%