-
Notifications
You must be signed in to change notification settings - Fork 1
Installation
Evan J edited this page Oct 8, 2021
·
7 revisions
Make sure you have a MySQL database running (use this to set it up via Docker) with the correct database schema
- Clone the repo by running
$ git clone https://github.com/ejach/InventoryApplication.git
-
cd
into the cloned directory$ cd InventoryApplication
- Change the environment variables to your liking by exporting them shown in
example.env
# Host for the MySQL database and the WebUI (default is localhost)
host=localhost
# Host for the WebUI
webui_host=localhost
# Port for the WebUI using a WSGI server (default is 5000 for development, 8000 for production)
webui_port=5000
# Username for the MySQL database (default is root)
username=root
# Password for the MySQL database (default is root)
password=root
# Port for the MySQL database (default is 3306)
db_port=3306
# Database schema name in the MySQL database (default is parts)
db_schema=parts
# Database table in the MySQL database (default is parts)
db=parts
-
Install the requirements
$ pip install -r requirements.txt
Make sure that your user has read/write permissions in the database/table that has been created or else it will not work.
-
Run the program using
python wsgi.py
$ docker run -it -e host=<host> -e port=<port> -e webui_host=<webui_host> -e webui_port=<webui_port> -e db_port=<db_port> -e db=<db> ghcr.io/ejach/inventoryapplication:latest
Change the corresponding environment variables as needed
- Run
$ docker volume create --name db-data
to create the volume used by the MySQL database - Use the docker-compose file and edit the
environment
variables as needed:
version: '3.8'
services:
db:
image: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: parts
volumes:
- db-data:/var/lib/mysql
ports:
- "3308:3306"
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
restart: always
environment:
PMA_HOST: db
PMA_USER: root
PMA_PASSWORD: root
ports:
- "8080:80"
invapplication:
image: ghcr.io/ejach/inventoryapplication:latest
restart: always
environment:
host: db
webui_host: localhost
webui_port: 5000
username: root
password: root
db_port: 3306
db: parts
ports:
- "5000:8000"
volumes:
db-data:
external: true
- Run
$ docker-compose -f docker-compose.yml up -d
- Make sure you have a MySQL database running with the correct database schema
- Change the environment variables to your liking by exporting them shown in
example.env
- Build the image using the existing
Dockerfile
by running$ docker build -t inventoryapplication .
- Run the newly created image using
$ docker run inventoryapplication