From e28606e8597eebc63b596728e002bad35aa65b8c Mon Sep 17 00:00:00 2001 From: Norm Date: Fri, 29 Jul 2022 05:57:40 +0000 Subject: [PATCH 01/10] Add 'docs/INSTALL.md' --- docs/INSTALL.md | 198 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 docs/INSTALL.md diff --git a/docs/INSTALL.md b/docs/INSTALL.md new file mode 100644 index 000000000..cd890e402 --- /dev/null +++ b/docs/INSTALL.md @@ -0,0 +1,198 @@ +Misskey Setup and Installation Guide +================================================================ + +We thank you for your interest in setting up your Misskey server! +This guide describes how to install and setup Misskey. + +---------------------------------------------------------------- + +*1.* Create Misskey user +---------------------------------------------------------------- +Running misskey as root is not a good idea so we create a user for that. +In debian for exemple : + +```sh +adduser --disabled-password --disabled-login misskey +``` + +*2.* Install dependencies +---------------------------------------------------------------- +Please install and setup these softwares: + +#### Dependencies :package: +* **[Node.js](https://nodejs.org/en/)** (16.x) +* **[PostgreSQL](https://www.postgresql.org/)** (12.x / 13.x is preferred) +* **[Redis](https://redis.io/)** + +##### Optional +* [Yarn](https://yarnpkg.com/) *Optional but recommended for security reason. If you won't install it, use `npx yarn` instead of `yarn`.* +* [FFmpeg](https://www.ffmpeg.org/) + +*3.* Install Misskey +---------------------------------------------------------------- +1. Connect to the `misskey` user + + `su - misskey` + +2. Clone the Misskey repository + + `git clone --recursive https://github.com/misskey-dev/misskey.git` + +3. Navigate to the repository + + `cd misskey` + +4. Check out the [latest release](https://github.com/misskey-dev/misskey/releases/latest) + + `git checkout master` + +5. Install Misskey's dependencies + + `yarn install` + +*4.* Configure Misskey +---------------------------------------------------------------- +1. Copy the `.config/example.yml` and rename it to `default.yml`. + + `cp .config/example.yml .config/default.yml` + +2. Edit `default.yml` + +*5.* Build Misskey +---------------------------------------------------------------- + +Build misskey with the following: + +`NODE_ENV=production yarn build` + +If you're on Debian, you will need to install the `build-essential`, `python` package. + +If you're still encountering errors about some modules, use node-gyp: + +1. `npx node-gyp configure` +2. `npx node-gyp build` +3. `NODE_ENV=production yarn build` + +*6.* Init DB +---------------------------------------------------------------- +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 Misskey, or it could cause problems later. + The encoding of the database should be UTF-8. + + ``` + sudo -u postgres psql + create database misskey with encoding = 'UTF8'; + create user misskey with encrypted password '{YOUR_PASSWORD}'; + grant all privileges on database misskey to misskey; + \q + ``` + +2. Run the database initialisation + `yarn run init` + +*7.* That is it. +---------------------------------------------------------------- +Well done! Now, you have an environment that run to Misskey. + +### Launch normally +Just `NODE_ENV=production npm start`. GLHF! + +### Launch with systemd + +1. Create a systemd service here + + `/etc/systemd/system/misskey.service` + +2. Edit it, and paste this and save: + + ::: details + ``` + [Unit] + Description=Misskey daemon + + [Service] + Type=simple + User=misskey + ExecStart=/usr/bin/npm start + WorkingDirectory=/home/misskey/misskey + Environment="NODE_ENV=production" + TimeoutSec=60 + StandardOutput=syslog + StandardError=syslog + SyslogIdentifier=misskey + Restart=always + + [Install] + WantedBy=multi-user.target + ``` + ::: + +3. Reload systemd and enable the misskey service. + + `systemctl daemon-reload ; systemctl enable misskey` + +4. Start the misskey service. + + `systemctl start misskey` + +You can check if the service is running with `systemctl status misskey`. + +### Launch with OpenRC + +1. Copy the following text to `/etc/init.d/misskey`: + + ::: details + ```sh + #!/sbin/openrc-run + + name=misskey + description="Misskey daemon" + + command="/usr/bin/npm" + command_args="start" + command_user="misskey" + + supervisor="supervise-daemon" + supervise_daemon_args=" -d /home/misskey/misskey -e NODE_ENV=\"production\"" + + pidfile="/run/${RC_SVCNAME}.pid" + + depend() { + need net + use logger + + # alternatively, uncomment if using nginx reverse proxy + #use logger nginx + } + ``` + ::: + +2. Set the service to start on boot + + `rc-update add misskey` + +3. Start the Misskey service + + `rc-service misskey start` + +You can check if the service is running with `rc-service misskey status`. + +### How to update your Misskey server to the latest version +1. `git checkout master` +2. `git pull` +3. `git submodule update --init` +4. `yarn install` +5. `NODE_ENV=production yarn build` +6. `yarn migrate` +7. Restart your Misskey process to apply changes +8. Enjoy + +If you encounter any problems with updating, please try the following: +1. `yarn clean` or `yarn cleanall` +2. Retry update (Don't forget `yarn install` + +---------------------------------------------------------------- + +If you have any questions or troubles, feel free to contact us! \ No newline at end of file From 2261958670d9145e189fc30e4e43fe4d5893536a Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Fri, 29 Jul 2022 02:09:26 -0400 Subject: [PATCH 02/10] Update INSTALL.md for FoundKey --- docs/INSTALL.md | 122 +++++++++++++++++++++++------------------------- 1 file changed, 59 insertions(+), 63 deletions(-) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index cd890e402..7d4bbd078 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -1,23 +1,23 @@ -Misskey Setup and Installation Guide +FoundKey Setup and Installation Guide ================================================================ -We thank you for your interest in setting up your Misskey server! -This guide describes how to install and setup Misskey. +We thank you for your interest in setting up your FoundKey server! +This guide describes how to install and setup FoundKey. ---------------------------------------------------------------- -*1.* Create Misskey user +*1.* Create FoundKey user ---------------------------------------------------------------- -Running misskey as root is not a good idea so we create a user for that. +Running FoundKey as root is not a good idea. Create a separate user to run FoundKey. In debian for exemple : ```sh -adduser --disabled-password --disabled-login misskey +adduser --disabled-password --disabled-login foundkey ``` *2.* Install dependencies ---------------------------------------------------------------- -Please install and setup these softwares: +FoundKey requires the following packages to run: #### Dependencies :package: * **[Node.js](https://nodejs.org/en/)** (16.x) @@ -25,32 +25,28 @@ Please install and setup these softwares: * **[Redis](https://redis.io/)** ##### Optional -* [Yarn](https://yarnpkg.com/) *Optional but recommended for security reason. If you won't install it, use `npx yarn` instead of `yarn`.* +* [Yarn](https://yarnpkg.com/) - *Optional but recommended for security reasons. If you won't install it, use `npx yarn` instead of `yarn`.* * [FFmpeg](https://www.ffmpeg.org/) -*3.* Install Misskey +*3.* Install FoundKey ---------------------------------------------------------------- -1. Connect to the `misskey` user +1. Connect to the `foundkey` user - `su - misskey` + `su - foundkey` -2. Clone the Misskey repository +2. Clone the FoundKey repository - `git clone --recursive https://github.com/misskey-dev/misskey.git` + `git clone --recursive https://akkoma.dev/FoundKeyGang/FoundKey` 3. Navigate to the repository - `cd misskey` + `cd foundkey` -4. Check out the [latest release](https://github.com/misskey-dev/misskey/releases/latest) - - `git checkout master` - -5. Install Misskey's dependencies +4. Install FoundKey's dependencies `yarn install` -*4.* Configure Misskey +*4.* Configure FoundKey ---------------------------------------------------------------- 1. Copy the `.config/example.yml` and rename it to `default.yml`. @@ -58,10 +54,10 @@ Please install and setup these softwares: 2. Edit `default.yml` -*5.* Build Misskey +*5.* Build FoundKey ---------------------------------------------------------------- -Build misskey with the following: +Build foundkey with the following: `NODE_ENV=production yarn build` @@ -78,14 +74,17 @@ If you're still encountering errors about some modules, use node-gyp: 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 Misskey, or it could cause problems later. + user that will later run FoundKey, or it could cause problems later. The encoding of the database should be UTF-8. - ``` + ```sh sudo -u postgres psql - create database misskey with encoding = 'UTF8'; - create user misskey with encrypted password '{YOUR_PASSWORD}'; - grant all privileges on database misskey to misskey; + ``` + + ```sql + create database foundkey with encoding = 'UTF8'; + create user foundkey with encrypted password '{YOUR_PASSWORD}'; + grant all privileges on database foundkey to foundkey; \q ``` @@ -94,7 +93,7 @@ If you're still encountering errors about some modules, use node-gyp: *7.* That is it. ---------------------------------------------------------------- -Well done! Now, you have an environment that run to Misskey. +Well done! Now, you can begin using FoundKey. ### Launch normally Just `NODE_ENV=production npm start`. GLHF! @@ -103,59 +102,58 @@ Just `NODE_ENV=production npm start`. GLHF! 1. Create a systemd service here - `/etc/systemd/system/misskey.service` + `/etc/systemd/system/foundkey.service` 2. Edit it, and paste this and save: - ::: details - ``` + + ```ini [Unit] - Description=Misskey daemon + Description=FoundKey daemon [Service] Type=simple - User=misskey + User=foundkey ExecStart=/usr/bin/npm start - WorkingDirectory=/home/misskey/misskey + WorkingDirectory=/home/foundkey/foundkey Environment="NODE_ENV=production" TimeoutSec=60 StandardOutput=syslog StandardError=syslog - SyslogIdentifier=misskey + SyslogIdentifier=foundkey Restart=always [Install] WantedBy=multi-user.target ``` - ::: + -3. Reload systemd and enable the misskey service. +3. Reload systemd and enable the foundkey service. - `systemctl daemon-reload ; systemctl enable misskey` + `systemctl daemon-reload ; systemctl enable foundkey` -4. Start the misskey service. +4. Start the foundkey service. - `systemctl start misskey` + `systemctl start foundkey` -You can check if the service is running with `systemctl status misskey`. +You can check if the service is running with `systemctl status foundkey`. ### Launch with OpenRC -1. Copy the following text to `/etc/init.d/misskey`: +1. Copy the following text to `/etc/init.d/foundkey`: - ::: details ```sh #!/sbin/openrc-run - name=misskey - description="Misskey daemon" + name=foundkey + description="FoundKey daemon" command="/usr/bin/npm" command_args="start" - command_user="misskey" + command_user="foundkey" supervisor="supervise-daemon" - supervise_daemon_args=" -d /home/misskey/misskey -e NODE_ENV=\"production\"" + supervise_daemon_args=" -d /home/foundkey/foundkey -e NODE_ENV=\"production\"" pidfile="/run/${RC_SVCNAME}.pid" @@ -167,32 +165,30 @@ You can check if the service is running with `systemctl status misskey`. #use logger nginx } ``` - ::: 2. Set the service to start on boot - `rc-update add misskey` + `rc-update add foundkey` -3. Start the Misskey service +3. Start the FoundKey service - `rc-service misskey start` + `rc-service foundkey start` -You can check if the service is running with `rc-service misskey status`. +You can check if the service is running with `rc-service foundkey status`. -### How to update your Misskey server to the latest version -1. `git checkout master` -2. `git pull` -3. `git submodule update --init` -4. `yarn install` -5. `NODE_ENV=production yarn build` -6. `yarn migrate` -7. Restart your Misskey process to apply changes -8. Enjoy +### How to update your FoundKey server to the latest version +1. `git pull` +2. `git submodule update --init` +3. `yarn install` +4. `NODE_ENV=production yarn build` +5. `yarn migrate` +6. Restart your FoundKey process to apply changes +7. Enjoy If you encounter any problems with updating, please try the following: 1. `yarn clean` or `yarn cleanall` -2. Retry update (Don't forget `yarn install` +2. Retry update (Don't forget `yarn install`) ---------------------------------------------------------------- -If you have any questions or troubles, feel free to contact us! \ No newline at end of file +If you have any questions or troubles, feel free to contact us on [IRC](ircs://irc.akkoma.dev:6697/#foundkey) (`#foundkey` on `irc.akkoma.dev`, port `6697` with SSL)! From 8e30c86a9a896b157263274e6d8157b2cd4869a6 Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Fri, 29 Jul 2022 02:10:19 -0400 Subject: [PATCH 03/10] Remove non-working IRC link --- docs/INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 7d4bbd078..c15b785de 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -191,4 +191,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](ircs://irc.akkoma.dev:6697/#foundkey) (`#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)! From c4415e9af353e44b2703425396200db9ec042f68 Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Fri, 29 Jul 2022 02:12:30 -0400 Subject: [PATCH 04/10] Fix formatting --- docs/INSTALL.md | 88 ++++++++++++++++++++++++------------------------- 1 file changed, 43 insertions(+), 45 deletions(-) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index c15b785de..45efe3de5 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -77,16 +77,16 @@ If you're still encountering errors about some modules, use node-gyp: user that will later run FoundKey, or it could cause problems later. The encoding of the database should be UTF-8. - ```sh - sudo -u postgres psql - ``` +```sh +sudo -u postgres psql +``` - ```sql - create database foundkey with encoding = 'UTF8'; - create user foundkey with encrypted password '{YOUR_PASSWORD}'; - grant all privileges on database foundkey to foundkey; - \q - ``` +```sql +create database foundkey with encoding = 'UTF8'; +create user foundkey with encrypted password '{YOUR_PASSWORD}'; +grant all privileges on database foundkey to foundkey; +\q +``` 2. Run the database initialisation `yarn run init` @@ -106,27 +106,25 @@ Just `NODE_ENV=production npm start`. GLHF! 2. Edit it, and paste this and save: - - ```ini - [Unit] - Description=FoundKey daemon +```ini +[Unit] +Description=FoundKey daemon - [Service] - Type=simple - User=foundkey - ExecStart=/usr/bin/npm start - WorkingDirectory=/home/foundkey/foundkey - Environment="NODE_ENV=production" - TimeoutSec=60 - StandardOutput=syslog - StandardError=syslog - SyslogIdentifier=foundkey - Restart=always +[Service] +Type=simple +User=foundkey +ExecStart=/usr/bin/npm start +WorkingDirectory=/home/foundkey/foundkey +Environment="NODE_ENV=production" +TimeoutSec=60 +StandardOutput=syslog +StandardError=syslog +SyslogIdentifier=foundkey +Restart=always - [Install] - WantedBy=multi-user.target - ``` - +[Install] +WantedBy=multi-user.target +``` 3. Reload systemd and enable the foundkey service. @@ -142,29 +140,29 @@ You can check if the service is running with `systemctl status foundkey`. 1. Copy the following text to `/etc/init.d/foundkey`: - ```sh - #!/sbin/openrc-run +```sh +#!/sbin/openrc-run - name=foundkey - description="FoundKey daemon" +name=foundkey +description="FoundKey daemon" - command="/usr/bin/npm" - command_args="start" - command_user="foundkey" +command="/usr/bin/npm" +command_args="start" +command_user="foundkey" - supervisor="supervise-daemon" - supervise_daemon_args=" -d /home/foundkey/foundkey -e NODE_ENV=\"production\"" +supervisor="supervise-daemon" +supervise_daemon_args=" -d /home/foundkey/foundkey -e NODE_ENV=\"production\"" - pidfile="/run/${RC_SVCNAME}.pid" +pidfile="/run/${RC_SVCNAME}.pid" - depend() { - need net - use logger +depend() { + need net + use logger - # alternatively, uncomment if using nginx reverse proxy - #use logger nginx - } - ``` + # alternatively, uncomment if using nginx reverse proxy + #use logger nginx +} +``` 2. Set the service to start on boot From 7a39c74a7801bac10ebe3b6d86fef995042cb114 Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Fri, 29 Jul 2022 02:22:00 -0400 Subject: [PATCH 05/10] Add dependency install example for Debian --- docs/INSTALL.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 45efe3de5..b8c4433a1 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -23,11 +23,23 @@ FoundKey requires the following packages to run: * **[Node.js](https://nodejs.org/en/)** (16.x) * **[PostgreSQL](https://www.postgresql.org/)** (12.x / 13.x is preferred) * **[Redis](https://redis.io/)** +* A C/C++ compiler toolchain like **GCC** or **Clang**. ##### Optional * [Yarn](https://yarnpkg.com/) - *Optional but recommended for security reasons. If you won't install it, use `npx yarn` instead of `yarn`.* * [FFmpeg](https://www.ffmpeg.org/) +To install the dependiencies on Debian (or derivatives like Ubuntu) you can use the following commands: +```sh +curl -fsSL https://deb.nodesource.com/setup_16.x | bash - +apt install build-essential nodejs postgresql redis + +# Optional dependencies +apt install ffmpeg +corepack enable # for yarn +``` +Other OSes will have different package names and package managers to install the dependencies. + *3.* Install FoundKey ---------------------------------------------------------------- 1. Connect to the `foundkey` user From 58fafc121fe9632a1fcd73d279f6d3dbf90f0bf1 Mon Sep 17 00:00:00 2001 From: Norm Date: Fri, 29 Jul 2022 06:29:45 +0000 Subject: [PATCH 06/10] Add python to dependencies Needed for some node-gyp packages --- docs/INSTALL.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index b8c4433a1..73ab169ee 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -24,6 +24,7 @@ FoundKey requires the following packages to run: * **[PostgreSQL](https://www.postgresql.org/)** (12.x / 13.x is preferred) * **[Redis](https://redis.io/)** * A C/C++ compiler toolchain like **GCC** or **Clang**. +* **[Python](https://python.org/)** (3.x) ##### Optional * [Yarn](https://yarnpkg.com/) - *Optional but recommended for security reasons. If you won't install it, use `npx yarn` instead of `yarn`.* @@ -32,7 +33,7 @@ FoundKey requires the following packages to run: To install the dependiencies on Debian (or derivatives like Ubuntu) you can use the following commands: ```sh curl -fsSL https://deb.nodesource.com/setup_16.x | bash - -apt install build-essential nodejs postgresql redis +apt install build-essential python nodejs postgresql redis # Optional dependencies apt install ffmpeg @@ -73,8 +74,6 @@ Build foundkey with the following: `NODE_ENV=production yarn build` -If you're on Debian, you will need to install the `build-essential`, `python` package. - If you're still encountering errors about some modules, use node-gyp: 1. `npx node-gyp configure` From 648b2e9f961dfe6e68673a5dd402f272c7c6b9f2 Mon Sep 17 00:00:00 2001 From: Norm Date: Fri, 29 Jul 2022 06:31:48 +0000 Subject: [PATCH 07/10] Use correct python package name --- docs/INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 73ab169ee..3dd5d2a17 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -33,7 +33,7 @@ FoundKey requires the following packages to run: To install the dependiencies on Debian (or derivatives like Ubuntu) you can use the following commands: ```sh curl -fsSL https://deb.nodesource.com/setup_16.x | bash - -apt install build-essential python nodejs postgresql redis +apt install build-essential python3 nodejs postgresql redis # Optional dependencies apt install ffmpeg From 9198ccb400baa87b791328bed3f990768f4488fa Mon Sep 17 00:00:00 2001 From: Norm Date: Fri, 29 Jul 2022 20:00:31 +0000 Subject: [PATCH 08/10] Use more neutral language and more concise steps. --- docs/INSTALL.md | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 3dd5d2a17..b534ba50a 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -9,7 +9,8 @@ This guide describes how to install and setup FoundKey. *1.* Create FoundKey user ---------------------------------------------------------------- Running FoundKey as root is not a good idea. Create a separate user to run FoundKey. -In debian for exemple : + +In debian for example: ```sh adduser --disabled-password --disabled-login foundkey @@ -19,15 +20,17 @@ adduser --disabled-password --disabled-login foundkey ---------------------------------------------------------------- FoundKey requires the following packages to run: -#### Dependencies :package: +### Dependencies :package: * **[Node.js](https://nodejs.org/en/)** (16.x) * **[PostgreSQL](https://www.postgresql.org/)** (12.x / 13.x is preferred) * **[Redis](https://redis.io/)** + +The following are needed to compile native npm modules: * A C/C++ compiler toolchain like **GCC** or **Clang**. * **[Python](https://python.org/)** (3.x) -##### Optional -* [Yarn](https://yarnpkg.com/) - *Optional but recommended for security reasons. If you won't install it, use `npx yarn` instead of `yarn`.* +### Optional +* [Yarn](https://yarnpkg.com/) - *If you decide not to install it, use `npx yarn` instead of `yarn`.* * [FFmpeg](https://www.ffmpeg.org/) To install the dependiencies on Debian (or derivatives like Ubuntu) you can use the following commands: @@ -39,7 +42,7 @@ apt install build-essential python3 nodejs postgresql redis apt install ffmpeg corepack enable # for yarn ``` -Other OSes will have different package names and package managers to install the dependencies. +You will need to adapt this for whichever OS you are using to host FoundKey. *3.* Install FoundKey ---------------------------------------------------------------- @@ -49,7 +52,7 @@ Other OSes will have different package names and package managers to install the 2. Clone the FoundKey repository - `git clone --recursive https://akkoma.dev/FoundKeyGang/FoundKey` + `git clone --recursive https://akkoma.dev/FoundKeyGang/FoundKey foundkey` 3. Navigate to the repository @@ -61,11 +64,13 @@ Other OSes will have different package names and package managers to install the *4.* Configure FoundKey ---------------------------------------------------------------- -1. Copy the `.config/example.yml` and rename it to `default.yml`. +1. Copy `.config/example.yml` to `.config/default.yml`. `cp .config/example.yml .config/default.yml` -2. Edit `default.yml` +2. Edit `default.yml` with a text editor + - 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. *5.* Build FoundKey ---------------------------------------------------------------- @@ -102,20 +107,16 @@ grant all privileges on database foundkey to foundkey; 2. Run the database initialisation `yarn run init` -*7.* That is it. +*7.* Running FoundKey ---------------------------------------------------------------- Well done! Now, you can begin using FoundKey. -### Launch normally -Just `NODE_ENV=production npm start`. GLHF! +### Launching manually +Run `NODE_ENV=production npm start` to launch FoundKey manually. To stop the server, use Ctrl-C. ### Launch with systemd -1. Create a systemd service here - - `/etc/systemd/system/foundkey.service` - -2. Edit it, and paste this and save: +1. Run `systemctl --edit --full --force foundkey.service`, and paste the following: ```ini [Unit] @@ -137,13 +138,10 @@ Restart=always WantedBy=multi-user.target ``` -3. Reload systemd and enable the foundkey service. +2. Save the file, then enable and start FoundKey. - `systemctl daemon-reload ; systemctl enable foundkey` + `systemctl enable --now foundkey` -4. Start the foundkey service. - - `systemctl start foundkey` You can check if the service is running with `systemctl status foundkey`. From 617f064d6192718bf48104ebcbc44827722593ed Mon Sep 17 00:00:00 2001 From: Norm Date: Fri, 29 Jul 2022 23:06:20 +0000 Subject: [PATCH 09/10] Update 'docs/INSTALL.md' Fix some styling stuff. --- docs/INSTALL.md | 107 +++++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 52 deletions(-) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index b534ba50a..c90f15215 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -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 describes how to install and setup FoundKey. +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 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. -In debian for example: - ```sh adduser --disabled-password --disabled-login foundkey ``` -*2.* Install dependencies ----------------------------------------------------------------- +## Install dependencies FoundKey requires the following packages to run: ### Dependencies :package: -* **[Node.js](https://nodejs.org/en/)** (16.x) -* **[PostgreSQL](https://www.postgresql.org/)** (12.x / 13.x is preferred) +* **[Node.js](https://nodejs.org/en/)** (16.x/18.x) +* **[PostgreSQL](https://www.postgresql.org/)** (12.x minimum; 13.x+ is preferred) * **[Redis](https://redis.io/)** 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) ### Optional @@ -42,11 +37,9 @@ apt install build-essential python3 nodejs postgresql redis apt install ffmpeg corepack enable # for yarn ``` -You will need to adapt this for whichever OS you are using to host FoundKey. -*3.* Install FoundKey ----------------------------------------------------------------- -1. Connect to the `foundkey` user +## Install FoundKey +1. Login to the `foundkey` user `su - foundkey` @@ -62,8 +55,7 @@ You will need to adapt this for whichever OS you are using to host FoundKey. `yarn install` -*4.* Configure FoundKey ----------------------------------------------------------------- +## Configure FoundKey 1. Copy `.config/example.yml` to `.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. - 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: @@ -85,13 +76,10 @@ If you're still encountering errors about some modules, use node-gyp: 2. `npx node-gyp build` 3. `NODE_ENV=production yarn build` -*6.* Init DB ----------------------------------------------------------------- -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. +## Setting up the database +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. ```sh sudo -u postgres psql @@ -104,19 +92,18 @@ grant all privileges on database foundkey to foundkey; \q ``` -2. Run the database initialisation +Next, initialize the database: `yarn run init` -*7.* Running FoundKey ----------------------------------------------------------------- -Well done! Now, you can begin using FoundKey. +## Running FoundKey +You can either run FoundKey manually or use the system service manager to start FoundKey automatically on startup. ### Launching manually Run `NODE_ENV=production npm start` to launch FoundKey manually. To stop the server, use Ctrl-C. ### 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 [Unit] @@ -138,16 +125,16 @@ Restart=always WantedBy=multi-user.target ``` -2. Save the file, then enable and start FoundKey. - - `systemctl enable --now foundkey` - +Save the file, then enable and start FoundKey. +```sh +systemctl enable --now foundkey +``` You can check if the service is running with `systemctl status foundkey`. ### Launch with OpenRC -1. Copy the following text to `/etc/init.d/foundkey`: +Copy the following text to `/etc/init.d/foundkey`: ```sh #!/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`. -### How to update your FoundKey server to the latest version -1. `git pull` -2. `git submodule update --init` -3. `yarn install` -4. `NODE_ENV=production yarn build` -5. `yarn migrate` -6. Restart your FoundKey process to apply changes -7. Enjoy +### Updating FoundKey +Use git to pull in the latest changes and rerun the build and migration commands: + +```sh +git pull +git submodule update --init +yarn install +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: 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 From 2e94ea3adcde95a3c8aaedef7bd742cb0f58db84 Mon Sep 17 00:00:00 2001 From: Norm Date: Wed, 3 Aug 2022 22:39:35 +0000 Subject: [PATCH 10/10] docs/install: Move user creation after installing deps --- docs/INSTALL.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index c90f15215..37e20a83a 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -4,13 +4,6 @@ This guide will assume that you have administrative rights, either as root or a 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. -## Create FoundKey user -Running FoundKey as root is not a good idea. Create a separate user to run FoundKey. - -```sh -adduser --disabled-password --disabled-login foundkey -``` - ## Install dependencies FoundKey requires the following packages to run: @@ -38,6 +31,13 @@ apt install ffmpeg corepack enable # for yarn ``` +## Create FoundKey user +Create a separate non-root user to run FoundKey: + +```sh +adduser --disabled-password --disabled-login foundkey +``` + ## Install FoundKey 1. Login to the `foundkey` user