View check_db.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 socket | |
import time | |
import argparse | |
""" Check if port is open, avoid docker-compose race condition """ | |
parser = argparse.ArgumentParser(description='Check if port is open, avoid\ | |
docker-compose race condition') | |
parser.add_argument('--service-name', required=True) | |
parser.add_argument('--ip', required=True) | |
parser.add_argument('--port', required=True) |
View redis.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
CHANNEL_LAYERS = { | |
'default' : { | |
'BACKEND': 'channels_redis.core.RedisChannelLayer', | |
'CONFIG' : { | |
"hosts" : [('redis', 6379)], # You are supposed to use service name and not localhost | |
}, | |
}, | |
} |
View database.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
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.mysql', | |
'NAME': 'bug', | |
'USER': config('DB_USER'), | |
'PASSWORD': config('DBPASS'), | |
'HOST': 'db', # You are supposed to use service name not localhost | |
'PORT': '3306', | |
} |
View Dockerfile
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 node:13.12.0-alpine | |
WORKDIR /app/frontend | |
COPY package.json package-lock.json ./ | |
RUN npm install | |
RUN npm install react-scripts@3.4.1 -g | |
COPY . ./ | |
EXPOSE 3000 |
View Dockerfile
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:3 | |
ENV PYTHONUNBUFFERED 1 | |
WORKDIR /app/api | |
COPY requirements.txt ./ | |
RUN pip install -r requirements.txt | |
COPY . ./ | |
EXPOSE 8000 |
View docker-compose.yaml
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.2" | |
services: | |
redis: | |
restart: always | |
image: redis:5 | |
ports: | |
- "6379:6379" | |
networks: | |
- db-net |