Experience and tips based off these Ubuntu 20.04 instructions:
https://join-lemmy.org/docs/en/administration/from_scratch.html
I thought trying to detail problems and extra steps in public might help some people.
Experience and tips based off these Ubuntu 20.04 instructions:
https://join-lemmy.org/docs/en/administration/from_scratch.html
I thought trying to detail problems and extra steps in public might help some people.
I ran as root:
And the final lines of output said:
Which is not where the install expects the binary to be, in /root/.cargo - isn’t the “target-dir” being ignored here or something?
This is where I am currently stuck.
I manually did:
cp /root/.cargo/bin/lemmy_server /usr/bin
Next:
systemctl start lemmy
But the
journalctl -u lemmy
logs show that it is unable to run the DB Migrations:lemmy_server: INFO lemmy_db_schema::utils: Running Database migrations (This may take a lo>
lemmy_server: thread ‘main’ panicked at ‘Couldn’t run DB Migrations’
fresh report of same problem: https://old.reddit.com/r/Lemmy/comments/1443oac/building_from_scratch_encountering_db_migration/
There is an issue with the cargo build. It works if you build from git as follows. Make sure you are using release tags as the main branch will break things. Current built as of this message is 0.17.3. Both the front and back end need to match. Rustup needs to already be installed and the shell PATH configured.
Database. Follow the doc and then run this command:
sudo -iu postgres psql -c "ALTER USER lemmy WITH SUPERUSER;"
Back end:
mkdir -p /root/lemmy/
cd /root/lemmy/
git clone https://github.com/LemmyNet/lemmy.git --recursive .
git branch -a
git checkout 0.17.3
echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
cargo build --release --target-dir /root/lemmy/ --locked --features embed-pictrs
mv /root/lemmy/release/lemmy_server /usr/bin/lemmy_server
Front end:
mkdir /var/lib/lemmy-ui
cd /var/lib/lemmy-ui
chown lemmy:lemmy .
sudo -u lemmy bash
git clone https://github.com/LemmyNet/lemmy-ui.git --recursive .
git checkout 0.17.3
echo "export const VERSION = \"v$(git describe --tag)\";" > "/var/lib/lemmy-ui/src/shared/version.ts"
yarn install --pure-lockfile
npx browserslist@latest --update-db
yarn build:prod
Past that use the systemd unit files from the build from scratch doc: https://join-lemmy.org/docs/en/administration/from_scratch.html
Front end:
are your ‘git pull’ instructions incomplete? I did:
git clone https://github.com/LemmyNet/lemmy-ui.git --recursive .
Whoops… Yes you are correct. I had switched to git pull since that’s what I will use going forward to update.
I’ve update the above text so hopefully it is a complete guide.
Compared to your reply on Reddit: here you have cargo build to be run before and after doing the checkout of 0.17.3? twice?
I just updated my comment to fix those two errors. This was copy/paste out of my notes txt file from figuring out how to do this.
A dot after recursive will drop the git files into the current directory. In this case /root/lemmy/
git clone https://github.com/LemmyNet/lemmy.git --recursive .
And don’t run that first cargo command that I’ve since removed. Only the second one, now only one. This uses the git cargo files instead of the crates app (install lemmy_server.)
cargo build --release --target-dir /root/lemmy/ --locked --features embed-pictrs
Ok, thanks.
Let me know if it works. I had the same DB migration issues using the install lemmy_server options and found a post, I think on github, about there being an issues with there. I can’t find that post now.
On Back end: I’m still running into the same problem as 2 other people have reported, the log file shows:
thread 'main' panicked at 'Couldn't run DB Migrations', crates/db_schema/src/utils.rs:165:25
I did try the drop table and create table you posted on Reddit thread, didn’t help, always runs into DB Migrations failure on attempt to start lemmy_server
Try this:
sudo -iu postgres psql -c "ALTER USER lemmy WITH SUPERUSER;"
You might need to dump the DB before restarting lemmy_server
sudo -iu postgres psql -c "DROP DATABASE lemmy;"
sudo -iu postgres psql -c "CREATE DATABASE lemmy WITH OWNER lemmy ENCODING 'UTF8' TEMPLATE template0 LC_COLLATE 'C' LC_CTYPE 'C';"
Ok, that seems to have helped!
curl localhost:8536/api/v3/site
now works!Nice! Sorry my notes are a mess and nothing is in order since I was trying a lot of different things at the time.
Lemmy logs everything, and I mean everything. I haven’t found a setting to dial it back so I’ve banned it from writing to syslog and moved journal to memory only. Here is what I ran to stop it from filling up my disk with logs.
echo 'if $programname == "lemmy_server" then stop' >> /etc/rsyslog.d/ignore-lemmy_server.conf
systemctl restart rsyslog
sed -i 's/#SystemMaxUse=/SystemMaxUse=25M/g' /etc/systemd/journald.conf
sed -i 's/#Storage=auto/Storage=volatile/g' /etc/systemd/journald.conf
systemctl restart systemd-journald