• RoundSparrowOP
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    2 years ago

    I ran as root:

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

    And the final lines of output said:

    Installing /root/.cargo/bin/lemmy_server
    Installed package `lemmy_server v0.17.3` (executable `lemmy_server`)
    

    Which is not where the install expects the binary to be, in /root/.cargo - isn’t the “target-dir” being ignored here or something?

    • RoundSparrowOP
      link
      fedilink
      arrow-up
      1
      ·
      2 years 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
          2 years 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
            2 years 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
              ·
              2 years 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
                  ·
                  2 years 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
            2 years 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
              2 years 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
                2 years 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
                  ·
                  2 years 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
                  ·
                  2 years 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
            2 years 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
              2 years 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.

  • RoundSparrowOP
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    2 years ago

    needed to install some packages

     apt  install protobuf-compiler
    
  • RoundSparrowOP
    link
    fedilink
    arrow-up
    1
    ·
    2 years ago

    After installing lemmy-ui, which seems to work with curl on port 1234

    docs section “Configure reverse proxy and TLS”

    Aren’t these instructions kind of backwards? Shouldn’t you put the nginix config file on the disk before you generate the certificate?

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

    Assumption: Do these instructions assume you are doing everything as root? I did run as root… none of the instructions had a ‘sudo’, so I assumed root?

  • RoundSparrowOP
    link
    fedilink
    arrow-up
    1
    ·
    2 years ago

    lemmy-ui and nodejs versions

    The from_scratch instructions say to install node 12.x, that’s really old. Can this run on node version 20?

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

      Ubuntu 22.04’s nodejs is old, so I did this as root:

      curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
      echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
      curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
      sudo apt install nodejs yarn
      

      Note that this is 20.x and not the 12.x in the current from_scratch instructions.

      I really need to reinstall my Ubuntu 22.04.2 from scratch and re-test all these steps, as there was a lot of other things I tried that failed and system is now kind of cluttered up and not sure these are all the steps that actually worked.