Skip to content

Commit cbedb37

Browse files
committed
Added migration guide
1 parent 6340bdd commit cbedb37

1 file changed

Lines changed: 57 additions & 1 deletion

File tree

docs/upgrade/1_to_2.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,64 @@ ships all required dependencies and is always up to date with the latest require
2525
about the requirements at all.
2626

2727
## Changes
28+
* Configuration is now preferably done via a web settings interface. You can still use environment variables, these overwrite
29+
the settings in the web interface. Existing configuration will still work, but you should consider migriting them to the
30+
web interface as described below.
2831
* The `config/banner.md` file that could been used to customize the banner text, was removed. You can now set the banner text
2932
directly in the admin interface, or by setting the `BANNER` environment variable. If you want to keep your existing
3033
banner text, you will have to copy it from the `config/banner.md` file to the admin interface or set the `BANNER`
3134
environment variable.
32-
35+
* The parameters `partdb.sidebar.items`, `partdb.sidebar.root_node_enable` and `partdb.sidebar.root_expanded` in `config/parameters.yaml`,
36+
were removed. You can configure them now directly in the admin interface.
37+
* Updated icon set. As fontawesome 7 is now used, some icons have changed slightly.
38+
39+
## Upgrade installation
40+
41+
The upgrade process works very similar to a normal (minor release) upgrade.
42+
43+
### Direct installation
44+
45+
**Be sure to execute the following steps as the user that owns the Part-DB files (e.g. `www-data`, or your webserver user). So prepend a `sudo -u wwww-data` where necessary.**
46+
47+
1. Make a backup of your existing Part-DB installation, including the database, data directories and the configuration files and `.env.local` file.
48+
The `php bin/console partdb:backup` command can help you with this.
49+
2. Pull the v2 version. For git installation you can do this with `git checkout v2.0.0` (or newer version)
50+
3. Run `composer install --no-dev -o` to update the dependencies.
51+
4. Run `yarn install` and `yarn build` to update the frontend assets.
52+
5. Rund `php bin/console doctrine:migrations:migrate` to update the database schema.
53+
6. Clear the cache with `php bin/console cache:clear`.
54+
7. Open your Part-DB instance in the browser and log in as an admin user.
55+
8. Go to the user or group permissions page, and give yourself (and other administrators) the right to change system settings (under "System" and "Configuration").
56+
9. You can now go to the settings page (under "System" and "Settings") and check if all settings are correct.
57+
10. Parameters which were previously set via environment variables are greyed out and cannot be changed in the web interface.
58+
If you want to change them, you must migrate them to the settings interface as described below.
59+
60+
### Docker installation
61+
1. Make a backup of your existing Part-DB installation, including the database, data directories and the configuration files and the file where you configure the docker environment variables.
62+
2. Stop the existing Part-DB container with `docker compose down`
63+
3. Ensure that your docker compose file uses the new latest images (either `latest` or `2` tag).
64+
4. Pull the new images with `docker compose pull` and start the container with `docker compose up -d`
65+
5. If you have database automigration disabled, run `docker exec --user=www-data partdb php bin/console doctrine:migrations:migrate` to update the database schema.
66+
6. Open your Part-DB instance in the browser and log in as an admin user.
67+
7. Go to the user or group permissions page, and give yourself (and other administrators)
68+
the right to change system settings (under "System" and "Configuration").
69+
8. You can now go to the settings page (under "System" and "Settings")
70+
9. Parameters which were previously set via environment variables are greyed out and cannot be changed in the web interface.
71+
If you want to change them, you must migrate them to the settings interface as described below.
72+
73+
## Migrate environment variable configuration to settings interface
74+
As described above, configuration can now be done via the web interface, and can be overwritten by environment variables, so
75+
that existing configuration should still work. However, if a parameter is set via an environment variable, it cannot be changed in the web interface.
76+
To change it, you must migrate your environment variable configuration to the new system.
77+
78+
For this there is the new console command `settings:migrate-env-to-settings`, which reads in all environment variables used to overwrite
79+
settings and write them to the database, so that you can safely delete them from your environment variable configuration afterwards, without
80+
loosing your configuration.
81+
82+
To run the command, execute `php bin/console settings:migrate-env-to-settings --all` as webserver user (or run `docker exec --user=www-data -it partdb php bin/console settings:migrate-env-to-settings --all` for docker containers).
83+
It will list you all environment variables, it found and ask you for confirmation to migrate them. Answer with `yes` to migrate them and hit enter.
84+
85+
After the migration run successfully, the contents of your environment variables are now stored in the database and you can safely remove them from your environment variable configuration.
86+
Go through the environment variables listed by the command and remove them from your environment variable configuration (e.g. `.env.local` file or docker compose file), or just comment them out for now.
87+
88+
If you want to keep some environment variables, just leave them as they are, they will still work as before, the migration command only affects the settings stored in the database.

0 commit comments

Comments
 (0)