Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Documentation
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avera
Documentation
Commits
65b8bd71
Commit
65b8bd71
authored
1 month ago
by
AverageDood
Browse files
Options
Downloads
Patches
Plain Diff
Add Iceshrimp migration docs
parent
b847ee6d
No related branches found
No related tags found
No related merge requests found
Pipeline
#2354
failed with stages
in 17 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
content/en/docs/install/migrate.md
+171
-0
171 additions, 0 deletions
content/en/docs/install/migrate.md
with
171 additions
and
0 deletions
content/en/docs/install/migrate.md
+
171
−
0
View file @
65b8bd71
...
...
@@ -266,3 +266,174 @@ If you use an object store such as S3, double-check your settings
be able to search notes, you must enable it via the "roles" system.
Congratulations, you're now running Sharkey!
## From Iceshrimp
This guide was only tested on an Iceshrimp-JS instance, on version v20223.12.11. Iceshrimp.NET is not supported,
and as far as known, the migration from Iceshrimp-JS to Iceshrimp.NET is a one way street.
Furthermore, this was tested on a
**vanilla**
Iceshrimp-JS instance. Other Iceshrimp instances
that may run with custom patches may require a different treatment.
If any of the steps fails, especially SQL queries, seek help from us
[
Via Discord
](
https://discord.gg/8hF6pMVWja
)
. Do
*not*
try fixing things
in the DB yourself unless you
*really*
know what you are doing.
Before you begin, please take a backup of your database. While you're
there, make sure you know how to restore from that backup! Using the
`plain`
format for
`pg_dump`
is probably the simplest way.
It's a good idea to have a separate backup of your list of silenced
instances and of your
`user`
table.
### Using Docker
Stop / shut down the entire stack: PostgreSQL, Redis / Valkey and
Iceshrimp itself. Stop all of it.
Now is the time to
*backup*
your database and Redis volumes!
You will need to revert Iceshrimp migrations back to the last common one with
Firefish, which should leave you on Firefish 1.0.2 schema.
First, connect to the database container. Start
*only*
the database with
`docker compose up -d db`
(instead of
`db`
, you may need to use whatever name is set for the service in
your docker compose config), and start a
`psql`
shell with
`docker
exec -it db psql -U iceshrimp -d iceshrimp`
(replace
`db`
as before, and
`-U iceshrimp -d iceshrimp`
with the database user and database name,
respectively, if they're different from
`iceshrimp`
).
You should now be connected to your Iceshrimp database. We need first to delete from the
tables 3 of the Iceshrimp migrations that are not able to be reverted, regarding OAuth and
instance's max character limit. Don't worry, the OAuth is going to be dropped enterily by
one of the migration reverts, and the max character limit does not conflict with Sharkey, and
in fact, could be overwritten safely by a Sharkey migration.
Make sure you have a backup safely stored, and then delete the mentioned
migrations with the following queries:
```
sql
DELETE
FROM
"migrations"
WHERE
"name"
=
'IncreaseHostCharLimit1701118152149'
;
DELETE
FROM
"migrations"
WHERE
"name"
=
'IncreaseOauthTokenRedirecturisLength1697286869039'
;
DELETE
FROM
"migrations"
WHERE
"name"
=
'IncreaseOAuthRedirecturisLength1697246035867'
;
```
We are now ready to start reverting Iceshrimp migrations.
Edit the
`docker-compose.yml`
file and add
`entrypoint: /bin/sh`
to the web section of the file.
Save the file and start the container with
`docker-compose up -d web`
, and then run
`docker exec -it iceshrimp_web sh`
.
Replace "iceshrimp_web" with the name of your container if you've changed it.
Now, navigate to the Iceshrimp directory, and inside of it, nagivate to
`packages/backend`
.
The command to run in order to revert the latest applies migration is
```
yarn run typeorm migration:revert -d built/ormconfig.js
```
You'll have to run it several times, until you see that
`IceshrimpRepo1689965609061`
has been reverted.
You're now back on the Firefish 1.0.2 database scheme.
Exit the shell and run
`docker compose down web`
to stop the Iceshrimp container.
Now, edit you docker compose and replace the Iceshrimp image with
`registry.activitypub.software/transfem-org/sharkey:latest`
Backup your Iceshrimp config and replace it with the
[
default
Sharkey one
](
https://activitypub.software/TransFem-org/Sharkey/-/raw/stable/.config/docker_example.yml
)
Edit the config inline with your instance settings. Make sure to use
the same
`db`
&
`redis`
settings as in your Iceshrimp config.
Make sure to update the
*mount paths*
for volumes of the Sharkey
container from
`/iceshrimp/`
to
`/sharkey/`
(so your existing volumes
will show up at the new path, inside the container).
Now we need to massage the database into shape so that Sharkey database migrations will
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
;
-- move aside some existing 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
"ish_movedToUri"
;
ALTER
TABLE
"user"
RENAME
COLUMN
"alsoKnownAs"
TO
"ish_alsoKnownAs"
;
ALTER
TABLE
"user"
RENAME
COLUMN
"speakAsCat"
TO
"ish_speakAsCat"
;
ALTER
TABLE
"user_profile"
RENAME
COLUMN
"preventAiLearning"
TO
"ish_preventAiLearning"
;
ALTER
TABLE
"meta"
RENAME
COLUMN
"silencedHosts"
TO
"ish_silencedHosts"
;
-- this column was added by both Iceshrimp, 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
shell. Again, if anything went wrong, come talk to us on
[
Matrix
](
https://matrix.to/#/#sharkey-support:shourai.de
)
or
[
Discord
](
https://discord.gg/8hF6pMVWja
)
!
Start Sharkey, and let it run all its migrations. Once that's done,
and Starkey says it's listening, stop Sharkey but keep the database
running.
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"
=
"ish_movedToUri"
WHERE
"ish_movedToUri"
IS
NOT
NULL
;
UPDATE
"user"
SET
"alsoKnownAs"
=
"ish_alsoKnownAs"
WHERE
"ish_alsoKnownAs"
IS
NOT
NULL
;
UPDATE
"user"
SET
"speakAsCat"
=
COALESCE
(
"ish_speakAsCat"
,
false
);
UPDATE
"user_profile"
SET
"preventAiLearning"
=
COALESCE
(
"ish_preventAiLearning"
,
true
);
UPDATE
"meta"
SET
"silencedHosts"
=
COALESCE
(
"ish_silencedHosts"
,
'{}'
);
ALTER
TABLE
"user"
DROP
COLUMN
"ish_movedToUri"
;
ALTER
TABLE
"user"
DROP
COLUMN
"ish_alsoKnownAs"
;
ALTER
TABLE
"user"
DROP
COLUMN
"ish_speakAsCat"
;
ALTER
TABLE
"user_profile"
DROP
COLUMN
"ish_preventAiLearning"
;
ALTER
TABLE
"meta"
DROP
COLUMN
"ish_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
shell. Again, if anything went wrong, come talk to us on
[
Discord
](
https://discord.gg/8hF6pMVWja
)
!
Start everything up again, you should see no errors in the logs.
Log in as an administrator, and go to the control panel.
If you use an object store such as S3, double-check your settings
(it's possible, for example, that the URL now looks like
`https://https://yourdomain.com`
, fix it). If you want your users to
be able to search notes, you must enable it via the "roles" system.
Congratulations, you're now running Sharkey!
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment