hippofish/docs/downgrade.md

79 lines
2.3 KiB
Markdown
Raw Normal View History

2024-02-07 15:54:05 +01:00
# Downgrading to `v20240206`
2024-05-20 12:42:15 +02:00
## systemd/pm2
2024-02-07 15:54:05 +01:00
1. Stop the Firefish service
```sh
sudo systemctl stop your-firefish-service.service
2024-05-20 12:42:15 +02:00
# or pm2 stop firefish
2024-02-07 15:54:05 +01:00
```
1. Take a backup
1. Revert database migrations
```sh
sudo --user=postgres psql --file=docs/downgrade.sql --dbname=database_name
```
The database name can be found in `.config/default.yml`.
```yaml
db:
port: 5432
db: database_name # this one
user: firefish
pass: password
```
2024-02-07 15:54:05 +01:00
1. Switch back to the `v20240206` tag
```sh
2024-05-20 12:42:15 +02:00
git switch --detach v20240206
2024-02-07 15:54:05 +01:00
```
1. Rebuild Firefish
```sh
pnpm install --frozen-lockfile
NODE_ENV='production' NODE_OPTIONS='--max_old_space_size=3072' pnpm run rebuild
```
1. Start the Firefish service and confirm that Firefish is downgraded
```sh
sudo systemctl start your-firefish-service.service
2024-05-20 12:42:15 +02:00
# or pm2 start firefish
2024-02-07 15:54:05 +01:00
```
## Docker/Podman
1. Stop the container
```sh
docker-compose down
# or podman-compose down
```
1. Take a backup
1. Revert database migrations
```sh
docker-compose exec db psql --command="$(cat docs/downgrade.sql)" --user=user_name --dbname=database_name
2024-02-22 09:40:03 +01:00
# or podman-compose exec db psql --command="$(cat docs/revert.sql)" --user=user_name --dbname=database_name
```
The user and database name can be found in `.config/docker.env`.
```env
POSTGRES_PASSWORD=password
POSTGRES_USER=user_name # user name
POSTGRES_DB=database_name # database name
```
2024-03-25 18:21:30 +01:00
1. Change Firefish image tag from `latest` to `v20240206`
2024-02-07 15:54:05 +01:00
```sh
vim docker-compose.yml
```
```yaml
version: "3"
services:
web:
image: registry.firefish.dev/firefish/firefish:v20240206 # here
```
2024-03-25 18:21:30 +01:00
1. Change database image from `docker.io/groonga/pgroonga` to `docker.io/postgres`
Please make sure to use the same PostgreSQL version. For example, if you are using `docker.io/groonga/pgroonga:3.1.8-alpine-16`, you should change it to `docker.io/postgres:16-alpine`. PGroonga images are tagged as `{PGroonga version}-{alpine or debian}-{PostgreSQL major version}`. PostgreSQL image tags can be found at <https://hub.docker.com/_/postgres/tags>.
2024-02-07 15:54:05 +01:00
1. Start the container and confirm that Firefish is downgraded
```sh
docker-compose up --detach
# or podman-compose up --detach
```