This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.8" | |
services: | |
streaming-publisher: | |
build: ./streaming-publisher/ | |
batch-subscriber: | |
build: ./batch-subscriber/ | |
depends_on: | |
- mongodb | |
mongodb: | |
image: arm64v8/mongo:4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:latest | |
WORKDIR /code | |
ADD batch-subscription-service-account.json batch-subscription-service-account.json | |
ADD requirements.txt requirements.txt | |
RUN pip install -r requirements.txt | |
COPY app.py app.py | |
CMD ["python", "-u", "app.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
import random | |
import json | |
from google.cloud import pubsub_v1 | |
from pymongo import MongoClient | |
## GCP config | |
PROJECT_ID = 'streaming-ingestion-XXXXXX' | |
TOPIC_ID = 'sample-topic' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
import random | |
import json | |
from google.cloud import pubsub_v1 | |
## GCP config | |
PROJECT_ID = 'streaming-ingestion-XXXXXX' | |
TOPIC_ID = 'sample-topic' | |
SUBSCRIPTION_ID = 'sample-topic-sub' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:latest | |
WORKDIR /code | |
ADD streaming-publisher-service-account.json streaming-publisher-service-account.json | |
ADD requirements.txt requirements.txt | |
RUN pip install -r requirements.txt | |
COPY app.py app.py | |
CMD ["python", "-u", "app.py"] |