Skip to content

Commit

Permalink
Fixes#883 : Deploy the New API to Heroku (#885)
Browse files Browse the repository at this point in the history
<!-- Add the issue number that is fixed by this PR (In the form Fixes #123) -->
Fixes #883 

#### Checklist

- [x] I have read the [Contribution & Best practices Guide](https://blog.fossasia.org/open-source-developer-guide-and-best-practices-at-fossasia) and my PR follows them.
- [x] My branch is up-to-date with the Upstream `development` branch.
- [x] I have added necessary documentation (if appropriate)

### Preview Link 

- **Replace XXX with your PR no**
- Link to live demo: http://pr-XXX-fossasia-badgeyay.surge.sh  

#### Changes proposed in this pull request:

- Deploy the New API to Heroku
  • Loading branch information
ParthS007 authored and djmgit committed May 30, 2018
1 parent 5c8c4d5 commit f1bb622
Show file tree
Hide file tree
Showing 68 changed files with 50 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: gunicorn --pythonpath backend/app/ main:app
web: gunicorn --pythonpath api/ run:app
3 changes: 3 additions & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
static/uploads
static/temporary
app.yaml
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions backend/__init__.py → api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ def create_app():
if not config.DEBUG:
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['SQLALCHEMY_DATABASE_URI']
else:
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://%(user)s:%(pw)s@%(host)s:%(port)s/%(db)s' % config.POSTGRES
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL']
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
app.config['SECRET_KEY'] = config.POSTGRES['secret']
app.config['DEBUG'] = config.DEBUG
app.config.from_object('api.config.mailConfig.MailConfig')
CORS(app, resources={r"*": {"origins": "*"}})

return app
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
12 changes: 12 additions & 0 deletions api/config/ServiceAccountkey.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "service_account",
"project_id": "badgeyay-195bf",
"private_key_id": "baac7d919f1f17a3419295978ebb3b5d356a4e02",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEuwIBADANBgkqhkiG9w0BAQEFAASCBKUwggShAgEAAoIBAQDifXANNMQnIJyW\nLZNmoS82pe61JuYUkYngSa9KzhBmq1UINiNSOsmVR8WKY9MyUZBVQSe66JW3DIo/\njaTFbg9Ig2f6aq8rUfPHm42LyPwEbrhyco9IJgMry8yNVlXRJdukhIHM11ip7oP1\nQFj/v6E0oCKwO5aUBuPEKUERQBhQ6rmI2j+1HNVbr4qzVb09Y/5mZJvGF5m2aku1\nrSN6wLDif+CYk5FdGFiU3vxmK3bHMBY8vFrLUbtCoIfrKIipp9DqqMLHDNORd7V2\ntH7j6TXSxIK7uoSRx/HtLguCzEOYBKvjtpJTDd4rWcNnDU+NLKgbmRS602zi+iik\nzmsjyL8DAgMBAAECggEAGSS6yUSH2B4nNAbYO8b+Ek+GegbY+QSVLViQxLmumW9A\nz9oOvsS290MR+4SMgCQM5WIH0piacklKmbaUSbSnrrGj2+l3C9SbvxeWNaP40lcm\nU9JC9Mv/gx+rVC929HKC+Tcan85yUd8gOBxOJQo1j72NTEo5M7K2G2NHDW6zpFvM\n9+zaRwWaaCMjK1CZkICSDI4YOOXTzsY+vq7M6TXtX/x8VJ0+o6m1dVV/ucJDo9z/\naV4rZcJIp5rTERuy0s0FQy25C+sDxOVMJKdkm5Eus/LjSyCAlJBe8+q0NSl/rsuj\nfHYJTerNmEdS8N2FNwKt1brmhRMnlXKUumPlfPcQVQKBgQD9R8XY5kM/2oc+6aSU\nBTA3nty63pY94qa5G4pprJT+ZP8MI0iJ9x7F0GHnpcRWNyO/JdqLnOpWAy0Dyo5D\n/ATdqX/zkhe7FV7BWZjjFOQQYQ6VoeGYjDJFznttKC6IkU9jNo0M3gtAZvkse7CD\ni+iCr+GGZ7ceiXGZIIskGVtlBQKBgQDk7AW9P46IlSRPJl0xRg+e1pXogUBYIQgm\nkHCtqmRBs+OWZzK9wY2m24mNd7mtsQxiIAcZBdhP8kCqXCWFhvRRJJai62pQK7Gb\n9JbXJvnyisulNtkpNX4vSQ6OhlQFJ2ucYb0sJ7gXNfHigteT4ZocySEN2/rxjyJo\nY+MC46HSZwJ/ebECXjREG2njkVawvG3BvPeXFjHb/d/oOwgAeMVy0Me1wx8wuxkA\nsApu/92ld8cGZdDKMEo0TR85gZjQwdlUfSvzThPjUv/xhvSFgJWI/lWjrEEbIzA4\n91E9/DRSJ0up2QFcw9HrlgXjsnu7U3jlPeVDdlBeq01eRzRbpfyI7QKBgEHdRql0\np+XUQ2Yie525srTYuLj0tzakClxOIp1U8ROWVlznxEmkbsUbVTBGyj2XOyDgZipk\n7B/Ua5aYfJM2iQTvqgemBCic6bUdYmj05eVK2dznMwQQSAYC1xVawMHa3bNYy7zw\nkJ7c/oNVcgEyX8z4cXIzYLgvno66bo5eQCjxAoGBANLNEvDQFWyKgWbsju9a303b\nXzSMe7q5cJ3q388mLFQo9Vs2mKfZhUvjrzXEnCzh05DHT+PaK/CTD66YfBnAqvmX\nXrQYD5Z8WG5+zh9htDIhoAWGBxn+UTTGMdOQMhUznc2rYoglLdF4+8nuXY4uXl8Q\nXiDuMvi/BB/Ks739l28u\n-----END PRIVATE KEY-----\n",
"client_email": "[email protected]",
"client_id": "107341524668147355773",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-96j6i%40badgeyay-195bf.iam.gserviceaccount.com"
}
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions api/config/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# DEBUG variable
DEBUG = True
# Sample config for PostgreSQL Database
POSTGRES = {
'user': 'badgeyay',
'pw': 'badge',
'host': 'localhost',
'port': '5432',
'db': 'badgeyay',
'secret': 'thisisaverysupersecretkeyforfossasiabadgeyay'
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions backend/requirements.txt → api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ msgpack-python==0.5.6
Pillow==5.1.0
protobuf==3.5.2.post1
psycopg2==2.7.4
psycopg2-binary==2.7.4
pyasn1==0.4.2
pyasn1-modules==0.2.1
pycparser==2.18
Expand All @@ -52,3 +53,4 @@ tinycss2==0.6.1
urllib3==1.22
webencodings==0.5.1
Werkzeug==0.14.1
marshmallow-jsonapi
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion backend/schemas/user.py → api/schemas/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class UserSchema(Schema):
class Meta:
type_ = 'user-signups'
self_view = 'loginUser.login'
self_view = 'registerUser.register_user'
kwargs = {'id': '<id>'}

id = fields.Str(required=True, dump_only=True)
Expand Down
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 18 additions & 2 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "BadgeYay-API",
"description": "A fully functional REST API for badges generator using flask",
"repository": "https://github.com/fossasia/badgeyay/backend/",
"repository": "https://github.com/fossasia/badgeyay/api/",
"keywords": [
"badgeyay",
"fossasia",
Expand All @@ -11,5 +11,21 @@
{
"url": "heroku/python"
}
]
],
"env" : {
"SERVICE_ACCOUNT_JSON" : {
"description": "The service-account.json from Firebase app.",
"required": true
},
"DATABASE_URL" : {
"description": "URL for Heroku Postgres",
"required": true
}
},
"addons": [
"heroku-postgresql",
{
"plan": "hobby-dev"
}
]
}
5 changes: 0 additions & 5 deletions backend/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-r backend/requirements/prod.txt
-r api/requirements.txt

0 comments on commit f1bb622

Please sign in to comment.