Skip to content

Commit

Permalink
hw4 fix after review
Browse files Browse the repository at this point in the history
  • Loading branch information
art-cherepan committed Aug 31, 2023
1 parent 4e3afdb commit d0dc1d4
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env
vendor
28 changes: 8 additions & 20 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ version: '3'
# в этом блоке мы описываем контейнеры, которые будут запускаться
services:
nginx-upstream:
build:
context: nginx-upstream
dockerfile: Dockerfile
image: otus/nginx-upstream
image: nginx
container_name: nginx-upstream
ports:
- "80:80"
Expand All @@ -20,29 +17,20 @@ services:
- app-network

nginx-webserv1:
build:
context: nginx-webservers
dockerfile: Dockerfile
image: otus/nginx-webserv1
image: nginx
container_name: nginx-webserv1
ports:
- "8081:80"

volumes:
- ./src:/data/mysite.local
- ./public:/data/mysite.local
- ./nginx-webservers/hosts:/etc/nginx/conf.d
networks:
- app-network

nginx-webserv2:
build:
context: nginx-webservers
dockerfile: Dockerfile
image: otus/nginx-webserv2
image: nginx
container_name: nginx-webserv2
ports:
- "8082:80"
volumes:
- ./src:/data/mysite.local
- ./public:/data/mysite.local
- ./nginx-webservers/hosts:/etc/nginx/conf.d
networks:
- app-network
Expand All @@ -56,7 +44,7 @@ services:
image: otus/php-fpm1
container_name: app1
volumes:
- ./src:/data/mysite.local
- ./public:/data/mysite.local
# мы можем создать для контейнеров внутреннюю сеть
networks:
- app-network
Expand All @@ -70,7 +58,7 @@ services:
image: otus/php-fpm2 # имя будущего образа
container_name: app2 # имя контейнера после запуска
volumes:
- ./src:/data/mysite.local
- ./public:/data/mysite.local
# мы можем создать для контейнеров внутреннюю сеть
networks:
- app-network
Expand Down
1 change: 0 additions & 1 deletion nginx-upstream/Dockerfile

This file was deleted.

6 changes: 3 additions & 3 deletions nginx-upstream/hosts/mysite.balancer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ events { worker_connections 1024; }

http {
upstream web-servers {
#least_conn;
server nginx-webserv1:8081;
server nginx-webserv2:8082;
least_conn;
server nginx-webserv1;
server nginx-webserv2;
}

access_log /var/log/nginx/access.log;
Expand Down
1 change: 0 additions & 1 deletion nginx-webservers/Dockerfile

This file was deleted.

3 changes: 1 addition & 2 deletions nginx-webservers/hosts/mysite.webserv.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ upstream web_apps {

server {
# указываем порты для соединения
listen 8081;
listen 8082;
listen 80;

# нужно указать, какому доменному имени принадлежит наш конфиг
server_name mysite.balancer;
Expand Down
4 changes: 2 additions & 2 deletions src/index.php → public/index.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

include_once('autoload.php');
include_once(__DIR__ . '/src/autoload.php');

$stringValidatorService = new \Services\StringValidatorService();
$stringValidatorService = new \src\Services\StringValidatorService();
$string = $_POST['string'];

if ($stringValidatorService->isBracketsValid($string)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Services;
namespace src\Services;

class StringValidatorService
{
Expand Down
File renamed without changes.

0 comments on commit d0dc1d4

Please sign in to comment.