inventree / InvenTree

Open Source Inventory Management System
https://docs.inventree.org
MIT License
4.01k stars 714 forks source link

Migrating from bare metal production to the Installer script #4138

Closed joaoferreira-git closed 1 year ago

joaoferreira-git commented 1 year ago

Deployment Method

Describe the problem*

I was using a bare metal install with debug: True to be able to view images and once again i managed to nuke my install i want to migrate to the Installer deployment since it's a lot easier to installer and to update.

The problem im having is that after running the install script is automatically chooses the sqlite database but the one i had was using postgresql and i don´t know how to install the postgresql using the script or if this doesn't work. The previous version was 8.4 iirc and i think i managed to update the DB to 9.1 and since it was giving a fatal error in supervisord i just exported the DB, I have a backup from when it tried to update with all the part photos.

It kinda sucks if i have to do it all again because i must have over 100 stock location labels printed that i had to copy to word, print it and then cut them one by one because i used some cheap label paper i found on amazon since i don't have a label printer.

I also tried to install using docker but i can't figure it out, tried using portainer and it was giving a error about missing a .env file even though i used the .env file to add the variables and it didn't even deploy.. Tried using the Docker Compose Manager for Unraid and it managed to deploy the 3 containers but the inventree-server was constantly restarting and i was unable to perform the first step where i had to do invoke update, after this i gave up and decided to use the installer.

Steps to Reproduce

.

Relevant log output

No response

matmair commented 1 year ago

@joaoferreira-git Running with debug:true is not recommended, regardless of the deployment method. This exposes a lot of information and makes your instance highly insecure.

You can reuse/continue to use your Postgres instance. Just run the following lines before starting the installer:

export INVENTREE_DB_ENGINE="postgresql"
export INVENTREE_DB_NAME="inventree"
export INVENTREE_DB_USER="inventree"
export INVENTREE_DB_PASSWORD="inventree_password"
export INVENTREE_DB_HOST="localhost"
export INVENTREE_DB_PORT="5432"
export SETUP_EXTRA_PIP="psycopg2-binary pgcli"

Replace with the appropriate data for your instance.

joaoferreira-git commented 1 year ago

@matmair Thanks for the fast response.

If i setup a new VM to start clean how would i import the current database and media files? EDIT: New VM for a clean install with the commands you said and then running the script results in a 502 bad gateway.

One more thing when i used the script it installed the 9.0 version and even after doing apt install --only-upgrade inventree it would not update to 9.1 and said it was on the latest version.

joaoferreira-git commented 1 year ago

@matmair I actually got it working in a portainer stack now i just need a bit of help importing my old database and if possible the part images.

By opening a shell and going to /home/inventree i was able to do invoke update so im guessing the import command should be done either here or in /home/inventree/data. The strange thing is that used the INVENTREE_EXT_VOLUME=/mnt/user/appdata/inventree for the storage location but all of the files are in a docker volume /var/lib/docker/volumes/inventree_inventree_data/_data, this might be right since im still a noob at docker but it feels like it's wrong so i'd just like to point it out.

matmair commented 1 year ago

@matmair I actually got it working in a portainer stack now i just need a bit of help importing my old database and if possible the part images.

By opening a shell and going to /home/inventree i was able to do invoke update so im guessing the import command should be done either here or in /home/inventree/data.

You need to mount the data you exported from the old instance in the new instance and then run the import script in /home/inventree.

The strange thing is that used the INVENTREE_EXT_VOLUME=/mnt/user/appdata/inventree for the storage location but all of the files are in a docker volume /var/lib/docker/volumes/inventree_inventree_data/_data, this might be right since im still a noob at docker but it feels like it's wrong so i'd just like to point it out.

Maybe there is something wrong with the docker compose. Maybe check the guide again.

joaoferreira-git commented 1 year ago

Thanks @matmair for all the help, now i have it running in docker with the bulk creation plugin and my old database. The best inventory system i found, easy to use and with the best support, no regrets for buying the android app a couple of months ago.

matmair commented 1 year ago

@joaoferreira-git happy to hear. We are a small but active team of enthusiasts. Buying the app is appreciated even as everybody gets the same support.

matmair commented 1 year ago

I think this should be answered as is. Please reopen if you feel we need to add anything @joaoferreira-git.