~yerinalexey/gobin

ref: bd11785bc2e7db79dc215dbf67bcd58d7ab3f266 gobin/README.md -rw-r--r-- 1.3 KiB
bd11785b — Alexey Yerin perf(migrate): select only name for migrations 11 months ago

#GoBin

Simple self-hosted service for sharing text snippets

#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

Replace USER with your username (postrges is default), PASSWORD with your strong and complicated password and DB with database name (make sure to run create database).

#Configuration

If you want to change port on which application is running, set PORT environment variable (4000 is default).

If your application is hosted not on localhost, you should change BASE_URL environment variable to http:// or https:// + your domain (e.g. https://somesite.dev)

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

#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.