2022-03-31 16:40:54 +05:30
|
|
|
# Bare metal:
|
|
|
|
|
|
|
|
The process is tedious, most of this will be automated with a script in
|
|
|
|
the future.
|
|
|
|
|
2022-12-19 06:32:51 +05:30
|
|
|
## 1. Create new user for running `librepages`:
|
2022-03-31 16:40:54 +05:30
|
|
|
|
|
|
|
```bash
|
2022-12-19 06:32:51 +05:30
|
|
|
sudo useradd -b /srv -m -s /usr/bin/zsh librepages
|
2022-03-31 16:40:54 +05:30
|
|
|
```
|
|
|
|
|
|
|
|
## 2. Install Runtime dependencies
|
|
|
|
|
|
|
|
1. [Nginx](https://packages.debian.org/bullseye/nginx)
|
|
|
|
|
|
|
|
On Debian-based systems, run:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo apt install nginx
|
|
|
|
```
|
|
|
|
|
2022-12-19 06:32:51 +05:30
|
|
|
## 3. Build `librepages`
|
2022-03-31 16:40:54 +05:30
|
|
|
|
|
|
|
### i. Install Build Dependencies
|
|
|
|
|
2022-12-19 06:32:51 +05:30
|
|
|
To build `librepages`, you need the following dependencies:
|
2022-03-31 16:40:54 +05:30
|
|
|
|
|
|
|
1. [Git](https://packages.debian.org/bullseye/git)
|
|
|
|
2. [pkg-config](https://packages.debian.org/bullseye/pkg-config)
|
|
|
|
3. [GNU make](https://packages.debian.org/bullseye/make)
|
|
|
|
4. [libssl-dev](https://packages.debian.org/bullseye/libssl-dev)
|
|
|
|
5. Rust
|
|
|
|
|
|
|
|
To install all dependencies **except Rust** on Debian boxes, run:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo apt-get install -y git pkg-config libssl-dev
|
|
|
|
```
|
|
|
|
|
|
|
|
### ii. Install Rust
|
|
|
|
|
|
|
|
Install Rust using [rustup](https://rustup.rs/).
|
|
|
|
|
|
|
|
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](https://doc.rust-lang.org/book/appendix-05-editions.html#appendix-e---editions)
|
|
|
|
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.**
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
|
|
```
|
|
|
|
|
|
|
|
### iii. Build
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ make release
|
|
|
|
```
|
|
|
|
|
|
|
|
## 5. Install
|
|
|
|
|
|
|
|
Install binary and copy demo configuration file into default configuration
|
|
|
|
lookup path(`/etc/static-pages/config.toml`)
|
|
|
|
|
|
|
|
```bash
|
2022-12-19 06:32:51 +05:30
|
|
|
sudo cp ./target/release/librepages /usr/local/bin/ && \
|
2022-03-31 16:40:54 +05:30
|
|
|
sudo mkdir /etc/static-pages && \
|
|
|
|
sudo cp config/default.toml /etc/static-pages/config.toml
|
|
|
|
```
|
|
|
|
|
|
|
|
## 4. Systemd service configuration:
|
|
|
|
|
2022-12-19 06:32:51 +05:30
|
|
|
### i. Copy the following to `/etc/systemd/system/librepages.service`:
|
2022-03-31 16:40:54 +05:30
|
|
|
|
|
|
|
```systemd
|
|
|
|
[Unit]
|
2022-12-19 06:32:51 +05:30
|
|
|
Description=librepages: Auto-deploy static websites from git repositories
|
2022-03-31 16:40:54 +05:30
|
|
|
|
|
|
|
[Service]
|
|
|
|
Type=simple
|
2022-12-19 06:32:51 +05:30
|
|
|
User=librepages
|
|
|
|
ExecStart=/usr/local/bin/librepages
|
2022-03-31 16:40:54 +05:30
|
|
|
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:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo systemctl daemon-reload && \
|
2022-12-19 06:32:51 +05:30
|
|
|
sudo systemctl enable librepages && \ # Auto startup during boot
|
|
|
|
sudo systemctl start librepages
|
2022-03-31 16:40:54 +05:30
|
|
|
```
|
|
|
|
|
2022-12-19 06:32:51 +05:30
|
|
|
## 5. Optionally configure Nginx to reverse proxy requests to LibrePages
|
2022-03-31 16:40:54 +05:30
|
|
|
|
|
|
|
**NOTE: This sections includes instructions to reverse proxy requests to
|
2022-12-19 06:32:51 +05:30
|
|
|
LibrePages API, not the websites managed by librepages.**
|
2022-03-31 16:40:54 +05:30
|
|
|
|
2022-12-19 06:32:51 +05:30
|
|
|
See [here](../../config/librepages-nginx-config) for sample Nginx configuration.
|