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
- Go to nginx folder and run -->
htpasswd -c htpasswd user
Choosepassword
as the password of this user
- 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
- If usig docker, go to nginx folder and run -->
htpasswd -c htpasswd user
Choosepassword
as the password of this user
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.
Note: In order to run the application, without the docker, you need to take the following steps:
- Go to client folder and change the value of
WITHOUT_DOCKER
to1
- Active the python virtual env and install the following package:
pip install python-dotenv
Note: Remember for deployment
, you need to change the value of PRODUCTION
to true in next.config.js
file
- 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/
./api/vol/static/app_static_files
./api/vol/media/pdfs - 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:
To create a backup of the db
Go to the file utils/shellScripting/funcs/db_backup_local.sh
Change the docker container name, db name and db user based on the current project, then run:
./automation.sh
Select number 9
In order to restore db from a backedup file,
./automation.sh
Then select number 10
Run ngrok:
ngrok http -hostname=makeclient.ngrok.io 80
OR
ngrok http -host-header=makeclient.ngrok.io 80