• RoundSparrowOP
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    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’

      • cablepick@lemmy.cablepick.net
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        1 year ago

        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

        • RoundSparrowOP
          link
          fedilink
          arrow-up
          2
          ·
          edit-2
          1 year ago

          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

          • cablepick@lemmy.cablepick.net
            link
            fedilink
            arrow-up
            1
            ·
            edit-2
            1 year ago

            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';"

            • RoundSparrowOP
              link
              fedilink
              arrow-up
              2
              ·
              edit-2
              1 year ago

              sudo -iu postgres psql -c “ALTER USER lemmy WITH SUPERUSER;”

              Ok, that seems to have helped!
              curl localhost:8536/api/v3/site now works!

              • cablepick@lemmy.cablepick.net
                link
                fedilink
                arrow-up
                2
                ·
                1 year ago

                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.

              • cablepick@lemmy.cablepick.net
                link
                fedilink
                arrow-up
                2
                ·
                1 year ago

                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

        • RoundSparrowOP
          link
          fedilink
          arrow-up
          2
          ·
          edit-2
          1 year ago

          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?

          • cablepick@lemmy.cablepick.net
            link
            fedilink
            arrow-up
            1
            ·
            1 year ago

            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

              • cablepick@lemmy.cablepick.net
                link
                fedilink
                arrow-up
                1
                ·
                1 year ago

                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.

        • RoundSparrowOP
          link
          fedilink
          arrow-up
          2
          ·
          edit-2
          1 year ago

          Front end:

          are your ‘git pull’ instructions incomplete? I did:
          git clone https://github.com/LemmyNet/lemmy-ui.git --recursive .

          • cablepick@lemmy.cablepick.net
            link
            fedilink
            arrow-up
            1
            ·
            edit-2
            1 year ago

            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.