Skip to content

Commit

Permalink
Merge pull request #8 from elric97/feature/rachit_automated_deployment
Browse files Browse the repository at this point in the history
Changes for automated deployment and fixes for docker deployment
  • Loading branch information
elric97 authored Nov 28, 2021
2 parents e278e91 + cd8fee6 commit ef8ea2c
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 5 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Deploy

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.12.12 # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "feature-hunt-automated" #Must be unique in Heroku
heroku_email: "sharma.rachit882@gmail.com"
appdir: "backend"
1 change: 1 addition & 0 deletions backend/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn -b :$PORT app:app
9 changes: 7 additions & 2 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@
from products import *
from product_controller import *
from db_init import db
from ping import *

app.secret_key = "testing"
CORS(app)

#if __name__ == "__main__":
# app.run(debug=True, port=environ.get("PORT", 5000) , host='0.0.0.0')
if __name__ == "__main__":
port = int(os.environ.get('PORT', 5000))
app.run(host='0.0.0.0', port=port, debug=True)
# app.debug = True
# waitress.serve(app, port=environ.get("PORT", 5000))
6 changes: 6 additions & 0 deletions backend/ping.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from app import app


@app.route('/ping', methods=['GET'])
def ping():
return "Ping Pong"
4 changes: 2 additions & 2 deletions backend/products.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import os
from sys import stderr
from flask import request, jsonify
from flask import request, jsonify, Response
from flask import json
from app import app

Expand Down Expand Up @@ -125,7 +125,7 @@ def features(product_name):
return Response(response=json.dumps({"Error": "Please provide connection information"}),
status=400,
mimetype='application/json')
result = product_records.find_one_and_update({"name": productname}, {"$set": {"features": data}})
result = product_records.find_one_and_update({"name": product_name}, {"$set": {"features": data}})

elif request.method == 'GET':
result = product_records.find({"name": product_name}, {"features": 1})
Expand Down
3 changes: 2 additions & 1 deletion backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ toml==0.10.2
urllib3==1.21.1
Werkzeug==2.0.1
bcrypt==3.2.0

waitress==2.0.0
gunicorn

0 comments on commit ef8ea2c

Please sign in to comment.