Installing kbin on Docker (as of early July)

Steps are valid for Ubuntu 22.04

Update and Upgrade Existing Packages

  • apt-get update && apt-get upgrade
  • reboot
  • apt autoremove

Create the kbin system user and give it a home directory

  • mkdir /opt/kbin
  • adduser –system –home /opt/kbin kbin
  • chown kbin /opt/kbin

Optional: install byobu so you can switch between kbin user and root user

If you don’t do this, then whenever I’m talking about root vs kbin you’ll need to switch in and out of impersonating kbin.

  • apt install byobu
  • byobu-enable
  • Close SSH session and re-open it
  • Use F8 to rename current screen to root
  • Press F2 to create a second screen and F8 to rename it to kbin
  • Use F3/F4 to navigate left and right between these

In the kbin screen:

  • sudo -u kbin bash
  • cd ~

This basically impersonates kbin and brings you to its home which is /opt/kbin

Install dependencies and suchIn the root screen:

  • curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt-get install -y nodejs

This installs nodejs and npm - no need to install npm separately

You should check https://github.com/nodesource/distributions#debinstall to see whether there is a later version

  • npm install –global yarn
  • sudo apt-get install git

Download kbin and begin setting up

In the kbin screen:

  • git clone https://codeberg.org/Kbin/kbin-core.git
  • cd kbin-core
  • mkdir public/media

In the root screen:

  • cd /opt/kbin/kbin-core
  • sudo chown 82:82 public/media
  • sudo chmod -R go+rx public/media/
  • cp .env.example .env

Edit .env

If you are using an SSH client like mobaXterm you can just double click it to open, else you can use either vim or nano like:

  • Option 1: vi .env # esc + !q + enter to exit
  • Option 2: nano .env

Some things you will want to check and possibly edit:

  • SERVER_NAME: This is your domain name (which you have presumably already purchased and is pointing to your server). Leave the caddy:80 alone, that needs to be there

  • KBIN_DOMAIN: Your domain name

  • KBIN_FEDERATION_ENABLED: probably want to leave this as true unless you are going full isolated instance

  • KBIN_REGISTRATIONS_ENABLED: I am not providing any instructions on email setup etc - if you want open registrations, you will have to sort some of that out.

  • KBIN_STORAGE_URL: this should be your.domain.name/media – the example says media.your.domain.name but I found this did not work correctly in relation to the SSL certificate, so instead use /media

  • REDIS_PASSWORD: set a new password

  • POSTGRES_PASSWORD: set a new password

  • RABBITMQ_PASSWORD: set a new password

  • CABBY_MERCURE_URL: set this to your own domain name + /.well-known/mercure

  • CADDY_MERCURE_JWT_SECRET: set a new secret, this has to be 32 characters long

Once you are done editing .env, have saved it and exited it,

  • sudo chown kbin .env