From dfccfa110c7738317adf81ee927ad153d4ac7cd3 Mon Sep 17 00:00:00 2001 From: mtekman <20641402+mtekman@users.noreply.github.com> Date: Mon, 19 Jun 2023 08:21:20 +0000 Subject: [PATCH 1/5] Update from_scratch.md Updated out of date LEMMY_UI environment variables, and added caution with failing postgresql configuration --- src/administration/from_scratch.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/administration/from_scratch.md b/src/administration/from_scratch.md index 64947ccd..bef875c2 100644 --- a/src/administration/from_scratch.md +++ b/src/administration/from_scratch.md @@ -39,7 +39,9 @@ sudo -iu postgres psql -c "CREATE DATABASE lemmy WITH OWNER lemmy;" adduser lemmy --system --disabled-login --no-create-home --group ``` -Note that currently Lemmy only supports non-SSL connections to databases. More info [here](https://github.com/LemmyNet/lemmy/issues/3007). +Note: +* Lemmy currently only supports non-SSL connections to databases. More info [here](https://github.com/LemmyNet/lemmy/issues/3007). +* Your postgres config might need to be edited to allow password authentication instead of peer authentication. More info [here](https://github.com/LemmyNet/lemmy-docs/issues/220). Minimal Lemmy config, put this in `/etc/lemmy/lemmy.hjson` (see [here](https://github.com/LemmyNet/lemmy/blob/main/config/config.hjson) for more config options). Run `chown lemmy:lemmy /etc/lemmy/ -R` to set the correct owner. @@ -118,7 +120,7 @@ yarn build:prod exit ``` -Add another systemd unit file, this time for lemmy-ui. You need to replace example.com with your actual domain. Put the file in `/etc/systemd/system/lemmy-ui.service`, then run `systemctl enable lemmy-ui` and `systemctl start lemmy-ui`. +Add another systemd unit file, this time for lemmy-ui. You need to replace example.com with your actual domain. Put the file in `/etc/systemd/system/lemmy-ui.service`, then run `systemctl enable lemmy-ui` and `systemctl start lemmy-ui`. Note that some of the environment variables `LEMMY_*` are subject to change, and you should use the most up to date variable names, as [found here](https://github.com/LemmyNet/lemmy-ui#configuration) ``` [Unit] @@ -130,9 +132,9 @@ Before=nginx.service User=lemmy WorkingDirectory=/var/lib/lemmy-ui ExecStart=/usr/bin/node dist/js/server.js -Environment=LEMMY_INTERNAL_HOST=localhost:8536 -Environment=LEMMY_EXTERNAL_HOST=example.com -Environment=LEMMY_HTTPS=true +Environment=LEMMY_UI_LEMMY_INTERNAL_HOST=localhost:8536 +Environment=LEMMY_UI_LEMMY_EXTERNAL_HOST=example.com +Environment=LEMMY_UI_HTTPS=true Restart=on-failure # Hardening From a816fca1e6d5b6b1557f70fd813821d3fda6ba3a Mon Sep 17 00:00:00 2001 From: mtekman <20641402+mtekman@users.noreply.github.com> Date: Wed, 21 Jun 2023 08:43:10 +0000 Subject: [PATCH 2/5] Feedback from @Nutomic and @RocketDerp --- src/administration/from_scratch.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/administration/from_scratch.md b/src/administration/from_scratch.md index bef875c2..31c6244f 100644 --- a/src/administration/from_scratch.md +++ b/src/administration/from_scratch.md @@ -41,7 +41,13 @@ adduser lemmy --system --disabled-login --no-create-home --group Note: * Lemmy currently only supports non-SSL connections to databases. More info [here](https://github.com/LemmyNet/lemmy/issues/3007). -* Your postgres config might need to be edited to allow password authentication instead of peer authentication. More info [here](https://github.com/LemmyNet/lemmy-docs/issues/220). +* Your postgres config might need to be edited to allow password authentication instead of peer authentication. Simply add: + ``` + local lemmy lemmy md5 + # Add the line above. + # Do not add the line below, it should already exist in your pg_hba.conf in some form. + local all all peer + ``` Minimal Lemmy config, put this in `/etc/lemmy/lemmy.hjson` (see [here](https://github.com/LemmyNet/lemmy/blob/main/config/config.hjson) for more config options). Run `chown lemmy:lemmy /etc/lemmy/ -R` to set the correct owner. @@ -120,7 +126,7 @@ yarn build:prod exit ``` -Add another systemd unit file, this time for lemmy-ui. You need to replace example.com with your actual domain. Put the file in `/etc/systemd/system/lemmy-ui.service`, then run `systemctl enable lemmy-ui` and `systemctl start lemmy-ui`. Note that some of the environment variables `LEMMY_*` are subject to change, and you should use the most up to date variable names, as [found here](https://github.com/LemmyNet/lemmy-ui#configuration) +Add another systemd unit file, this time for lemmy-ui. You need to replace example.com with your actual domain. Put the file in `/etc/systemd/system/lemmy-ui.service`, then run `systemctl enable lemmy-ui` and `systemctl start lemmy-ui`. More UI-related variables can be [found here](https://github.com/LemmyNet/lemmy-ui#configuration). ``` [Unit] @@ -135,6 +141,7 @@ ExecStart=/usr/bin/node dist/js/server.js Environment=LEMMY_UI_LEMMY_INTERNAL_HOST=localhost:8536 Environment=LEMMY_UI_LEMMY_EXTERNAL_HOST=example.com Environment=LEMMY_UI_HTTPS=true +Environment=RUST_LOG=info Restart=on-failure # Hardening From 8673f774e1ec8e5203763a87879dcba8225d41fb Mon Sep 17 00:00:00 2001 From: mtekman <20641402+mtekman@users.noreply.github.com> Date: Wed, 21 Jun 2023 10:20:21 +0000 Subject: [PATCH 3/5] ran through prettier --- src/administration/from_scratch.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/administration/from_scratch.md b/src/administration/from_scratch.md index 31c6244f..2cf021d7 100644 --- a/src/administration/from_scratch.md +++ b/src/administration/from_scratch.md @@ -39,15 +39,16 @@ sudo -iu postgres psql -c "CREATE DATABASE lemmy WITH OWNER lemmy;" adduser lemmy --system --disabled-login --no-create-home --group ``` -Note: -* Lemmy currently only supports non-SSL connections to databases. More info [here](https://github.com/LemmyNet/lemmy/issues/3007). -* Your postgres config might need to be edited to allow password authentication instead of peer authentication. Simply add: +Note: + +- Lemmy currently only supports non-SSL connections to databases. More info [here](https://github.com/LemmyNet/lemmy/issues/3007). +- Your postgres config might need to be edited to allow password authentication instead of peer authentication. Simply add: ``` local lemmy lemmy md5 # Add the line above. # Do not add the line below, it should already exist in your pg_hba.conf in some form. local all all peer - ``` + ``` Minimal Lemmy config, put this in `/etc/lemmy/lemmy.hjson` (see [here](https://github.com/LemmyNet/lemmy/blob/main/config/config.hjson) for more config options). Run `chown lemmy:lemmy /etc/lemmy/ -R` to set the correct owner. From bbfd5f36b1888128d481b5ec7db1f0d52ffc716a Mon Sep 17 00:00:00 2001 From: MT Date: Thu, 22 Jun 2023 11:07:49 +0200 Subject: [PATCH 4/5] resolve merge conflict --- src/administration/from_scratch.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/administration/from_scratch.md b/src/administration/from_scratch.md index 2cf021d7..5c526582 100644 --- a/src/administration/from_scratch.md +++ b/src/administration/from_scratch.md @@ -217,6 +217,9 @@ systemctl restart lemmy-ui ### Pict-rs +If you did **not** use the `--features embed-pictrs` flag, then this script below is necessary for installing/updating Pict-rs as a standalone server. +Otherwise, pict-rs should update with lemmy_server. + ```bash rustup update cd /var/lib/pictrs-source @@ -224,7 +227,7 @@ git checkout main git pull --tags # check docker-compose.yml for pict-rs version used by lemmy # https://github.com/LemmyNet/lemmy-ansible/blob/main/templates/docker-compose.yml#L43 -git checkout v0.2.6-r2 +git checkout v0.2.6-r2 # replace with the version you want to install # or simply add the bin folder to your $PATH $HOME/.cargo/bin/cargo build --release cp target/release/pict-rs /usr/bin/ From a501d22c38692ab7d3d942ce0fa0c81dba706036 Mon Sep 17 00:00:00 2001 From: mtekman <20641402+mtekman@users.noreply.github.com> Date: Wed, 21 Jun 2023 15:15:54 +0000 Subject: [PATCH 5/5] Added note about pict-rs being standalone and embeddable --- src/administration/from_scratch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/administration/from_scratch.md b/src/administration/from_scratch.md index 5c526582..2b40e105 100644 --- a/src/administration/from_scratch.md +++ b/src/administration/from_scratch.md @@ -12,7 +12,7 @@ Install Rust by following the instructions on [Rustup](https://rustup.rs/). Lemmy supports image hosting using [pict-rs](https://git.asonix.dog/asonix/pict-rs/). We need to install a couple of dependencies for this. You can also skip these steps if you don't require image hosting. **NOTE: Lemmy-ui will still allow users to attempt uploading images even if pict-rs is not configured, in this situation, the upload will fail and users will receive technical error messages.** -Pict-rs requires the `magick` command which comes with Imagemagick version 7, but Ubuntu 20.04 only comes with Imagemagick 6. So you need to install that command manually, eg from the [official website](https://imagemagick.org/script/download.php#linux). +Depending on preference, pict-rs can be installed as a standalone application, or it can be embedded within Lemmy itself (see below). In both cases, pict-rs requires the `magick` command which comes with Imagemagick version 7, but Ubuntu 20.04 only comes with Imagemagick 6. So you need to install that command manually, eg from the [official website](https://imagemagick.org/script/download.php#linux). ```bash apt install ffmpeg exiftool libgexiv2-dev --no-install-recommends