mirror of
https://github.com/inventree/inventree-docs.git
synced 2025-04-27 21:26:43 +00:00
Migration docs (#309)
* Move update docs to bare metal install page * Fix link on faq page * Expand migration instructions
This commit is contained in:
parent
f2a9404c8a
commit
c795fe2ddf
@ -18,10 +18,10 @@ The most common problem here is that the correct sequenct of steps has not been
|
||||
For more information, refer to the installation guides:
|
||||
|
||||
- [Docker Installation](./start/docker_prod.md#updating-inventree)
|
||||
- [Bare Metal Installation](./start/update.md)
|
||||
- [Bare Metal Installation](./start/install.md#updating-inventree)
|
||||
|
||||
!!! warning "Invoke Update"
|
||||
You must ensure that the `invoke update` command is perfomed every time you update InvenTree
|
||||
You must ensure that the `invoke update` command is perfomed *every time* you update InvenTree
|
||||
|
||||
### Feature *x* is not visible after update
|
||||
|
||||
|
@ -2,9 +2,12 @@
|
||||
title: Install InvenTree
|
||||
---
|
||||
|
||||
## Initial Setup
|
||||
## Bare Metal Setup
|
||||
|
||||
Follow the instructions below to install the requried system packages, python modules, and InvenTree source code.
|
||||
!!! tip "Docker Guide"
|
||||
This guide is for a *bare metal* InvenTree installation. If you want to install using Docker (the recommended approach) refer to the [Docker Guide](./docker.md)
|
||||
|
||||
Follow the instructions below to install the required system packages, python modules, and InvenTree source code.
|
||||
|
||||
### Install System Packages
|
||||
|
||||
@ -249,3 +252,49 @@ Refer to the [development server instructions](./development.md) for further inf
|
||||
In a production environment, a more robust server setup is required.
|
||||
|
||||
Refer to the [production server instructions](./production.md) for further information.
|
||||
|
||||
## Updating InvenTree
|
||||
|
||||
Administrators wishing to update InvenTree to the latest version should follow the instructions below. The commands listed below should be run from the InvenTree root directory.
|
||||
|
||||
!!! info "Update Database"
|
||||
It is advisable to backup the InvenTree database before performing these steps. The particular backup procedure may depend on your installation details.
|
||||
|
||||
### Stop InvenTree Server
|
||||
|
||||
Ensure the InvenTree server is stopped. This will depend on the particulars of your database installation.
|
||||
|
||||
!!! info "Stop Server"
|
||||
The method by which the InvenTree server is stopped depends on your particular installation!
|
||||
|
||||
### Update Source Code
|
||||
|
||||
Update the InvenTree source code to the latest version (or a particular commit if required).
|
||||
|
||||
For example, pull down the latest InvenTree sourcecode using Git:
|
||||
|
||||
```
|
||||
git pull origin master
|
||||
```
|
||||
|
||||
!!! info "Release Versions"
|
||||
If you are using a particular version of InvenTree, you may wish to target a specific code branch or tag, instead of just pulling down latest master
|
||||
|
||||
### Perform Database Migrations
|
||||
|
||||
Updating the database is as simple as calling the `update` script:
|
||||
|
||||
```
|
||||
invoke update
|
||||
```
|
||||
|
||||
This command performs the following steps:
|
||||
|
||||
* Ensure all rquired packages are installed and up to date
|
||||
* Perform required database schema changes
|
||||
* Run the user through any steps which require interaction
|
||||
* Collect any new or updated static files
|
||||
|
||||
### Restart Server
|
||||
|
||||
Ensure the InvenTree server is restarted. This will depend on the particulars of your database installation.
|
||||
|
@ -64,7 +64,7 @@ InvenTree makes use of the [invoke](https://www.pyinvoke.org/) python toolkit fo
|
||||
To display a list of the available InvenTree administration actions, run the following commands from the top level source directory:
|
||||
|
||||
```
|
||||
inv --list
|
||||
invoke --list
|
||||
```
|
||||
|
||||
### Virtual Environment
|
||||
|
@ -2,16 +2,15 @@
|
||||
title: Migrating Data
|
||||
---
|
||||
|
||||
## Migrating Data
|
||||
|
||||
In the case that data needs to be migrated from one database installation to another, the following procedure can be used to export data, initialize the new database, and re-import the data.
|
||||
## Migrating Data to a Different Database
|
||||
|
||||
In the case that data needs to be migrated from one database installation to another, the following procedure can be used to export data, initialize the new database, and re-import the data. The following instructions apply to bare-metal and docker installations, although the particular commands required may vary slightly in each case.
|
||||
|
||||
!!! warning "Backup Database"
|
||||
Ensure that the original database is securely backed up first!
|
||||
|
||||
!!! info "Up to Date"
|
||||
Ensure that the original database is up to date, by running `inv migrate`
|
||||
!!! danger "Database Versions"
|
||||
It is *crucial* that both InvenTree database installations are running the same version of InvenTree software! If this is not the case, data migration may fail, and there is a possibility that data corruption can occur. Ensure that the original database is up to date, by running `invoke update`.
|
||||
|
||||
### Export Data
|
||||
|
||||
@ -24,29 +23,33 @@ invoke export-records -f data.json
|
||||
This will create JSON file at the specified location which contains all database records.
|
||||
|
||||
!!! info "Specifying filename"
|
||||
The filename of the exported file can be specified using the `-f` option
|
||||
The filename of the exported file can be specified using the `-f` option. To see all available options, run `invoke export-records --help`
|
||||
|
||||
### Initialize New Database
|
||||
|
||||
Configure the new database using the normal processes (see [Configuration](./config.md))
|
||||
|
||||
!!! warning "InvenTree Version"
|
||||
Ensure that the *new* installation is running *exactly* the same version of InvenTree as the installation from which you exported the data.
|
||||
|
||||
Then, ensure that the database schema are correctly initialized in the new database:
|
||||
|
||||
```
|
||||
invoke migrate
|
||||
invoke update
|
||||
```
|
||||
|
||||
This ensures that the required database tables exist, which must be the case before data can be imported.
|
||||
This step ensures that the required database tables exist, and are at the correct schema version, which must be the case before data can be imported.
|
||||
|
||||
|
||||
### Import Data
|
||||
|
||||
The new database should now be correctly initialized with the correct table structures requried to import the data. Run the following command to load the databased dump file into the new database.
|
||||
|
||||
!!! warning "Empty Database"
|
||||
If the database is not *empty* (i.e. it contains data records) then the data import process will fail. If errors occur during the import process, run `invoke delete-data` to clear all existing data from the database.
|
||||
If the database is not *empty* (i.e. it contains data records) then the data import process will fail. If errors occur during the import process, run `invoke import-records` with the `-c` option to clear all existing data from the database.
|
||||
|
||||
```
|
||||
invoke import-records -f data.json
|
||||
invoke import-records -c -f data.json
|
||||
```
|
||||
|
||||
!!! info "Import Filename"
|
||||
@ -54,3 +57,39 @@ invoke import-records -f data.json
|
||||
|
||||
!!! warning "Character Encoding"
|
||||
If the character encoding of the data file does not exactly match the target database, the import operation may not succeed. In this case, some manual editing of the database JSON file may be required.
|
||||
|
||||
## Migrating Data to Newer Version
|
||||
|
||||
If you are updating from an older version of InvenTree to a newer version, the migration steps outlined above *do not apply*.
|
||||
|
||||
An update from an old version to a new one requires not only that the database *schema* are updated, but the *data* held within the database must be updated in the correct sequence.
|
||||
|
||||
Follow the sequence of steps below to ensure that the database records are updated correctly.
|
||||
|
||||
!!! warning "Backup Database"
|
||||
When updating, it is always prudent to ensure that the database records are backed up first
|
||||
|
||||
### Stop InvenTree
|
||||
|
||||
Ensure that the InvenTree server and worker processes are not running.
|
||||
|
||||
!!! tip "Example: Docker"
|
||||
If running under docker, run `docker compose down`
|
||||
|
||||
### Fetch New InvenTree Version
|
||||
|
||||
Download the specific version of InvenTree you wish to update to.
|
||||
|
||||
!!! tip "Example: Docker"
|
||||
If running under docker, edit `docker-compose.yml` and then run `docker compose pull`
|
||||
|
||||
### Run Update Process
|
||||
|
||||
Run the update and migration script using `invoke update`. This ensures that the database schema and records are udpated in the correct order.
|
||||
|
||||
### Restart Server
|
||||
|
||||
Once the migration process completes, the database records are now updated! Restart the server and the process is complete.
|
||||
|
||||
!!! tip "Example: Docker"
|
||||
If running under docker, run `docker compose up -d`
|
||||
|
@ -1,49 +0,0 @@
|
||||
---
|
||||
title: Update InvenTree
|
||||
---
|
||||
|
||||
## Update InvenTree
|
||||
|
||||
Administrators wishing to update InvenTree to the latest version should follow the instructions below. The commands listed below should be run from the InvenTree root directory.
|
||||
|
||||
!!! info "Update Database"
|
||||
It is advisable to backup the InvenTree database before performing these steps. The particular backup procedure may depend on your installation details.
|
||||
|
||||
### Stop InvenTree Server
|
||||
|
||||
Ensure the InvenTree server is stopped. This will depend on the particulars of your database installation.
|
||||
|
||||
!!! info "Stop Server"
|
||||
The method by which the InvenTree server is stopped depends on your particular installation!
|
||||
|
||||
### Update Source Code
|
||||
|
||||
Update the InvenTree source code to the latest version (or a particular commit if required).
|
||||
|
||||
For example, pull down the latest InvenTree sourcecode using Git:
|
||||
|
||||
```
|
||||
git pull origin master
|
||||
```
|
||||
|
||||
!!! info "Release Versions"
|
||||
If you are using a particular version of InvenTree, you may wish to target a specific code branch or tag, instead of just pulling down latest master
|
||||
|
||||
### Perform Database Migrations
|
||||
|
||||
Updating the database is as simple as calling the `update` script:
|
||||
|
||||
```
|
||||
invoke update
|
||||
```
|
||||
|
||||
This command performs the following steps:
|
||||
|
||||
* Ensure all rquired packages are installed and up to date
|
||||
* Perform required database schema changes
|
||||
* Run the user through any steps which require interaction
|
||||
* Collect any new or updated static files
|
||||
|
||||
### Restart Server
|
||||
|
||||
Ensure the InvenTree server is restarted. This will depend on the particulars of your database installation.
|
@ -66,8 +66,7 @@ nav:
|
||||
- Configuration: start/config.md
|
||||
- Docker Setup: start/docker.md
|
||||
- Bare Metal Setup: start/install.md
|
||||
- Updating: start/update.md
|
||||
- Migrating: start/migrate.md
|
||||
- Migrating Data: start/migrate.md
|
||||
- Parts:
|
||||
- Parts: part/part.md
|
||||
- Creating Parts: part/create.md
|
||||
|
Loading…
x
Reference in New Issue
Block a user