mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +00:00 
			
		
		
		
	Change dev environment setup to use postgresql
- sqlite causes too many errors - fix requirements file - fixes for docker setup - A lot of concurrency issues - Bite the bullet, time to go!
This commit is contained in:
		| @@ -101,7 +101,7 @@ RUN chown -R inventree:inventreegroup ${INVENTREE_HOME}/* | ||||
| USER inventree | ||||
|  | ||||
| # Install InvenTree packages | ||||
| RUN pip3 install --no-cache-dir --disable-pip-version-check -r ${INVENTREE_HOME}/requirements.txt | ||||
| RUN pip3 install --user --no-cache-dir --disable-pip-version-check -r ${INVENTREE_HOME}/requirements.txt | ||||
|  | ||||
| # Need to be running from within this directory | ||||
| WORKDIR ${INVENTREE_MNG_DIR} | ||||
|   | ||||
| @@ -2,14 +2,13 @@ | ||||
|  | ||||
| # Set DEBUG to False for a production environment! | ||||
| INVENTREE_DEBUG=True | ||||
|  | ||||
| # Change verbosity level for debug output | ||||
| INVENTREE_DEBUG_LEVEL=INFO | ||||
|  | ||||
| # Database linking options | ||||
| INVENTREE_DB_ENGINE=sqlite3 | ||||
| INVENTREE_DB_NAME=/home/inventree/dev/inventree_db.sqlite3 | ||||
| # INVENTREE_DB_HOST=hostaddress | ||||
| # INVENTREE_DB_PORT=5432 | ||||
| # INVENTREE_DB_USERNAME=dbuser | ||||
| # INVENTREE_DB_PASSWEORD=dbpassword | ||||
| # Database configuration options | ||||
| # Note: The example setup is for a PostgreSQL database (change as required) | ||||
| INVENTREE_DB_ENGINE=postgresql | ||||
| INVENTREE_DB_NAME=inventree | ||||
| INVENTREE_DB_HOST=inventree-dev-db | ||||
| INVENTREE_DB_PORT=5432 | ||||
| INVENTREE_DB_USER=pguser | ||||
| INVENTREE_DB_PASSWORD=pgpassword | ||||
|   | ||||
| @@ -1,8 +1,10 @@ | ||||
| version: "3.8" | ||||
|  | ||||
| # Docker compose recipe for InvenTree development server | ||||
| # - Runs sqlite3 as the database backend | ||||
| # - Runs PostgreSQL as the database backend | ||||
| # - Uses built-in django webserver | ||||
| # - Runs the InvenTree background worker process | ||||
| # - Serves media and static content directly from Django webserver | ||||
|  | ||||
| # IMPORANT NOTE: | ||||
| # The InvenTree docker image does not clone source code from git. | ||||
| @@ -11,10 +13,32 @@ version: "3.8" | ||||
| # The django server will auto-detect any code changes and reload the server. | ||||
|  | ||||
| services: | ||||
|  | ||||
|     # Database service | ||||
|     # Use PostgreSQL as the database backend | ||||
|     # Note: This can be changed to a different backend if required | ||||
|     inventree-dev-db: | ||||
|         container_name: inventree-dev-db | ||||
|         image: postgres:13 | ||||
|         ports: | ||||
|             - 5432/tcp | ||||
|         environment: | ||||
|           - PGDATA=/var/lib/postgresql/data/dev/pgdb | ||||
|           # The pguser and pgpassword values must be the same in the other containers | ||||
|           # Ensure that these are correctly configured in your dev-config.env file | ||||
|           - POSTGRES_USER=pguser | ||||
|           - POSTGRES_PASSWORD=pgpassword | ||||
|         volumes: | ||||
|           # Map 'data' volume such that postgres database is stored externally | ||||
|           - src:/var/lib/postgresql/data | ||||
|         restart: unless-stopped | ||||
|  | ||||
|     # InvenTree web server services | ||||
|     # Uses gunicorn as the web server | ||||
|     inventree-dev-server: | ||||
|         container_name: inventree-dev-server | ||||
|         depends_on: | ||||
|           - inventree-dev-db | ||||
|         build: | ||||
|             context: . | ||||
|             target: dev | ||||
|   | ||||
| @@ -27,7 +27,7 @@ fi | ||||
| if [[ -n "$INVENTREE_PY_ENV" ]]; then | ||||
|     echo "Using Python virtual environment: ${INVENTREE_PY_ENV}" | ||||
|     # Setup a virtual environment (within the "dev" directory) | ||||
|     python3 -m venv ${INVENTREE_PY_ENV} | ||||
|     python3 -m venv ${INVENTREE_PY_ENV} --system-site-packages | ||||
|  | ||||
|     # Activate the virtual environment | ||||
|     source ${INVENTREE_PY_ENV}/bin/activate | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
| INVENTREE_DEBUG=False | ||||
| INVENTREE_LOG_LEVEL=WARNING | ||||
|  | ||||
| # Database configuration | ||||
| # Database configuration options | ||||
| # Note: The example setup is for a PostgreSQL database (change as required) | ||||
| INVENTREE_DB_ENGINE=postgresql | ||||
| INVENTREE_DB_NAME=inventree | ||||
|   | ||||
| @@ -4,13 +4,9 @@ | ||||
| setuptools>=57.4.0 | ||||
| wheel>=0.37.0 | ||||
| invoke>=1.4.0                   # Invoke build tool | ||||
| gunicorn>=20.1.0                # Gunicorn web server | ||||
|  | ||||
| # Database links | ||||
| psycopg2>=2.9.1 | ||||
| mysqlclient>=2.0.3 | ||||
| pgcli>=3.1.0 | ||||
| mariadb>=1.0.7 | ||||
|  | ||||
| # Cache | ||||
| django-redis>=5.0.0 | ||||
|   | ||||
| @@ -21,6 +21,7 @@ django-markdownify==0.8.0       # Markdown rendering | ||||
| django-markdownx==3.0.1         # Markdown form fields | ||||
| django-money==1.1               # Django app for currency management | ||||
| django-mptt==0.11.0             # Modified Preorder Tree Traversal | ||||
| django-redis>=5.0.0 | ||||
| django-q==1.3.4                 # Background task scheduling | ||||
| django-sql-utils==0.5.0         # Advanced query annotation / aggregation | ||||
| django-stdimage==5.1.1          # Advanced ImageField management | ||||
|   | ||||
		Reference in New Issue
	
	Block a user