- Open the Google Cloud Platform
- To grant an IAM role as Editor VM on a project, do the following:
- In the Cloud Console, go to the IAM page
- Go to the IAM page
- Click Add
- Enter an email e.g example@gmail.com,
- Choose the Roles under the Compute Engine Role and Select 'Compute Engine Admin'
- Click Save
- Go into the Cloud Console
- To Provision a New Compute Instance for the Back-End Server, Run the Following Commands
gcloud beta compute --project=<YOUR PROJECT ID> instances create rangrang-backend --zone=asia-southeast2-b --machine-type=n1-standard-2 --subnet=default --address=34.101.140.95 --network-tier=PREMIUM --maintenance-policy=TERMINATE --service-account=1083353886178-compute@developer.gserviceaccount.com --scopes=https://www.googleapis.com/auth/cloud-platform --tags=http-server,https-server --image=ubuntu-2004-focal-v20210603 --image-project=ubuntu-os-cloud --boot-disk-size=10GB --boot-disk-type=pd-ssd --boot-disk-device-name=rangrang-backend --no-shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --reservation-affinity=any gcloud compute --project=<YOUR PROJECT ID> firewall-rules create default-allow-http --direction=INGRESS --priority=1000 --network=default --action=ALLOW --rules=tcp:80 --source-ranges=0.0.0.0/0 --target-tags=http-server gcloud compute --project=<YOUR PROJECT ID> firewall-rules create default-allow-https --direction=INGRESS --priority=1000 --network=default --action=ALLOW --rules=tcp:443 --source-ranges=0.0.0.0/0 --target-tags=https-server
- SSH into the Server either by GUI, or through the Command Line Interface
- Update Packages on the Ubuntu VM by Running the Following Commands
sudo apt update && sudo apt upgrade -y
- Setup Machine Learning Dependencies with the Following Commands
- Clone models repository from tensorflow
git clone https://github.com/tensorflow/models.git
- Install tensorflow object detection API
cd models/research protoc object_detection/protos/*.proto --python_out=. cp object_detection/packages/tf2/setup.py . sudo pip3 install --use-feature=2020-resolver .
- Clone models repository from tensorflow
- Clone This Repository by Running the Following Command
git clone https://github.com/Hyuto/rangrang-server.git cd rangrang-server
- Install
Django
,djangorestframework
andwhitenoise
sudo pip3 install django djangorestframework whitenoise
- Setup
django
application- Setup main directory
mkdir static files
- Migrate db
python3 manage.py migrate
- Collectstatic
python3 manage.py collectstatic
- Setup main directory
- Exit the SSH Session by Running:
exit
- Turn off the VM Instance for the Back End Server by
- Clicking on the Checkbox of the VM that is Going to be Turned Off
- On the Top Panel, Click Stop
- Click on the Back End Server VM then Click on the Edit Button.
- Navigate to the Custom metadata Section, and add the Following:
Key:startup-script
Value:#! /bin/bash sudo service apache2 stop cd /home/rangrang-server sudo nohup python3 manage.py runserver 0.0.0.0:80 >> log.log 2>&1 | tee &
- Save the Changes
- Turn on the VM Instance to Start the Back End Server Service
- Navigate to the External IP Address to Check Its Availability by Going to these Paths:
http://<EXTERNAL-IP-ADDRESS>/cd-api/video/ http://<EXTERNAL-IP-ADDRESS>/cd-api/picture/ http://<EXTERNAL-IP-ADDRESS>/od-api/video/ http://<EXTERNAL-IP-ADDRESS>/od-api/picture/
Once all the Paths are Working, the Server is Considered Fully Functioning and Ready to Use
Repository | |
---|---|
Android | grrrracia/RangRang-MobileApp |
Cloud Computing | Hyuto/rangrang-server |
Machine Learning | Hyuto/rangrang-ML |