Update 'docs/INSTALL.md'

Fix some styling stuff.
This commit is contained in:
Norm 2022-07-29 23:06:20 +00:00 committed by Francis Dinh
parent 9198ccb400
commit 617f064d61
Signed by untrusted user: norm
GPG key ID: 7123E30E441E80DE

View file

@ -1,32 +1,27 @@
FoundKey Setup and Installation Guide # FoundKey Setup and Installation Guide
================================================================
We thank you for your interest in setting up your FoundKey server! This guide will assume that you have administrative rights, either as root or a user with sudo permissions. If you are using a non-root user, prefix the commands with `sudo` except when you are logged into the foundkey user with `su`.
This guide describes how to install and setup FoundKey.
---------------------------------------------------------------- This guide will also assume you're using Debian or a derivative like Ubuntu. If you are using another OS, you will need to adapt the comamnds and package names to match those that your OS uses.
*1.* Create FoundKey user ## Create FoundKey user
----------------------------------------------------------------
Running FoundKey as root is not a good idea. Create a separate user to run FoundKey. Running FoundKey as root is not a good idea. Create a separate user to run FoundKey.
In debian for example:
```sh ```sh
adduser --disabled-password --disabled-login foundkey adduser --disabled-password --disabled-login foundkey
``` ```
*2.* Install dependencies ## Install dependencies
----------------------------------------------------------------
FoundKey requires the following packages to run: FoundKey requires the following packages to run:
### Dependencies :package: ### Dependencies :package:
* **[Node.js](https://nodejs.org/en/)** (16.x) * **[Node.js](https://nodejs.org/en/)** (16.x/18.x)
* **[PostgreSQL](https://www.postgresql.org/)** (12.x / 13.x is preferred) * **[PostgreSQL](https://www.postgresql.org/)** (12.x minimum; 13.x+ is preferred)
* **[Redis](https://redis.io/)** * **[Redis](https://redis.io/)**
The following are needed to compile native npm modules: The following are needed to compile native npm modules:
* A C/C++ compiler toolchain like **GCC** or **Clang**. * A C/C++ compiler like **GCC** or **Clang**
* Build tools like **make**
* **[Python](https://python.org/)** (3.x) * **[Python](https://python.org/)** (3.x)
### Optional ### Optional
@ -42,11 +37,9 @@ apt install build-essential python3 nodejs postgresql redis
apt install ffmpeg apt install ffmpeg
corepack enable # for yarn corepack enable # for yarn
``` ```
You will need to adapt this for whichever OS you are using to host FoundKey.
*3.* Install FoundKey ## Install FoundKey
---------------------------------------------------------------- 1. Login to the `foundkey` user
1. Connect to the `foundkey` user
`su - foundkey` `su - foundkey`
@ -62,8 +55,7 @@ You will need to adapt this for whichever OS you are using to host FoundKey.
`yarn install` `yarn install`
*4.* Configure FoundKey ## Configure FoundKey
----------------------------------------------------------------
1. Copy `.config/example.yml` to `.config/default.yml`. 1. Copy `.config/example.yml` to `.config/default.yml`.
`cp .config/example.yml .config/default.yml` `cp .config/example.yml .config/default.yml`
@ -72,8 +64,7 @@ You will need to adapt this for whichever OS you are using to host FoundKey.
- Make sure you set the PostgreSQL and Redis settings correctly. - Make sure you set the PostgreSQL and Redis settings correctly.
- Use a strong password for the PostgreSQL user and take note of it since it'll be needed later. - Use a strong password for the PostgreSQL user and take note of it since it'll be needed later.
*5.* Build FoundKey ## Build FoundKey
----------------------------------------------------------------
Build foundkey with the following: Build foundkey with the following:
@ -85,13 +76,10 @@ If you're still encountering errors about some modules, use node-gyp:
2. `npx node-gyp build` 2. `npx node-gyp build`
3. `NODE_ENV=production yarn build` 3. `NODE_ENV=production yarn build`
*6.* Init DB ## Setting up the database
---------------------------------------------------------------- Create the appropriate PostgreSQL users with respective passwords, and empty database as named in the configuration file.
1. Create the appropriate PostgreSQL users with respective passwords,
and empty database as named in the configuration file. Make sure the database connection also works correctly when run from the user that will later run FoundKey, or it could cause problems later. The encoding of the database should be UTF-8.
Make sure the database connection also works correctly when run from the
user that will later run FoundKey, or it could cause problems later.
The encoding of the database should be UTF-8.
```sh ```sh
sudo -u postgres psql sudo -u postgres psql
@ -104,19 +92,18 @@ grant all privileges on database foundkey to foundkey;
\q \q
``` ```
2. Run the database initialisation Next, initialize the database:
`yarn run init` `yarn run init`
*7.* Running FoundKey ## Running FoundKey
---------------------------------------------------------------- You can either run FoundKey manually or use the system service manager to start FoundKey automatically on startup.
Well done! Now, you can begin using FoundKey.
### Launching manually ### Launching manually
Run `NODE_ENV=production npm start` to launch FoundKey manually. To stop the server, use Ctrl-C. Run `NODE_ENV=production npm start` to launch FoundKey manually. To stop the server, use Ctrl-C.
### Launch with systemd ### Launch with systemd
1. Run `systemctl --edit --full --force foundkey.service`, and paste the following: Run `systemctl --edit --full --force foundkey.service`, and paste the following:
```ini ```ini
[Unit] [Unit]
@ -138,16 +125,16 @@ Restart=always
WantedBy=multi-user.target WantedBy=multi-user.target
``` ```
2. Save the file, then enable and start FoundKey. Save the file, then enable and start FoundKey.
```sh
`systemctl enable --now foundkey` systemctl enable --now foundkey
```
You can check if the service is running with `systemctl status foundkey`. You can check if the service is running with `systemctl status foundkey`.
### Launch with OpenRC ### Launch with OpenRC
1. Copy the following text to `/etc/init.d/foundkey`: Copy the following text to `/etc/init.d/foundkey`:
```sh ```sh
#!/sbin/openrc-run #!/sbin/openrc-run
@ -173,24 +160,40 @@ depend() {
} }
``` ```
2. Set the service to start on boot Mark the script as executable and enable the service to start on boot:
`rc-update add foundkey` ```sh
chmod +x /etc/init.d/foundkey
rc-update add foundkey
```
3. Start the FoundKey service Start the FoundKey service:
`rc-service foundkey start` ```sh
rc-service foundkey start
```
You can check if the service is running with `rc-service foundkey status`. You can check if the service is running with `rc-service foundkey status`.
### How to update your FoundKey server to the latest version ### Updating FoundKey
1. `git pull` Use git to pull in the latest changes and rerun the build and migration commands:
2. `git submodule update --init`
3. `yarn install` ```sh
4. `NODE_ENV=production yarn build` git pull
5. `yarn migrate` git submodule update --init
6. Restart your FoundKey process to apply changes yarn install
7. Enjoy NODE_ENV=production yarn build
yarn migrate
```
Then restart FoundKey if it's still running.
```sh
# Systemd
systemctl restart foundkey
# OpenRC
rc-service foundkey restart
```
If you encounter any problems with updating, please try the following: If you encounter any problems with updating, please try the following:
1. `yarn clean` or `yarn cleanall` 1. `yarn clean` or `yarn cleanall`
@ -198,4 +201,4 @@ If you encounter any problems with updating, please try the following:
---------------------------------------------------------------- ----------------------------------------------------------------
If you have any questions or troubles, feel free to contact us on IRC (`#foundkey` on `irc.akkoma.dev`, port `6697` with SSL)! If you have any questions or troubles, feel free to contact us on IRC: `#foundkey` on `irc.akkoma.dev`, port `6697` with SSL