Giter Club home page Giter Club logo

azure-voting-app-redis's Introduction

page_type languages products description
sample
python
azure
azure-redis-cache
This sample creates a multi-container application in an Azure Kubernetes Service (AKS) cluster.

Azure Voting App

This sample creates a multi-container application in an Azure Kubernetes Service (AKS) cluster. The application interface has been built using Python / Flask. The data component is using Redis.

To walk through a quick deployment of this application, see the AKS quick start.

To walk through a complete experience where this code is packaged into container images, uploaded to Azure Container Registry, and then run in and AKS cluster, see the AKS tutorials.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

azure-voting-app-redis's People

Contributors

agmt5989 avatar codysc avatar dstrebel avatar gsacavdm avatar iainfoulds avatar microsoftopensource avatar msftgits avatar neilpeterson avatar omusavi avatar ranganathg avatar rberlind avatar supernova-eng avatar zr-msft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-voting-app-redis's Issues

bitnami/redis images does not support ARM based platforms

Pulling the bitnami/redis image yields the following error:

docker pull mcr.microsoft.com/oss/bitnami/redis:6.0.8
6.0.8: Pulling from oss/bitnami/redis
no matching manifest for linux/arm64/v8 in the manifest list entries

The bitnami/redis image seems to not support ARM. This repo is used for the kubernetes tutorial giving people an extra step they have to fix following the tutorial. For some this might be obvious for others this might be a blocker.

Possible solutions:

Error 502 Bad Gateway when deploying into ACI

I followed the tutorial for deploying this app in Azure Container Registry but tried to launch the app with Azure Container Instance (with a Linux machine). The deployment went well but when reaching the site, I got a 502 error.

Do not really know if I made a mistake or if this is due to the code itself.

Error: driver failed programming external conn

image

Using windows 10 pro. I get the following error:
ERROR: for azure-vote-front Cannot start service azure-vote-front: driver failed programming external connectivity on endpoint azure-vote-front (6e8d284e934d814c52d9295fc43768da53d6bf90c2ded2fd559e147999f17165): Error starting userland proxy: mkdir /port/tcp:0.0.0.0:8085:tcp:172.18.0.3:80: input/output error
ERROR: Encountered errors while bringing up the project.

Any ideas, on how to fix this?

500 Internal Server Error

Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

Bitnami Redis image is deprecated from MCR

Image used in Azure vote front end for redis is deprecated, please update correct image version like one which is using CBL mariner as baseline
mcr.microsoft.com/cbl-mariner/base/redis:6.2-cm2.0

StrictRedis() needs to be used when redis has a password

I set a password on my redis database by adding command: ["redis-server"] and args = ["--requirepass " ] to the azure-vote-back container specification in my copy of azure-vote-all-in-one-redis.yml. I was able to validate with redis-cli AUTH on that container that the password was really set.

I also added the extra environment variable, REDIS_PWD, that was referenced in main.py in the azure-vote-front container and set it to the same password.

However, the azure-vote-front app could not connect to the redis database. It gave the error: "redis.exceptions.ResponseError: NOAUTH Authentication required."

But when I used kubectl exec cats-and-dogs-front -i -t -- bash to access the container and used apt-get update and apt-get install redis-tools and then used redis-cli against the correct host and port, I was able to connect. I was also able to run the AUTH command and authenticate. Additionally, I could see that REDIS_PWD was set with the correct password by running env | grep REDIS.

My conclusion was that the redis password was being set correctly both in the front and back apps and that I did not have a connectivity issue between the containers themselves (since redis-cli worked). So, I concluded that something must be wrong with the python code.

I researched the redis-py module being used and found docs at https://redis-py.readthedocs.io/en/latest/ which suggested that redis.Redis() is provided for backwards compatibility with older versions of redis-py and that redis.StrictRedis() is preferred.

So, I changed the code to use redis.StrictRedis instead of redis.Redis when the REDIS_PWD environment variable is set.

I built my own docker image at rberlind/azure-vote-front:redis-pwd and modified the yml file to use that image. Everything then worked.

I will submit a pull request.

App resets counters on init.

This is minor given the purpose of the app, but if your are using it to play around with slight more advanced Kubernetes scenarios (like scaling up or updating the deployment), the counters get reset every time an instance of the front end is initialized.

Error with docker compose

when i try to start the docker container I am getting error below

docker-compose up -d
Pulling azure-vote-back (redis:)...
latest: Pulling from library/redis
ERROR: no matching manifest for windows/amd64 10.0.16299 in the manifest list entries

Add support for Web App for Containers

The very same sample code could not just be used for demonstrating Kubernetes, but also for showing how Web App for Containers works. In order to do so, I'd suggest:

  • providing an additional environment variable, allowing to pass in the password for Redis (so that Azure Redis cache can be configured to be used with the container image)
  • provide an additional Dockerfile which 1) adds support for ssh and 2) flags port 80 as destination

Base image size is unnecessarily large

The base container for the azure-vote-app is 922 MB in size. This can be improved significantly, by using an Alpine based image instead of Ubuntu. This is good for at least two reasons:
1: Download/upload times decreases which is very good in e.g. a workshop where several participants share the same WIFI (talking from experience here...)

2: Best practice with containers is to keep them as small as possible

I can make a PR with a smaller image referenced in the Dockerfile, if that would be appreciated

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.