Fixed formatting changes
Signed-off-by: ajeetraina <ajeetraina@gmail.com>
This commit is contained in:
parent
0614fd5369
commit
3030c1358d
@ -1,6 +1,6 @@
|
|||||||
## Compose sample application
|
## Compose sample application
|
||||||
|
|
||||||
### Python/Flask application built using Docker Compose
|
### Python/Flask application using a Redis database
|
||||||
|
|
||||||
Project structure:
|
Project structure:
|
||||||
|
|
||||||
@ -16,7 +16,6 @@ Project structure:
|
|||||||
[_docker-compose.yml_](docker-compose.yml)
|
[_docker-compose.yml_](docker-compose.yml)
|
||||||
|
|
||||||
```
|
```
|
||||||
version: '2'
|
|
||||||
services:
|
services:
|
||||||
redis:
|
redis:
|
||||||
image: redislabs/redismod
|
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:
|
After the application starts, navigate to `http://localhost:5000` in your web browser or run:
|
||||||
```
|
```
|
||||||
$ curl localhost:5000
|
$ curl localhost:5000
|
||||||
|
This webpage has been viewed 2 time(s)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Monitoring Redis keys
|
## Monitoring Redis keys
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# compose_flask/app.py
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
from redis import Redis
|
from redis import Redis
|
||||||
|
|
||||||
@ -8,8 +7,8 @@ redis = Redis(host='redis', port=6379)
|
|||||||
@app.route('/')
|
@app.route('/')
|
||||||
def hello():
|
def hello():
|
||||||
redis.incr('hits')
|
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__":
|
if __name__ == "__main__":
|
||||||
app.run(host="0.0.0.0", debug=True)
|
app.run(host="0.0.0.0", debug=True)
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Subproject commit d92de2c2e1119d094df3910788e6f9e595042cf7
|
|
@ -1,3 +1,4 @@
|
|||||||
|
## Compose sample application
|
||||||
|
|
||||||
## Node.js application with Nginx proxy and Redis database
|
## Node.js application with Nginx proxy and Redis database
|
||||||
|
|
||||||
@ -26,10 +27,8 @@ Project structure:
|
|||||||
|
|
||||||
[_docker-compose.yml_](docker-compose.yml)
|
[_docker-compose.yml_](docker-compose.yml)
|
||||||
```
|
```
|
||||||
version: '3.9'
|
redis:
|
||||||
services:
|
image: 'redislabs/redismod'
|
||||||
redis:
|
|
||||||
image: 'redis:alpine'
|
|
||||||
ports:
|
ports:
|
||||||
- '6379:6379'
|
- '6379:6379'
|
||||||
web1:
|
web1:
|
||||||
@ -50,8 +49,8 @@ services:
|
|||||||
- web1
|
- web1
|
||||||
- web2
|
- web2
|
||||||
```
|
```
|
||||||
The compose file defines an application with four services `redis`, `web`, `web1` and `web2`.
|
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 web service container to port 80 of the host as specified in the file.
|
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_**
|
> ℹ️ **_INFO_**
|
||||||
@ -61,8 +60,6 @@ When deploying the application, docker-compose maps port 80 of the web service c
|
|||||||
|
|
||||||
```
|
```
|
||||||
$ docker-compose up -d
|
$ docker-compose up -d
|
||||||
```
|
|
||||||
```
|
|
||||||
Creating nginx-nodejs-redis_redis_1 ... done
|
Creating nginx-nodejs-redis_redis_1 ... done
|
||||||
Creating nginx-nodejs-redis_web1_1 ... done
|
Creating nginx-nodejs-redis_web1_1 ... done
|
||||||
Creating nginx-nodejs-redis_web2_1 ... done
|
Creating nginx-nodejs-redis_web2_1 ... done
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
redis:
|
redis:
|
||||||
image: 'redis:alpine'
|
image: 'redislabs/redismod'
|
||||||
ports:
|
ports:
|
||||||
- '6379:6379'
|
- '6379:6379'
|
||||||
web1:
|
web1:
|
||||||
|
Loading…
Reference in New Issue
Block a user