Get the App
SLTechnology News&Howtos  ›  Servers  › 

Build applications with three-tier architecture using docker

Shulou Source: shulou.com Published: 2022-06-02 02:09:17 10月02日 Update

Software shelf architecture

Git clone https://github.com/pcdogyu/example-voting-app.git

Cd / home/centos/example-voting-app/vote

Docker build. -t voting-app

Docker images

Docker run-p 5000 purl 80 voting-app

Why didn't you respond? I'm sorry. I was wrong. Aws sg, add 5000 port rules.

There it is.

The log also shows the incoming data.

But clicking in made a mistake.

Check the log, redis.push post data failure Bird.

Redis error, let me start a redis

Docker run-d-name=redis redis

There is no local one.

Repeat the next one

Docker run-d-name=redis redis

Redis, get up.

Associate redis when you start app

Docker run-p 5000 80-- link redis:redis voting-app

The web page is normal.

Run a database

Docker run-d-name=db postgres:9.4

Downloading

Let's pack a worker and go to sleep.

Cd / home/centos/example-voting-app/worker

Docker build. -t worker-app

One night has passed. Postgres and voting app are packed.

Docker run-link redis:redis-link db:db worker-app

All four components are already running.

Build displays the app of the result

Cd / home/centos/example-voting-app/result

Docker build. -t result-app

Image under docker image

The result page is accessed using port 5001

Docker run-d-p 5001 80-- link db:db result-app

All five components are up.

Visit http://52.80.39.196:5001/

I was wrong. Add it to aws sg.

Refresh, we have a result.

Tags: Results data logs ports components architecture database time web pages rules software errors mirrors pages Zhongshun associations responses applications programs three Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Technology Redmi MySQL vpn