Skip to content

Commit

Permalink
add dockerfile and docker compose for aks deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
KhanhNQ79 authored and KhanhNQ79 committed Aug 10, 2024
1 parent b3cba3d commit 2cfdfa9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions azure-vote/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ RUN pip install opencensus-ext-azure
RUN pip install opencensus-ext-flask
RUN pip install opencensus-ext-logging
RUN pip install flask
RUN pip install opencensus-ext-requests
# Copy the content of the current directory to the /app of the container
ADD . /app
16 changes: 14 additions & 2 deletions azure-vote/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,20 @@
else:
title = app.config['TITLE']

# Redis Connection
r = redis.Redis()
# Redis configurations
redis_server = os.environ['REDIS']

# Redis Connection to another container
try:
if "REDIS_PWD" in os.environ:
r = redis.StrictRedis(host=redis_server,
port=6379,
password=os.environ['REDIS_PWD'])
else:
r = redis.Redis(redis_server)
r.ping()
except redis.ConnectionError:
exit('Failed to connect to Redis, terminating.')

# Change title to host name to demo NLB
if app.config['SHOWHOST'] == "true":
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: '3'
services:
azure-vote-back:
image: mcr.microsoft.com/oss/bitnami/redis:6.0.8
platform: linux/amd64
container_name: azure-vote-back
environment:
ALLOW_EMPTY_PASSWORD: "yes"
Expand Down

0 comments on commit 2cfdfa9

Please sign in to comment.