Skip to content

Instantly share code, notes, and snippets.

@ashiato45
Created July 30, 2023 12:03
Show Gist options
  • Save ashiato45/dd7334ac2cea2fe4cc45364f71831663 to your computer and use it in GitHub Desktop.
Save ashiato45/dd7334ac2cea2fe4cc45364f71831663 to your computer and use it in GitHub Desktop.
GPT-4
User
Please help me to troubleshoot the update of Pleroma. I am updating Pleroma 2.3 running on AWS lightsail to Pleroma 2.5 with OTP installation. I tried it but the migration failed with the error saying "function associated_object_id(jsonb) does not exist". According to a forum, this trouble happens when we update Pleroma skipping Pleroma 2.4. I tried it with "pleroma_ctl update --branch v2.4.5", but it failed. I checked GitLab of Pleroma, but the artifact of v2.4.5 was already outdated. Could you give me an advice?
ChatGPT
The error message "function associated_object_id(jsonb) does not exist" suggests that there is an issue with the database migration during the update. As you have mentioned, skipping versions during an update can cause these kind of problems, because every version might come with its own database migrations.
It seems like you're having trouble accessing the specific version (v2.4.5) you need from the official GitLab due to outdated artifacts. You can follow the steps below to manually build and update to Pleroma 2.4.5:
Fetch the specific version from the Git repository:
bash
Copy code
git clone https://git.pleroma.social/pleroma/pleroma.git
cd pleroma
git checkout v2.4.5
Build Pleroma:
You'll need Elixir and a few other dependencies to build Pleroma. If you haven't already installed these, you can do so with the following commands (for an Ubuntu system):
bash
Copy code
sudo apt update
sudo apt install git build-essential elixir erlang-nox postgresql postgresql-contrib
Now you can build Pleroma using the following commands:
bash
Copy code
mix local.hex --force
mix local.rebar --force
mix deps.get
MIX_ENV=prod mix compile
Stop your current Pleroma instance:
bash
Copy code
systemctl stop pleroma
Install the newly built version over your current installation. This usually involves copying the built code over your current installation directory. Remember to backup any configuration files before doing this.
Run the database migrations:
bash
Copy code
MIX_ENV=prod mix ecto.migrate
Start Pleroma again:
bash
Copy code
systemctl start pleroma
Verify that your instance is running correctly on version 2.4.5. Once this is confirmed, you can proceed to upgrade to version 2.5, which should now be possible without the previous database migration issue.
Please make sure to back up your instance before proceeding, as manual updates can potentially cause data loss if something goes wrong.
If you still encounter issues, you might need to reach out to the Pleroma community or support for more specialized help.
User
thanks. does your way work even if I installed Pleroma 2.3 with OTP installation? I did not install it from the source code.
ChatGPT
You're welcome! You're correct in noting that the instructions provided were for a source-based installation. However, if you've installed Pleroma via an OTP release, the process becomes slightly more complicated due to the fact that OTP releases are precompiled.
To update Pleroma installed via OTP, we'd typically download the new OTP release, replace the old release, and then run the migrations. In your case, since the Pleroma 2.4.5 artifact is not available, you may have to build the OTP release from the source code. Here's how you can do that:
First, make sure you have Elixir installed. If you don't, you can install it as follows (Ubuntu):
bash
Copy code
sudo apt update
sudo apt install esl-erlang elixir
Clone the Pleroma source code and checkout the required version:
bash
Copy code
git clone https://git.pleroma.social/pleroma/pleroma.git
cd pleroma
git checkout v2.4.5
Install the dependencies and build the OTP release:
bash
Copy code
mix local.hex --force
mix local.rebar --force
mix deps.get
MIX_ENV=prod mix do compile, release
The OTP release will be created in _build/prod/rel.
Backup your current Pleroma installation.
Replace the old release with the one you just built:
bash
Copy code
rm -rf /opt/pleroma
mv _build/prod/rel/pleroma /opt/pleroma
This assumes your installation is in /opt/pleroma. Please replace with the correct path if it's installed somewhere else.
Run the database migrations:
bash
Copy code
/opt/pleroma/bin/pleroma_ctl migrate
Restart Pleroma:
bash
Copy code
systemctl restart pleroma
Again, please backup your instance before performing these steps as they can potentially lead to data loss if something goes wrong. After ensuring Pleroma 2.4.5 is running correctly, you can then proceed to update to 2.5.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment