~yerinalexey/gobin

gobin/README.md -rw-r--r-- 1.8 KiB
0b93da80Alexey Yerin gobin-migrate: use tr to cut off quotes and space 6 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 (not really but much easier than paste.sr.ht)

#Installation

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

#Configuration

Copy config.example.toml to config.toml (or whatever you want) and edit to your liking. All fields are required.

# Postgres database URI to connect to
#
# Formats: https://www.postgresql.org/docs/13/libpq-connect.html#LIBPQ-CONNSTRING
#
# Using a URI:
databaseUri = "postgres://postgres:qqqq@localhost/gobin"
# The same with keyword=value connection strings:
#databaseUri = "host=localhost user=postgres password=qqqq dbname=gobin"

# On which port the application runs
#
# If the port is <1024, you need to run gobin as root because such ports
# are priviliged
port = 4000

# Directories for static assets and templates, relative to where you're
# launching gobin from
templateRoot = "./templates"
staticRoot = "./static"

# Assume http:// on permalinks, setting this to true is not recommended
# in production environments
#insecure = true
insecure = false

#Building

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

go build

#Migrations

./gobin-migrate up

or

./gobin-migrate -c /etc/whatever.toml up

Warning: TOML parser in gobin-migrate is too simple and will not handle all cases.

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

#Running

./gobin

or

./gobin -config /etc/whatever.toml    # if you have a config file in different place

It's also a good idea to run gobin binary as a system service.