librepages/docs/installation/bare-metal.md

2.9 KiB

Bare metal:

The process is tedious, most of this will be automated with a script in the future.

1. Create new user for running librepages:

sudo useradd -b /srv -m -s /usr/bin/zsh librepages

2. Install Runtime dependencies

  1. Nginx

On Debian-based systems, run:

sudo apt install nginx

3. Build librepages

i. Install Build Dependencies

To build librepages, you need the following dependencies:

  1. Git
  2. pkg-config
  3. GNU make
  4. libssl-dev
  5. Rust

To install all dependencies except Rust on Debian boxes, run:

sudo apt-get install -y git pkg-config libssl-dev

ii. Install Rust

Install Rust using rustup.

rustup is the official Rust installation tool. It enables installation of multiple versions of rustc for different architectures across multiple release channels(stable, nightly, etc.).

Rust undergoes six-week release cycles and some of the dependencies that are used in this program have often relied on cutting edge features of the Rust compiler. OS Distribution packaging teams don't often track the latest releases. For this reason, we encourage managing your Rust installation with rustup.

rustup is the officially supported Rust installation method of this project.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

iii. Build

$ make release

5. Install

Install binary and copy demo configuration file into default configuration lookup path(/etc/static-pages/config.toml)

sudo cp ./target/release/librepages /usr/local/bin/ && \
	sudo mkdir /etc/static-pages && \
	sudo cp config/default.toml /etc/static-pages/config.toml

4. Systemd service configuration:

i. Copy the following to /etc/systemd/system/librepages.service:

[Unit]
Description=librepages: Auto-deploy static websites from git repositories

[Service]
Type=simple
User=librepages
ExecStart=/usr/local/bin/librepages
Restart=on-failure
RestartSec=1
MemoryDenyWriteExecute=true
NoNewPrivileges=true
Environment="RUST_LOG=info"

[Unit]
Wants=network-online.target
Wants=network-online.target
After=syslog.target

[Install]
WantedBy=multi-user.target

ii. Enable and start service:

sudo systemctl daemon-reload && \
	sudo systemctl enable librepages && \ # Auto startup during boot
	sudo systemctl start librepages

5. Optionally configure Nginx to reverse proxy requests to LibrePages

NOTE: This sections includes instructions to reverse proxy requests to LibrePages API, not the websites managed by librepages.

See here for sample Nginx configuration.