making a small qa system with docker
TRANSCRIPT
QA: Quality Assurance of web applicationsHow do you set up a environment for QA ?
(involves a human going through test cases)
How to set up QA environment
• ngrok
• expose local environment through proxy
• docker machine
• deploy conteiners to public environment
• docker + hipache proxy etc..
Run multiple QA environments simultaneously
Perform QA each feature branches
feature-A
feature-B
feature-C
Solution: run containers each feature branches
Access a container with using a URL contains branch name
Running a container on demand
http://feature-A.app.dev
http://feature-B.app.dev
http://feature-C.app.dev
prevs.io provides a simple QA system for web apps
With using docker container, it can provide a QA system fast, easily, simply
But it has a limitation:
It's limited to only 1 container each feature branches
http://feature-A.app.dev
http://feature-B.app.dev
http://feature-C.app.dev
App
App
App
docker container
Limitation:Actual case:
A general web app is composed of multiple services ( API, DB etc..)
http://feature-A.app.dev
http://feature-B.app.dev
http://feature-C.app.dev
App
DB
API-2
API-1
Solution: add integration with docker-compose
Base OSS project: http://github.com/mookjp/pool
Run multiple containers each feature branches
http://feature-A.app.dev
http://feature-B.app.dev
http://feature-C.app.dev
App
App
App
DB
DB
DB
docker-compose
DEMO https://github.com/ainoya/pool/tree/docker-compose
Sample application
Python web app counts up visit times
docker-compose
Redis stores
visit timeslink
app.pyfrom flask import Flask from redis import Redis import os app = Flask(__name__) redis = Redis(host='redis', port=6379)
@app.route('/') def hello(): redis.incr('hits') return 'Hello World! I have been seen %s times.' % redis.get('hits')
if __name__ == "__main__": app.run(host="0.0.0.0", port=80, debug=True)
Ref: https://docs.docker.com/compose/
docker-compose.yml(.erb)
web: environment: GIT_COMMIT: "<%= @git_commit_id %>" build: . ports: -‐ "80" links: -‐ redis redis: image: redis
DEMO https://github.com/ainoya/pool/tree/docker-compose
Set up QA environment each "master", "development" branches
Python web app
counts up visit times
http://master.pool.dev
Redis stores
visit timeslink
Python web app
counts up visit times
http://development.pool.dev
Redis stores
visit timeslink
Future plan
• Support efficient pattern shares some resources (DB, etc...) between same applications
• More integration with other solutionsECS, GKE/k8s,…
• Integrate with docker registry 2.0 system