Simple test server for orchestration and deployment testing.
Use the local-testing/docker-compose file to build and run the test server as a container locally.
For swarm testing use the docker-stack.yml configuration. Change to the image value to use your own, customized images.
In Swarm mode you can to add a secret with:
echo SwarmEtcdSecret | docker secret create my_secret_key -Point your browser to http://<name or ip>:8080/.
The server returns an page with this information:
Welcome to Test server
Your request was
remote_addr: 172.22.0.1
url: http://localhost:4080/echo
url_charset: utf-8
referrer: None
user_agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15
App version Testserver version is 0.9.8
Running in Production environment
This page has been viewed 4 times.The value of the secret key depends on the place of definition.
Send a GET request with your favorite REST client (cUrl, insomnia, postman).
curl http://192.168.99.109:8080/api/echo
{"container_name":"d89af7728f6d","local_ip":"10.0.18.3","now":"2020-01-08 11:53:24.647791","remote_ip":"10.255.0.2","secret":"SwarmEtcdSecret\n"}Default configuration via test_server/test_server.cfg.
Runtime configuration via environment variables.
| Variable | Value. |
|---|---|
| PORT | 8080 |
| ENV | Development |
| SECRET_KEY | MySecretKey |
| DEBUG | False |
| LOGLVL | INFO |
cat requirements.txt | cut -f1 -d= | xargs pip install -U