~yerinalexey/gobin

ref: 262a5abe55470e6c214e84491a2086b01ce01f28 gobin/README.md -rw-r--r-- 1.6 KiB
262a5abe — Alexey Yerin docs: better configuration section, rm systemd 7 months ago

#GoBin

Simple self-hosted service for sharing text snippets

#Features

  • Totally anonymous, not even IP is logged
  • Dark theme by default
  • JavaScript-free
  • Easy to deploy

#Installation

Two basic requirements are Go compiler (unless you grab built binaries) and PostgreSQL database running.

#Database

Set DATABASE_URI environment variable to postgresql://-URI:

export DATABASE_URI=posgtresql://USER:PASSWORD@localhost/DB
  • USER is your username (postrges is default)
  • PASSWORD is your strong and complicated password
  • DB is your database name (make sure to run create database before running)

#Configuration

Configuration is done via environment variables:

  • PORT - change port on which application is running (default: 4000)
  • BASE_URL - base URL for permalinks, no trailing slash (default: http://localhost:4000)
  • TEMPLATE_ROOT - where templates are located (default: ./templates)
  • STATIC_ROOT - where static files are located (default: ./static)

Example:

export BASE_URL=https://somesite.dev
export PORT=80 # Note: you might need to run gobin as root

export TEMPLATE_ROOT=/usr/share/gobin/templates
export STATIC_ROOT=/usr/share/gobin/static

#Building

git clone https://git.sr.ht/~yerinalexey/gobin
cd gobin

go build

#Migrations

./gobin-migrate up

If something goes wrong, you can apply migrations manually by running up.sql files in subdirectories of ./migrations.

#Running

./gobin

It's also a good idea to run gobin binary as a system service. Make sure to provide all environment variables.