项目作者: G0uth4m

项目描述 :
Cloud Computing Assignment 1
高级语言: Python
项目地址: git://github.com/G0uth4m/RideShare.git
创建时间: 2020-01-21T12:26:07Z
项目社区:https://github.com/G0uth4m/RideShare

开源协议:

下载


RideShare

Cloud Computing Assignment 1

Cloud Deployment

Step 1 - Installing the Components from the Ubuntu Repositories

```shell script
$ sudo apt update
$ sudo apt install python3-pip python3-dev build-essential libssl-dev libffi-dev python3-setuptools nginx python3-venv

  1. ### Step 2 - Activating Python Virtual Environment
  2. ```shell script
  3. $ git clone https://github.com/G0uth4m/RideShare.git
  4. $ cd Rideshare
  5. $ python3.6 -m venv venv/
  6. $ source venv/bin/activate

Step 3 - Setting Up a Flask Application

```shell script
(venv) $ pip install -r requirements.txt
(venv) $ deactivate

  1. ### Step 4 - Configuring MongoDB
  2. ```shell script
  3. $ sudo apt install mongodb
  4. $ sudo nano /etc/mongodb.conf
  5. bind_ip = 0.0.0.0
  6. port = 27017
  7. ath=true
  8. $ mongo
  9. > use rideshare
  10. > db.createUser({
  11. user: '<username>',
  12. pwd: '<password>',
  13. roles: [{
  14. role: 'readWrite',
  15. db: 'rideshare'
  16. }]
  17. })
  18. > exit
  19. $ sudo serive mongodb restart

Step 5 - Configuring Gunicorn

```shell script
$ sudo nano /etc/systemd/system/rideshare.service
[Unit]
Description=Gunicorn instance to serve rideshare
After=network.target

[Service]
User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/RideShare
Environment=”PATH=/home/ubuntu/RideShare/venv/bin”
ExecStart=/home/ubuntu/RideShare/venv/bin/gunicorn —workers 3 —bind unix:rideshare -m 007 wsgi:app

[Install]
WantedBy=multi-user.target
$ sudo systemctl start rideshare
$ sudo systemctl enable rideshare

  1. ### Step 6 - Configuring Nginx to Proxy Requests
  2. ```shell script
  3. $ sudo nano /etc/nginx/sites-available/rideshare
  4. server {
  5. listen 80;
  6. server_name your_domain www.your_domain;
  7. location / {
  8. include proxy_params;
  9. proxy_pass http://unix:/home/ubuntu/RideShare/rideshare.sock;
  10. }
  11. }
  12. $ sudo ln -s /etc/nginx/sites-available/rideshare /etc/nginx/sites-enabled
  13. $ sudo systemctl restart nginx

Authors