iceshrimp/docs/migrate.md

67 lines
4.2 KiB
Markdown
Raw Permalink Normal View History

# 🚚 Migrating from Firefish to Iceshrimp
2023-02-21 05:13:55 +09:00
2024-09-15 00:36:07 +09:00
> **Warning**
> Before proceeding, please **ensure you have an *up-to-date* backup of the database.**
2023-05-03 08:53:57 +09:00
## Preparations
2024-09-07 00:40:03 +09:00
First, follow Firefish's [downgrade guide](https://firefish.dev/firefish/firefish/-/blob/downgrade/docs/downgrade.md) to get back to v1.0.5-rc. When prompted to switch the docker image/git tag, make sure to pick `v1.0.5-rc`, and not `v20240206`. This is to make sure that the migration patch applies correctly.
### Docker
2024-09-06 09:22:31 +09:00
First, stop the container by running `docker compose down`.
2023-05-03 08:53:57 +09:00
2024-09-06 09:22:31 +09:00
Now, run `docker-compose run --rm --entrypoint '/bin/bash' web` to get a shell in the main container.
2023-05-03 08:53:57 +09:00
### Bare metal
2024-09-06 09:22:31 +09:00
First, stop the service. If using systemd, run `sudo systemctl stop firefish.service`.
Now, `cd` into the root of your firefish repository.
## Applying the migrations patch
To make sure migrations revert correctly, run `curl -s https://iceshrimp.dev/iceshrimp/iceshrimp/raw/branch/dev/docs/firefish-redis.patch | git apply --ignore-whitespace`. This will patch two built JS files related to redis. The patch is ephemeral, once you complete the migration process it will no longer apply. Iceshrimp-JS has the patch built in.
2023-02-21 05:13:55 +09:00
## Reverting the migrations
To begin, run `cd packages/backend` to switch to the backend workspace.
2023-02-26 03:08:37 +09:00
Now, revert all of the typeorm migrations. reverted. To do this, run the command `pnpm run revertmigration:typeorm` until the output confirms that the migration `FirefishRepo1689957674000` has been reverted successfully.
2023-02-21 05:13:55 +09:00
If migration `IncreaseHostCharLimit1692374635734` failed to revert, please run `DELETE FROM "migrations" WHERE "name" = 'IncreaseHostCharLimit1692374635734';` in the database shell.
If you get any other errors here please ask for support in the [chat room](https://chat.iceshrimp.dev).
2023-02-21 05:13:55 +09:00
Finally, revert all the cargo migrations, by running `pnpm run revertmigration:cargo` until `m20230806_170616_fix_antenna_stream_ids` has been reverted. Again, if you get any errors, please ask for support in the [chat room](https://chat.iceshrimp.dev).
2023-02-21 05:13:55 +09:00
## Switching to Iceshrimp
### Docker
First, run `docker compose down` to shut down firefish.
2023-02-21 05:13:55 +09:00
Now, switch out image for the `web` container with `iceshrimp.dev/iceshrimp/iceshrimp:latest`.
Furthermore, for every volume/mount that's mapped to /firefish, switch it out for /iceshrimp (leaving any trailing text intact).
2023-02-26 03:08:37 +09:00
Finally, run `docker compose up`, and make sure that it starts up correctly. If everything works, press CTRL+C and run `docker compoe up -d` to start it in the background.
2023-03-31 11:34:42 +09:00
If you get any errors on startup, please ask for support in the [chat room](https://chat.iceshrimp.dev).
2023-12-12 00:10:14 +09:00
### Bare metal
Before you begin, make sure `git-lfs` is installed on the system, and that the firefish service is stopped.
2023-12-12 00:10:14 +09:00
Then, switch back to the repository root directory and run `git remote set-url origin https://iceshrimp.dev/iceshrimp/iceshrimp.git`, as well as `git lfs install`.
2023-12-11 23:52:48 +09:00
Now, run `git fetch --all` to fetch the new commits.
2023-12-11 23:52:48 +09:00
2024-09-11 01:09:20 +09:00
If you get an error like `couldn't find remote ref` here, run `git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"`, followed by `git remote prune origin` and `git fetch --all`. If you still get any errors, please ask for support in the [chat room](https://chat.iceshrimp.dev).
Then, run `git checkout dev` to switch to the `dev` branch, or `git checkout <tag>` to switch to a versioned tag. Make sure to run `git lfs pull` as well, to get all the dependencies.
2023-12-11 23:52:48 +09:00
Now, run `yarn && yarn build && yarn migrate` to install dependencies, build the project & run all pending migrations.
2023-03-31 11:34:42 +09:00
Finally, to clean up now-unnecessary files, run `rm -rf packages/backend/native-utils packages/megalodon`.
You should now be able to start the service back up.
If you get any errors during this process, please ask for support in the [chat room](https://chat.iceshrimp.dev).
## Closing notes
Please check out the [example configuration file](https://iceshrimp.dev/iceshrimp/iceshrimp/src/branch/dev/.config/example.yml), as it's changed quite a bit since Firefish and you may want to make use of the new features.
If you need further assistance for any reason, please ask for help in the [chat room](https://chat.iceshrimp.dev), we will assist you with the migration.