Go to file
2022-08-24 01:44:34 +02:00
build initial release 2022-07-13 13:30:27 -04:00
cmd initial release 2022-07-13 13:30:27 -04:00
db initial release 2022-07-13 13:30:27 -04:00
html Added link to the raw version of a post and removed link to the parent blog 2022-08-24 01:44:34 +02:00
internal chore: update wish 2022-07-13 23:37:17 -04:00
public Added link to the raw version of a post and removed link to the parent blog 2022-08-24 01:44:34 +02:00
.env.example docs: update readme 2022-07-13 23:40:10 -04:00
.gitignore initial release 2022-07-13 13:30:27 -04:00
Caddyfile initial release 2022-07-13 13:30:27 -04:00
docker-compose.yml initial release 2022-07-13 13:30:27 -04:00
Dockerfile initial release 2022-07-13 13:30:27 -04:00
Dockerfile.caddy initial release 2022-07-13 13:30:27 -04:00
go.mod chore: update wish 2022-07-13 23:37:17 -04:00
go.sum chore: update wish 2022-07-13 23:37:17 -04:00
LICENSE initial release 2022-07-13 13:30:27 -04:00
Makefile initial release 2022-07-13 13:30:27 -04:00
production.yml initial release 2022-07-13 13:30:27 -04:00
README.md docs: update readme 2022-07-13 23:40:10 -04:00

pastes.sh

A pastebin service for hackers.

comms

setup

  • golang v1.18

You'll also need some environment variables

export POSTGRES_PASSWORD="secret"
export DATABASE_URL="postgresql://postgres:secret@db/pastes?sslmode=disable"
export PASTES_SSH_PORT=2222
export PASTES_WEB_PORT=3000
export PASTES_DOMAIN="pastes.sh"
export PASTES_EMAIL="hello@pastes.sh"
export PASTES_PROTOCOL="http"

I just use direnv which will load my .env file.

development

db

I use docker-compose to standup a postgresql server. If you already have a server running you can skip this step.

Copy example .env

cp .env.example .env

Then run docker compose.

docker-compose up -d

Then create the database and migrate

make create
make migrate

build the apps

make build

run the apps

There are two apps: an ssh and web server.

./build/ssh

Default port for ssh server is 2222.

./build/web

Default port for web server is 3000.

subdomains

Since we use subdomains for blogs, you'll need to update your /etc/hosts file to accommodate.

# /etc/hosts
127.0.0.1 pastes.test
127.0.0.1 erock.pastes.test

Wildcards are not support in /etc/hosts so you'll have to add a subdomain for each blog in development. For this example you'll also want to change the domain env var to PASTES_DOMAIN=pastes.test.

deployment

I use docker-compose for deployment. First you need .env.prod.

cp .env.example .env.prod

The production.yml file in this repo uses my docker hub images for deployment.

docker-compose -f production.yml up -d

If you want to deploy using your own domain then you'll need to edit the Caddyfile with your domain.