Ubuntu: 16.04
Python: 3.6.2
Backend: Flask
Test: Swagger
Database: MongoDB, Redis
Asynchronous: Celery (Redis)
Monitoring Tool: Supervisor, Prometheus, Grafana
Collecting Logs: Logstash
$ sudo apt-get update
$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo apt-key fingerprint 0EBFCD88
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu
$(lsb_release -cs)
stable"
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
$ sudo apt install docker-compose
Deploy Booking.com Application
$ cd ./docker_stg
$ sudo docker-compose up --build -d
$ sudo docker-compose logs --tail=20 -f flask
Monitor uwsgi application
Note1: How to allow certain ips connect mongodb?
# bindIp: 127.0.0.1
bindIp: 0.0.0.0
$ sudo service mongod restart
$ sudo service mongod status
$ sudo ufw enable
$ sudo ufw deny from 192.168.18.0/24 to any port 27017
$ sudo ufw allow from 192.168.18.0/24 to any port 27017
$ sudo ufw status
Note2: How to create multiple user on mongodb?
> use booking;
switched to db booking
> db.createUser(
{
user: "dbadmin",
pwd: "StrongPassword",
roles: [ { role: "readWrite", db: "booking" } ]
}
)
> exit
bye
security:
authorization: enabled
$ sudo service mongod restart
$ sudo service mongod status