Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 2.08 KB

build.md

File metadata and controls

29 lines (21 loc) · 2.08 KB

How to build and host the Chatterino 2 API

Prerequisites

  1. Resolved links are stored in PostgreSQL, so you must have PostgreSQL installed and accessible for the user running the API. For Ubuntu, you would install it with sudo apt install postgresql, create a DB user for your system user (sudo -upostgres createuser pajlada), then create a db for the api (sudo -upostgres createdb chatterino-api --owner pajlada). Make sure to edit dsn in your configuration. Example, using the details above, dsn:"host=/var/run/postgresql user=pajlada database=chatterino-api".

  2. You must have libvips >=8.12.0 installed for thumbnail generation.

    On Ubuntu 22.04, this can be done with sudo apt install libvips libvips-dev. Different distros or releases may require adding a PPA or building and installing from source.

    For Windows when getting the Windows binaries from the libvips link above make sure to get the ones suffixed with "-static". Install pkg-config via choco choco upgrade -y pkgconfiglite and setup the following environment variables: VIPS_PATH to the directory where vips-dev is downloaded and extracted, PKG_CONFIG_PATH to %VIPS_PATH%\lib\pkgconfig and append %VIPS_PATH%\bin to your Path environment variable.

Build

  1. Clone the repo: git pull https://github.com/Chatterino/api.git
  2. Move into the directory, fetch the dependencies and build the binary: cd api && make build
  3. Edit API's configuration, see configuration
  4. Start the API: ./cmd/api/api

Install systemd unit

  1. Install the pre-packaged systemd unit file: sudo cp ./docs/chatterino-api.service /etc/systemd/system/
  2. Use your preferred editor to edit the service file with all the necessary details (incl. API keys): sudo editor /etc/systemd/system/chatterino-api.service
  3. Tell systemd to reload the changes: sudo systemctl daemon-reload
  4. Start the service and enable to start on boot: sudo systemctl enable --now chatterino-api