To run the project locally
-
Clone this repository
-
From the terminal, navigate to the root directory of the cloned project
-
Create virtual environment
-
Install dependencies in the
requirements.txt
filepip install -r requirements.txt
-
Create
.env
file in the root directory and assign the following environment variablesFLASK_DEBUG=1 FLASK_ENV= MYSQL_PASSWORD= MYSQL_USER= MYSQL_DB= MYSQL_HOST= SECRET_KEY=
-
From the terminal in the project root directory, run the following command
flask --app run.py run
-
Create gunicorn configuration file
gunicorn.conf.py
in the root directory and add the following environment variablesimport os os.environ["FLASK_ENV"] = os.environ["MYSQL_USER"] = os.environ["MYSQL_PASSWORD"] = os.environ["MYSQL_DB"] = os.environ["SECRET_KEY"] = bind = "0.0.0.0:5000" wsgi_app = "run:app"
-
From the terminal in the project root directory, run the following command
gunicorn --config gunicorn.conf.py
-
Open terminal in the root directory
-
Create
production.env
file in the root directory and assign the following environment variablesFLASK_DEBUG=1 FLASK_ENV= MYSQL_PASSWORD= MYSQL_USER= MYSQL_DB= MYSQL_HOST= SECRET_KEY=
-
Setup docker
docker login
-
Navigate to the application's root directory
-
Build docker image
docker build --tag user-auth-system .
-
Start docker application
docker compose up --detach --build
NB: The above command builds, recreates, starts and attaches to all containers defined in
docker-compose.yaml
file. It fires the multi-container application up and running. -
To stop docker application, run the following command from terminal
docker compose down