Setup:
-
Setup Development environment:
-
Clone the repository
-
SETUP ON MAC/Linux:
- Got to root folder and run
./automation.sh
in terminal - Choose Option
1
-->Make initial setup on Mac/Linux
- SETUP ON WINDOWS:
- Create a python virtual env:
python -m venv venv
- Activate virtual environment -->
venv\Scripts\activate
pip install --upgrade pip
pip install -r api/requirements-windows-local.txt
- Go to api folder and run
python manage.py collectstatic
- Go to client folder and run
npm install
- Go to root folder and run
./automation.sh
in terminal - Choose Option
2
-->Make initial setup on Windows
Then, Do the following part, in ordet to be able to use docker in your development environment:
- Go to the root folder and run
docker-compose -f docker-compose-dev.yml up --build -d
-
Note:
You might need to change the database name and database password in /api/config folder and env variables inside /config folder.
Note: In order to use celery with your application put USE_CELERY=1 in the environment variables.
Note: In order to send activation email after registration, put SEND_ACTIVATION_EMAIL=1 in the environment variables.
- Test production environment on your local PC:
Run docker-compose -f docker-compose-prod.yml up -build -d
- Test performance of production environment on your local PC:
- Run following commands:
docker-compose -f docker-compose-prod.yml up -build -d
cd api
locust -f locustfiles/browse_api.py
- Run following commands:
-
Setup Production environment:
- Create the following subfolders:
./api/vol/static/
./api/vol/media/ - Go to root folder and run
./automation.sh
in terminal - Choose Option
7
-->Copy environment variables in server
- Then you need to add ssl config to your domain, so take the following steps:
- Create following subfolders:
-
./nginx/certbot/conf/
-
./nginx/certbot/www/
2.docker-compose -f docker-compose-createSSL.yml up --build -d
3.And then change domains and email in init-letsencrypt.sh
4.Then run./init-letsencrypt.sh
-
Now your app is ready to be run on server: To do so, first clear all volumes, images, and containersof docker, useing the following 3 commands:
- Run
docker container rm -f $(docker container ls -a -q)
- Run
docker image rm -f $(docker image ls -a -q)
- Run
docker volume prune
- Now everything is ready for your app to be served:
Rundocker-compose -f docker-compose-prod-ssl.yml up --build -d
- Create the following subfolders: