Skip to content

Commit

Permalink
deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
mateow99 committed Feb 7, 2025
1 parent 2cccb61 commit bff52af
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .env_template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
YOUTUBE_API_KEY=
MONGO_URI=
MONGO_DB=
STAGE=
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ venv/
.venv
__pycache__/
.env
.DS_Store
.envrc
.DS_Store
ca-certificate.crt
3 changes: 3 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"/graphql", view_func=GraphQLView.as_view("graphql", schema=schema, graphiql=True)
)

@app.route("/")
def hello_world():
return "Hello, World!"

@scheduler.task("interval", id="scrape_schedules", seconds=3600)
def scrape_schedules():
Expand Down
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ services:
image: cornellappdev/score-dev:${IMAGE_TAG}
env_file: .env
ports:
- "8000:80"
- "8000:8000"
volumes:
- ./ca-certificate.crt:/etc/ssl/ca-certificate.crt:ro # Mount MongoDB cert inside the container, ro for read only
9 changes: 7 additions & 2 deletions src/database.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
from pymongo import MongoClient
import os
from dotenv import load_dotenv

client = MongoClient(os.getenv("MONGO_URI", "mongodb://localhost:27017/"))
db = client["score_db"]
load_dotenv()

file_name = "ca-certificate.crt" if os.getenv("STAGE") == "local" else "/etc/ssl/ca-certificate.crt"

client = MongoClient(os.getenv("MONGO_URI"), tls=True, tlsCAFile=file_name)
db = client[os.getenv("MONGO_DB")]

0 comments on commit bff52af

Please sign in to comment.