From 4a127cb6d750f680811f30fe09eaadbbde99d13e Mon Sep 17 00:00:00 2001 From: alifeee Date: Tue, 11 Feb 2025 12:53:21 +0000 Subject: add a bit more info to installation instructions pertinently allowing `pnpm` to be run by anyone --- docs/running-gathio/installation.md | 65 ++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 29 deletions(-) (limited to 'docs') diff --git a/docs/running-gathio/installation.md b/docs/running-gathio/installation.md index cdb3f44..b3f4931 100644 --- a/docs/running-gathio/installation.md +++ b/docs/running-gathio/installation.md @@ -6,8 +6,8 @@ Gathio can be set up to run on your own server in two ways - as a self-hosted se ### Prerequisites -- [Node.js](https://nodejs.org/en/) v18 or greater -- [MongoDB](https://www.mongodb.com/docs/manual/administration/install-on-linux/#std-label-install-mdb-community-edition-linux) +- [Node.js](https://nodejs.org/en/) v18 or greater +- [MongoDB](https://www.mongodb.com/docs/manual/administration/install-on-linux/#std-label-install-mdb-community-edition-linux) ### Ubuntu @@ -15,64 +15,71 @@ Let's suppose we're installing on a fresh Ubuntu system. First, let's get the code: -``` -$ cd /srv/ -$ sudo git clone https://github.com/lowercasename/gathio/ +```bash +cd /srv/ +sudo git clone https://github.com/lowercasename/gathio/ ``` -We'll need to install [pnpm](https://pnpm.io/) for this: +We'll need to install [`pnpm`](https://pnpm.io/) for this. It should be installed somewhere accessible by any user account. You may also have to link `/usr/bin/node` and `/usr/bin/nodejs` to be accessible to all users, too. -``` -$ curl -fsSL https://get.pnpm.io/install.sh | sh - +```bash +export PNPM_HOME="/usr/.pnpm" +curl -fsSL https://get.pnpm.io/install.sh | sh - +sudo ln -s /usr/.pnpm/pnpm /usr/bin/pnpm ``` -pnpm installation instructions for [other systems](https://pnpm.io/installation) are available. +`pnpm` installation instructions for [other systems](https://pnpm.io/installation) are available. Now, we'll install the dependencies: -``` -$ cd gathio -$ pnpm install -$ pnpm build +```bash +cd gathio +pnpm install +pnpm build ``` Let's copy the config file in place: -``` -$ cp config/config.example.toml config/config.toml +```bash +cp config/config.example.toml config/config.toml ``` We can edit this file if needed, as it contains settings which will need to be adjusted to your local setup to successfully format emails. -``` -$ $EDITOR config/config.toml +```bash +$EDITOR config/config.toml ``` Either way, we'll need to have MongoDB running. Follow the [MongoDB Community Edition Ubuntu instructions](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu), which are probably what you want. Next, let's create a dedicated user: -``` -$ sudo adduser --home /srv/gathio --disabled-login gathio -$ sudo chown -R gathio:gathio /srv/gathio +```bash +sudo adduser --home /srv/gathio --disabled-login gathio +sudo chown -R gathio:gathio /srv/gathio +# check user can access pnpm +cd / && sudo -u gathio /usr/bin/pnpm --version ``` -Next, we'll copy the systemd service and reload systemd +Next, we'll copy the `systemd` service and reload `systemd` -``` -$ sudo cp gathio.service /etc/systemd/system/ -$ sudo systemctl daemon-reload +```bash +sudo cp gathio.service /etc/systemd/system/ +sudo systemctl daemon-reload ``` -Finally, we can start gathio: +Finally, we can start `gathio`: -``` -$ sudo systemctl start gathio +```bash +# start locally in terminal +(cd /srv/gathio; /usr/bin/pnpm start) +# start service to run in background +sudo systemctl start gathio ``` It should now be listening on port 3000: -``` +```bash $ sudo netstat -tunap | grep LISTEN [...] tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 952/sshd @@ -125,7 +132,7 @@ You can copy the `docker-compose.yml` file into that same `gathio-docker` direct you created - you don't need any of the source code. Once you're done, your directory should look something like this: -``` +```tree gathio-docker ├── config │ └── config.toml -- cgit v1.2.3 From 861413f96b2ffada9a46f97f49651e14ecdacc4c Mon Sep 17 00:00:00 2001 From: alifeee Date: Wed, 12 Feb 2025 10:49:58 +0000 Subject: remove weird syntax --- docs/running-gathio/installation.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/running-gathio/installation.md b/docs/running-gathio/installation.md index b5ac45b..2481bc3 100644 --- a/docs/running-gathio/installation.md +++ b/docs/running-gathio/installation.md @@ -72,7 +72,8 @@ Finally, we can start `gathio`: ```bash # start locally in terminal -(cd /srv/gathio; /usr/bin/pnpm start) +cd /srv/gathio +/usr/bin/pnpm start # start service to run in background sudo systemctl start gathio ``` -- cgit v1.2.3 From b7e65e8ac592728290c7224c7310818c031d7b71 Mon Sep 17 00:00:00 2001 From: alifeee Date: Wed, 12 Feb 2025 10:50:06 +0000 Subject: add clarification notes --- docs/running-gathio/installation.md | 3 +++ 1 file changed, 3 insertions(+) (limited to 'docs') diff --git a/docs/running-gathio/installation.md b/docs/running-gathio/installation.md index 2481bc3..6d8347a 100644 --- a/docs/running-gathio/installation.md +++ b/docs/running-gathio/installation.md @@ -26,6 +26,7 @@ We'll need to install [`pnpm`](https://pnpm.io/) for this. It should be installe export PNPM_HOME="/usr/.pnpm" curl -fsSL https://get.pnpm.io/install.sh | sh - sudo ln -s /usr/.pnpm/pnpm /usr/bin/pnpm +# you may also have to link /usr/bin/node or /usr/bin/nodejs to your local copy of node ``` `pnpm` installation instructions for [other systems](https://pnpm.io/installation) are available. @@ -35,6 +36,8 @@ Now, we'll install the dependencies: ```bash cd gathio pnpm install +# as "checkJs" is set to "true" in "tsconfig.json", this fails because of type-checking +# however, it builds the output folder "dist", so we can ignore the errors and carry on pnpm build ``` -- cgit v1.2.3 From 2328376182e3dea74c10eaeaa7f14841030342a0 Mon Sep 17 00:00:00 2001 From: alifeee Date: Wed, 12 Feb 2025 10:55:15 +0000 Subject: start locally as `gathio` user --- docs/running-gathio/installation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/running-gathio/installation.md b/docs/running-gathio/installation.md index 6d8347a..59f458d 100644 --- a/docs/running-gathio/installation.md +++ b/docs/running-gathio/installation.md @@ -74,9 +74,9 @@ sudo systemctl daemon-reload Finally, we can start `gathio`: ```bash -# start locally in terminal +# start locally in terminal as gathio user cd /srv/gathio -/usr/bin/pnpm start +sudo -u gathio /usr/bin/pnpm start # start service to run in background sudo systemctl start gathio ``` -- cgit v1.2.3