Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: '3.3'
services:
loadbalancer:
image: nginx
restart: always
logging:
driver: journald
options:
tag: hometask_7_loadbalancer
depends_on:
- firstnginx
- secondnginx
volumes:
- "./loadbalanсernginxconf/nginx.conf:/etc/nginx/nginx.conf"
ports:
- "1113:80"

firstnginx:
build: ./first
restart: always
logging:
driver: journald
options:
tag: hometask_7_firstnginx

secondnginx:
image: nginx
restart: always
volumes:
- "./second/:/usr/share/nginx/html"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80"]
interval: 1m30s
timeout: 10s
retries: 3
logging:
driver: journald
options:
tag: hometask_7_secondnginx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM nginx:alpine
COPY index.html /usr/share/nginx/html
HEALTHCHECK --interval=5m --timeout=3s \
CMD curl -f http://localhost:80 || exit 1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>HELLO MY FIRST SERVER</h1>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {
upstream backend {
server firstnginx;
server secondnginx;
}

server {
listen 80;
root /var/www/example.com/html;
index index.html index.htm index.nginx-debian.html;

server_name localhost;

location / {
proxy_pass http://backend;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>HELLO MY SECOND SERVER</h1>