Deploying a Two-Tier Flask Application with Docker-Compose

Deploying a Two-Tier Flask Application with Docker-Compose

To deploy a two-tier Flask application using Docker-Compose. This approach separates the application logic and database into distinct components, simplifying the development and deployment process. By leveraging Docker-Compose, one can easily manage, configure, and scale your Flask application and database together, streamlining workflows and ensuring consistency across different environments. Let's get started with the deployment process!

Steps:-

Step 1 - Launch an AWS T2 Medium Ubuntu Instance and Enable HTTP and HTTPS Settings for Inbound Traffic.

Step 2 — Clone the Repository from GitHub

https://github.com/BHDiwakar/two-tier-flas-app-with-database.git        

Step 3 — Install Docker-Compose and start the application

sudo apt update -y
sudo apt install docker-compose -y
sudo docker-compose up -d
sudo docker ps        

Step 4 — Access MySQL Database and enter inside the database container using exec -it

sudo docker exec -it <container_name> bash
mysql -u root -p
Enter password as test@123 (Since this is the root password for MySQL)        

Once logged in, enter below commands

use two_tier;

show tables;

create table messages (message varchar(255));

describe messages;        

The output would look like this,

Step 5 — Access your Application

Makesure all inbound traffic rules are enabled. But this is not a good practice for real-time environment.

You will be able to access your application using <EC2 IP Address:5000>


Thank you @cloudoholic


要查看或添加评论,请登录

Diwakar BH的更多文章

社区洞察

其他会员也浏览了