Skip to content

Commit

Permalink
add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodlz committed Feb 7, 2024
1 parent 7825096 commit 3d31ba3
Showing 1 changed file with 46 additions and 2 deletions.
48 changes: 46 additions & 2 deletions doc/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Clone that application, and then proceed with the following instructions.

### On macOS

- Using [Homebrew](http://brew.sh/): `brew install supervisor nginx postgresql node`
- Using [Homebrew](http://brew.sh/): `brew install supervisor postgresql node`
- If you want to use [brotli compression](https://en.wikipedia.org/wiki/Brotli) with NGINX (better compression rates for the frontend), you can install NGINX with the `ngx_brotli` module with this command: `brew tap denji/nginx && brew install nginx-full --with-brotli`. *If you already had NGINX installed, you may need to uninstall it first with `brew unlink nginx`.*Otherwise, you can install NGINX normally with `brew install nginx`.
- Start the postgresql server:
- to start automatically at login: `brew services start postgresql`
- to start manually: `pg_ctl -D /usr/local/var/postgres start`
Expand All @@ -37,7 +38,50 @@ See [below](#configuration) for more information on modifying the baselayer conf
### On Linux
- Using `apt-get`:
`sudo apt-get install nginx supervisor postgresql libpq-dev npm nodejs-legacy`
`sudo apt-get install supervisor postgresql libpq-dev npm nodejs-legacy`

- If you want to run NGINX as is (without brotli), you can simply install it with `sudo apt-get install nginx`.
If want to use [brotli compression](https://en.wikipedia.org/wiki/Brotli) with NGINX (to have better compression rates for the frontend), you can install NGINX with the `ngx_brotli` module with these commands:

```
# install nginx from source so we can add the brotli module
git clone --recursive https://github.com/google/ngx_brotli.git
wget https://nginx.org/download/nginx-1.24.0.tar.gz
tar zxf nginx-1.24.0.tar.gz
cd ngx_brotli/deps/brotli
mkdir out && cd out
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_INSTALL_PREFIX=./installed ..
cmake --build . --config Release --target brotlienc
cd ../../../..
export CURRENT_DIR=$(pwd)
cd nginx-1.24.0
./configure --sbin-path=/usr/sbin/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-stream --with-mail=dynamic --with-http_realip_module --with-compat --add-module=${CURRENT_DIR}/ngx_brotli
sudo make && sudo make install
```
To run it as a service, create an Nginx systemd unit file by running `sudo nano /lib/systemd/system/nginx.service` and adding the following content:
```
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target

[Service]
Type=forking
PIDFile=/usr/local/nginx/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target
```
Then run `sudo systemctl start nginx` to start the server. To start it automatically at boot, run `sudo systemctl enable nginx`.
- It may be necessary to configure your database permissions: at
the end of your `pg_hba.conf` (typically in `/etc/postgresql/13.3/main` or `/var/lib/pgsql/data`),
add the following lines and restart PostgreSQL
Expand Down

0 comments on commit 3d31ba3

Please sign in to comment.