Fixed formatting changes

This commit is contained in:
ajeetraina 2022-03-12 11:22:09 +05:30
parent 0a9c25249a
commit 3debcf521b
5 changed files with 10 additions and 16 deletions

View File

@ -1,6 +1,6 @@
## Compose sample application
### Python/Flask application built using Docker Compose
### Python/Flask application using a Redis database
Project structure:
@ -16,7 +16,6 @@ Project structure:
[_docker-compose.yml_](docker-compose.yml)
```
version: '2'
services:
redis:
image: redislabs/redismod
@ -61,7 +60,7 @@ flask-redis-web-1 "/bin/sh -c 'python …" web running
After the application starts, navigate to `http://localhost:5000` in your web browser or run:
```
$ curl localhost:5000
This webpage has been viewed 2 time(s)
```
## Monitoring Redis keys

View File

@ -1,4 +1,3 @@
# compose_flask/app.py
from flask import Flask
from redis import Redis
@ -8,8 +7,8 @@ redis = Redis(host='redis', port=6379)
@app.route('/')
def hello():
redis.incr('hits')
return 'This webpage has been viewed %s time(s).' % redis.get('hits')
counter = str(redis.get('hits'),'utf-8')
return "This webpage has been viewed "+counter+" time(s)"
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)

@ -1 +0,0 @@
Subproject commit d92de2c2e1119d094df3910788e6f9e595042cf7

View File

@ -1,3 +1,4 @@
## Compose sample application
## Node.js application with Nginx proxy and Redis database
@ -26,10 +27,8 @@ Project structure:
[_docker-compose.yml_](docker-compose.yml)
```
version: '3.9'
services:
redis:
image: 'redis:alpine'
redis:
image: 'redislabs/redismod'
ports:
- '6379:6379'
web1:
@ -50,8 +49,8 @@ services:
- web1
- web2
```
The compose file defines an application with four services `redis`, `web`, `web1` and `web2`.
When deploying the application, docker-compose maps port 80 of the web service container to port 80 of the host as specified in the file.
The compose file defines an application with four services `redis`, `nginx`, `web1` and `web2`.
When deploying the application, docker-compose maps port 80 of the nginx service container to port 80 of the host as specified in the file.
> **_INFO_**
@ -61,8 +60,6 @@ When deploying the application, docker-compose maps port 80 of the web service c
```
$ docker-compose up -d
```
```
Creating nginx-nodejs-redis_redis_1 ... done
Creating nginx-nodejs-redis_web1_1 ... done
Creating nginx-nodejs-redis_web2_1 ... done

View File

@ -1,7 +1,7 @@
services:
redis:
image: 'redis:alpine'
image: 'redislabs/redismod'
ports:
- '6379:6379'
web1: