Bare Metal

Self-host Hook0 on bare metal servers

External Services

Make sure you have access to:

  • a PostgreSQL 15+ database (it might work with an early version)

Clone the repository

git clone https://gitlab.com/hook0/hook0
cd hook0

Build Hook0 UI

You must to have Node.js LTS installed (and npm).

Building Hook0 UI requires the following environment variables:

API_ENDPOINTBase URL of the API (example: https://app.hook0.com/api/v1)

You need to define and export these variables in your shell before you continue.

cd frontend
npm ci
npm run build
cd ..

📘

In this guide we will assume that the Hook0 API web sever is going to serve Hook0 UI (this is simpler), but you can serve it separately as it is just a static web application.

Build Hook0 API

You need to have Rust stable installed.

cd api
SQLX_OFFLINE=true cargo build --release
cd ..

This will create the target/release/hook0-api executable.

This executable is a web server: when you run it, it will bind to an IP address and port (by default: 127.0.0.1:8080).

📘

Configuration

A lot of configuration options are available, and some of them are mandatory. Each option can be set using either a CLI parameter or an environment variable.

To see the list of options and their descriptions, run ./target/release/hook0-api --help.

Configuration options

  • --no-default-features --features reqwest-rustls-tls-native-roots: ensure that all outgoing HTTPS requests are validated using your OS certificate store

❗️

Hook0 API uses the env_logger crate to manage its log output. You should make sure you have defined a RUST_LOG=info,sqlx=warn,actix_governor=warn environment variable before running it in order to see some log output.

Build Hook0 Output Worker

Prerequisites, building and configuration of Hook0 Output Worker are very similar to those of Hook0 API.

cd output-worker
SQLX_OFFLINE=true cargo build --release
cd ..

This will create the target/release/hook0-output-worker executable.

You can run multiple workers so that they share the work.

Configuration options

  • --no-default-features --features reqwest-rustls-tls-native-roots: ensure that all outgoing HTTPS requests are validated using your OS certificate store.