System Manual - bounswe/bounswe2020group1 GitHub Wiki
The frontend and the backend applications should be deployed to different machines since both of them use the HTTP port to communicate with the client. For deploying the instances you can follow the steps below.
Frontend
These instructions are to deploy the frontend web application of Tursu to a Linux based OS preferably Ubuntu 20.04 LTS.
Requirements
-
Docker
-
Docker compose
-
sed command line tool
Deployment Steps
Step 1: Clone the repository
git clone https://github.com/bounswe/bounswe2020group1.git
Step 2: Change directory to the repository
cd bounswe2020group1/Frontend
Step 3: Change backend host URL to the new backend host.
-
For MacOS
TURSU_HOST_URL="3.232.20.250" NEW_URL=<ENTER-HOST-URL> find . -type f -name "*.js" -print0 | xargs -0 sed -i '' -e 's/'$TURSU_HOST_URL'/'$NEW_URL'/g'
-
For Ubuntu and other Linux
TURSU_HOST_URL="3.232.20.250" NEW_URL=<ENTER-HOST-URL> find . -type f -name "*.js" -print0 | xargs -0 sed -i 's/'$TURSU_HOST_URL'/'$NEW_URL'/g'
Step 4: Build docker images with docker compose
sudo docker-compose build
Step 5: Run the docker images with docker compose
sudo docker-compose up -d
Backend
These instructions are to deploy the backend web application of Tursu to a Linux based OS preferably Ubuntu 20.04 LTS.
Requirements
-
Docker
-
Docker compose
-
Database dump document (You can find it from Wiki sidebar)
-
sed command line tool
Deployment Steps
Step 0: Download the DB dump and move it to the deployment directory
Step 1: Clone the repository
git clone https://github.com/bounswe/bounswe2020group1.git
Step 2: Change directory to the repository
cd bounswe2020group1/
Step 3: Checkout to the backend branch
git checkout origin/backend
Step 4: Create .env file
cp env.conf .env
Step 5: Add the current host to the DJANGO_ALLOWED_HOSTS variable in .env and to TURSU_HOST_URL variable in backend/tursu/settings.py
-
For MacOS
TURSU_HOST_URL="3.232.20.250" NEW_URL=<ENTER-HOST-URL> find backend/tursu/ -type f -name "*.py" -print0 | xargs -0 sed -i '' -e 's/'$TURSU_HOST_URL'/'$NEW_URL'/g' find . -type f -name "*.env" -print0 | xargs -0 sed -i '' -e 's/'$TURSU_HOST_URL'/'$NEW_URL'/g'
-
For Ubuntu and other Linux
TURSU_HOST_URL="3.232.20.250" NEW_URL=<ENTER-HOST-URL> find backend/tursu/ -type f -name "*.py" -print0 | xargs -0 sed -i 's/'$TURSU_HOST_URL'/'$NEW_URL'/g' find . -type f -name "*.env" -print0 | xargs -0 sed -i 's/'$TURSU_HOST_URL'/'$NEW_URL'/g'
Step 6: Build docker images with docker compose
sudo docker-compose build
Step 7: Run the docker images with docker compose
sudo docker-compose up -d
Step 8: Restore the database dump
sudo docker exec -i db psql --username dbadmin --password tursu_db < ../dump.sql