From 816e36971e9bb062c54b64884d3458fb5801001b Mon Sep 17 00:00:00 2001 From: dakkar Date: Thu, 30 Nov 2023 16:54:10 +0000 Subject: [PATCH] replace fenced code blocks with indented ones apparently the website compiler likes those better --- content/en/docs/install/migrate.md | 200 ++++++++++++++--------------- 1 file changed, 95 insertions(+), 105 deletions(-) diff --git a/content/en/docs/install/migrate.md b/content/en/docs/install/migrate.md index 8ae6791..df484c5 100644 --- a/content/en/docs/install/migrate.md +++ b/content/en/docs/install/migrate.md @@ -68,38 +68,34 @@ If you use Sonic or ElasticSearch replace that section of the Docker Compose with the following, as Sharkey currently only supports meilisearch: -```yml -meilisearch: - restart: always - image: getmeili/meilisearch:v1.3.4 - environment: - - MEILI_NO_ANALYTICS=true - - MEILI_ENV=production - env_file: - - .config/meilisearch.env - networks: - - calcnet # <-- Use whatever network name is used in the docker compose here - volumes: - - ./meili_data:/meili_data # <--- make sure to replace the volume with one that fits your existing docker compose -``` + meilisearch: + restart: always + image: getmeili/meilisearch:v1.3.4 + environment: + - MEILI_NO_ANALYTICS=true + - MEILI_ENV=production + env_file: + - .config/meilisearch.env + networks: + - calcnet # <-- Use whatever network name is used in the docker compose here + volumes: + - ./meili_data:/meili_data # <--- make sure to replace the volume with one that fits your existing docker compose If you use DragonflyDB replace it with Redis or KeyDB, as Sharkey currently does not support DragonflyDB. To do this replace the section in the docker compose with the following: -```yml -redis: - restart: always - image: redis:7-alpine - networks: - - calcnet # <-- Use whatever network name is used in the docker compose here - volumes: - - ./redis:/data # <-- Make sure to replace the volume with the one used in your firefish docker compose - healthcheck: - test: "redis-cli ping" - interval: 5s - retries: 20 -``` + redis: + restart: always + image: redis:7-alpine + networks: + - calcnet # <-- Use whatever network name is used in the docker compose here + volumes: + - ./redis:/data # <-- Make sure to replace the volume with the one used in your firefish docker compose + healthcheck: + test: "redis-cli ping" + interval: 5s + retries: 20 Backup your your firefish config and replace it with the [default sharkey @@ -116,7 +112,6 @@ volume, starting the newer PostgreSQL on it, and importing the data from the backup you just made. Refer to [the PostgreSQL documentation](https://www.postgresql.org/docs/current/backup-dump.html). - Make sure to update the *mount paths* for volumes of the Sharkey container from `/firefish/` to `/sharkey/` (so your existing volumes will show up at the new path, inside the container). @@ -134,60 +129,58 @@ work. The following series of SQL queries / commands should do it, but please read the comments and pay attention to the results after each query! -```sql --- start a transaction, so we won't leave the db in a halfway state if --- things go wrong -BEGIN; - --- we need to add back some columns that Firefish removed, but that --- Sharkey migrations expect -ALTER TABLE "user_profile" ADD "integrations" JSONB NOT NULL DEFAULT '{}'; -ALTER TABLE "meta" ADD "twitterConsumerSecret" VARCHAR(128); -ALTER TABLE "meta" ADD "twitterConsumerKey" VARCHAR(128); -ALTER TABLE "meta" ADD "enableTwitterIntegration" BOOLEAN NOT NULL DEFAULT false; -ALTER TABLE "meta" ADD "enableGithubIntegration" BOOLEAN NOT NULL DEFAULT false; -ALTER TABLE "meta" ADD "githubClientId" VARCHAR(128); -ALTER TABLE "meta" ADD "githubClientSecret" VARCHAR(128); -ALTER TABLE "meta" ADD "enableDiscordIntegration" BOOLEAN NOT NULL DEFAULT false; -ALTER TABLE "meta" ADD "discordClientId" VARCHAR(128); -ALTER TABLE "meta" ADD "discordClientSecret" VARCHAR(128); - --- also an extra table, for the same reasons -CREATE TABLE antenna_note(); - --- move aside some FireFish columns; Sharkey migrations will --- re-create them; we don't `DROP` them because we want to keep the data -ALTER TABLE "user" RENAME COLUMN "movedToUri" TO "ff_movedToUri"; -ALTER TABLE "user" RENAME COLUMN "alsoKnownAs" TO "ff_alsoKnownAs"; -ALTER TABLE "user" RENAME COLUMN "isIndexable" TO "ff_isIndexable"; -ALTER TABLE "user" RENAME COLUMN "speakAsCat" TO "ff_speakAsCat"; -ALTER TABLE "user_profile" RENAME COLUMN "preventAiLearning" TO "ff_preventAiLearning"; -ALTER TABLE "meta" RENAME COLUMN "silencedHosts" TO "ff_silencedHosts"; - --- this column was added by both Firefish and Misskey, but with --- different names, let's fix it -ALTER TABLE "meta" RENAME COLUMN "ToSUrl" TO "termsOfServiceUrl"; - --- update antenna types, this is only needed on some instances but --- recommend to run anyway --- --- this *removes* any antennas of types not supported by Sharkey! -CREATE TYPE public.new_antenna_src_enum AS ENUM ('home', 'all', 'list'); -ALTER TABLE antenna ADD COLUMN new_src public.new_antenna_src_enum; -DELETE FROM antenna WHERE src NOT IN ('home', 'all', 'list'); -ALTER TABLE antenna DROP COLUMN src; -ALTER TABLE antenna RENAME COLUMN new_src TO src; -DROP TYPE public.antenna_src_enum; -ALTER TYPE new_antenna_src_enum RENAME TO antenna_src_enum; - --- optional but recommended: delete all empty moderation log entries -DELETE FROM moderation_log WHERE info = '{}'; - --- only needed on some instances, run this if --- `\dT+ user_profile_mutingnotificationtypes_enum` --- does not show `note` in the "elements" section -ALTER TYPE "public"."user_profile_mutingnotificationtypes_enum" ADD VALUE 'note'; -``` + -- start a transaction, so we won't leave the db in a halfway state if + -- things go wrong + BEGIN; + + -- we need to add back some columns that Firefish removed, but that + -- Sharkey migrations expect + ALTER TABLE "user_profile" ADD "integrations" JSONB NOT NULL DEFAULT '{}'; + ALTER TABLE "meta" ADD "twitterConsumerSecret" VARCHAR(128); + ALTER TABLE "meta" ADD "twitterConsumerKey" VARCHAR(128); + ALTER TABLE "meta" ADD "enableTwitterIntegration" BOOLEAN NOT NULL DEFAULT false; + ALTER TABLE "meta" ADD "enableGithubIntegration" BOOLEAN NOT NULL DEFAULT false; + ALTER TABLE "meta" ADD "githubClientId" VARCHAR(128); + ALTER TABLE "meta" ADD "githubClientSecret" VARCHAR(128); + ALTER TABLE "meta" ADD "enableDiscordIntegration" BOOLEAN NOT NULL DEFAULT false; + ALTER TABLE "meta" ADD "discordClientId" VARCHAR(128); + ALTER TABLE "meta" ADD "discordClientSecret" VARCHAR(128); + + -- also an extra table, for the same reasons + CREATE TABLE antenna_note(); + + -- move aside some FireFish columns; Sharkey migrations will + -- re-create them; we don't `DROP` them because we want to keep the data + ALTER TABLE "user" RENAME COLUMN "movedToUri" TO "ff_movedToUri"; + ALTER TABLE "user" RENAME COLUMN "alsoKnownAs" TO "ff_alsoKnownAs"; + ALTER TABLE "user" RENAME COLUMN "isIndexable" TO "ff_isIndexable"; + ALTER TABLE "user" RENAME COLUMN "speakAsCat" TO "ff_speakAsCat"; + ALTER TABLE "user_profile" RENAME COLUMN "preventAiLearning" TO "ff_preventAiLearning"; + ALTER TABLE "meta" RENAME COLUMN "silencedHosts" TO "ff_silencedHosts"; + + -- this column was added by both Firefish and Misskey, but with + -- different names, let's fix it + ALTER TABLE "meta" RENAME COLUMN "ToSUrl" TO "termsOfServiceUrl"; + + -- update antenna types, this is only needed on some instances but + -- recommend to run anyway + -- + -- this *removes* any antennas of types not supported by Sharkey! + CREATE TYPE public.new_antenna_src_enum AS ENUM ('home', 'all', 'list'); + ALTER TABLE antenna ADD COLUMN new_src public.new_antenna_src_enum; + DELETE FROM antenna WHERE src NOT IN ('home', 'all', 'list'); + ALTER TABLE antenna DROP COLUMN src; + ALTER TABLE antenna RENAME COLUMN new_src TO src; + DROP TYPE public.antenna_src_enum; + ALTER TYPE new_antenna_src_enum RENAME TO antenna_src_enum; + + -- optional but recommended: delete all empty moderation log entries + DELETE FROM moderation_log WHERE info = '{}'; + + -- only needed on some instances, run this if + -- `\dT+ user_profile_mutingnotificationtypes_enum` + -- does not show `note` in the "elements" section + ALTER TYPE "public"."user_profile_mutingnotificationtypes_enum" ADD VALUE 'note'; If everything worked and you saw no errors, you can run `COMMIT;` in that same `psql` shell, to commit all the changes, then close that @@ -203,29 +196,26 @@ Open another `psql` shell like before (`docker exec -it db psql -U firefish -d firefish`, replacing things as before). We need another small pass of massaging. -```sql -BEGIN; - --- all existing users are approved, because Firefish doesn't have a --- concept of approvals -UPDATE "user" SET approved = true; - --- now we put back the data we moved aside -UPDATE "user" SET "movedToUri" = "ff_movedToUri" WHERE "ff_movedToUri" IS NOT NULL; -UPDATE "user" SET "alsoKnownAs" = "ff_alsoKnownAs" WHERE "ff_alsoKnownAs" IS NOT NULL; -UPDATE "user" SET "noindex" = NOT (COALESCE("ff_isIndexable", true)); -UPDATE "user" SET "speakAsCat" = COALESCE("ff_speakAsCat", false); -UPDATE "user_profile" SET "preventAiLearning" = COALESCE("ff_preventAiLearning", true); -UPDATE "meta" SET "silencedHosts" = COALESCE("ff_silencedHosts",'{}'); - -ALTER TABLE "user" DROP COLUMN "ff_movedToUri"; -ALTER TABLE "user" DROP COLUMN "ff_alsoKnownAs"; -ALTER TABLE "user" DROP COLUMN "ff_isIndexable"; -ALTER TABLE "user" DROP COLUMN "ff_speakAsCat"; -ALTER TABLE "user_profile" DROP COLUMN "ff_preventAiLearning"; -ALTER TABLE "meta" DROP COLUMN "ff_silencedHosts"; - -``` + BEGIN; + + -- all existing users are approved, because Firefish doesn't have a + -- concept of approvals + UPDATE "user" SET approved = true; + + -- now we put back the data we moved aside + UPDATE "user" SET "movedToUri" = "ff_movedToUri" WHERE "ff_movedToUri" IS NOT NULL; + UPDATE "user" SET "alsoKnownAs" = "ff_alsoKnownAs" WHERE "ff_alsoKnownAs" IS NOT NULL; + UPDATE "user" SET "noindex" = NOT (COALESCE("ff_isIndexable", true)); + UPDATE "user" SET "speakAsCat" = COALESCE("ff_speakAsCat", false); + UPDATE "user_profile" SET "preventAiLearning" = COALESCE("ff_preventAiLearning", true); + UPDATE "meta" SET "silencedHosts" = COALESCE("ff_silencedHosts",'{}'); + + ALTER TABLE "user" DROP COLUMN "ff_movedToUri"; + ALTER TABLE "user" DROP COLUMN "ff_alsoKnownAs"; + ALTER TABLE "user" DROP COLUMN "ff_isIndexable"; + ALTER TABLE "user" DROP COLUMN "ff_speakAsCat"; + ALTER TABLE "user_profile" DROP COLUMN "ff_preventAiLearning"; + ALTER TABLE "meta" DROP COLUMN "ff_silencedHosts"; If everything worked and you saw no errors, you can run `COMMIT;` in that same `psql` shell, to commit all the changes, then close that