lemmy-docs icon indicating copy to clipboard operation
lemmy-docs copied to clipboard

Under the "From Scratch" installation, it is not clear where Pict-rs is initially installed, so the update doesn't work

Open mtekman opened this issue 2 years ago • 5 comments

The problem occurs here:

apt install pkg-config libssl-dev libpq-dev postgresql
# installs latest release, you can also specify one with --version
# The --locked argument uses the exact versions of dependencies specified in
# `cargo.lock`at release time. Running it without the flag will use newer minor
# release versions of those dependencies, which are not always guaranteed to compile.
# Remove the parameter `--features embed-pictrs` if you don't require image hosting.
cargo install lemmy_server --target-dir /usr/bin/ --locked --features embed-pictrs

To me it looks like pictrs is embedded within the lemmy_server binary. But later we're told that we can update it via building it in /var/lib/pictrs-source and moving it to /usr/bin/

rustup update
cd /var/lib/pictrs-source
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#L40
git checkout v0.2.6-r2
# or simply add the bin folder to your $PATH
$HOME/.cargo/bin/cargo build --release
cp target/release/pict-rs /usr/bin/
systemctl restart pictrs

Issue: Installing Lemmy when not a sudo user

My lemmy user account does not have root privileges and so cannot use the --target-dir /usr/bin parameter when building. As a result, the final lemmy_server binary exists only at /home/lemmy/.cargo/bin/. Inside this folder there is no pict-rs binary.

So the main question for me now is: where is pictrs installed when --features embed-pictrs is used?

mtekman avatar Jun 19 '23 07:06 mtekman

In issue #213 the issue of shifting to using git checkout for server came up, I think it is more in the spirit of 'from scratch'. But I'm stuck, because I don't know the steps to make the choice regarding building withembed-pictrs to match:

cargo install lemmy_server --target-dir /usr/bin/ --locked --features embed-pictrs

RocketDerp avatar Jun 23 '23 15:06 RocketDerp

wouldn't the --features embed-pictrs tell the cargo installation to embed the pictrs server within lemmy?

See: https://github.com/LemmyNet/lemmy-docs/pull/221#issuecomment-1600608062

mtekman avatar Jun 24 '23 15:06 mtekman

ok, so maybe from-scratch should encourage non-integration given the philosophy of doing things more 'under control' for your own server. I'll try to add that to the document. Thank you.

RocketDerp avatar Jun 24 '23 17:06 RocketDerp

~~As another note, the PICTRS port appears (at least to me) to be hardcoded to 8080 when included within lemmy_server. Or at least I'm not sure how to change it.~~

Edit: Nope, outdated observation.

mtekman avatar Jun 26 '23 10:06 mtekman

Embedded pictrs uses the port specified in lemmy.hjson for pictrs.

https://github.com/LemmyNet/lemmy/pull/3201

Nutomic avatar Jun 26 '23 11:06 Nutomic