Skip to content

Self hosting

Kainoa Kanter edited this page Apr 8, 2022 · 6 revisions

Docker

πŸ‹ Docker is coming soon:tm:

Requirements

Steps

  1. Clone the repo
git clone https://github.com/zer0bin-dev/zer0bin
cd zer0bin
  1. Edit example.nginx to fit your domain and location

(Instructions are inside the file)

  1. Add the nginx config to nginx
mv example.nginx yourdomain.tld
sudo cp ./yourdomain.tld /etc/nginx/sites-available
sudo cp ./yourdomain.tld /etc/nginx/sites-enabled
sudo nginx -t # Make sure everything's ok
systemctl nginx restart # Or whichever process manager you use
  1. Prepare config.json
cd frontend
cp config.example.json config.json
  1. Configure frontend by editing config.json
Key Values Description
api_url API URL The URL of the API
confetti_chance Number β‰₯ 1 The chance of confetti showing on save
Run mv style/font-fira.scss style/font.scss if you would like to replace Cartograph CF with Fira Code
  1. Build frontend
yarn
yarn run build
  1. Apply database schema and prepare config.json
cd ../backend
psql -f schema.sql -U postgres zer0bin
cp config.example.json config.json
  1. Configure backend by editing config.json
Key Values Description
server.backend_host 127.0.0.1 or 0.0.0.0 The host to run the backend on
server.backend_port Any open port The port to run the backend on
pastes.character_limit Number up to 2^64 - 1 The amount of characters allowed in a single paste
pastes.days_til_expiration Number up to 2^63 or -1 The days till a paste is to expire. If set to -1 then pastes will never expire
pastes.id_length Number up to 2^64 - 1 The length of the ID for each paste
databases.postgres_uri PostreSQL Connection URI The URI to use when connecting to a PostgreSQL database
ratelimits.seconds_in_between_pastes Number up to 2^64 - 1 The seconds between paste uploads
ratelimits.allowed_pastes_before_ratelimit Number up to 2^32 - 1 Amount of requests that can be made before they are blocked and have to wait
logging.on_post_paste true or false Log on new paste is made
logging.on_get_paste true or false Log on paste get
  1. Build and run!
cargo build --release
# tmux
./target/release/zer0bin-bin # In a tmux/multiplexer session or as a service