diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 95196b75c..8aa5cbf7d 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -14,17 +14,6 @@ services: networks: - app-network - app: - build: - context: ./.. - dockerfile: docker/fpm/Dockerfile - image: myapp/php - container_name: app - volumes: - - ../src:/app - networks: - - app-network - memcached: build: context: ./memcached @@ -35,31 +24,40 @@ services: networks: - app-network - redis: + app1: build: - context: ./redis - dockerfile: Dockerfile - ports: - - "6379:6379" - container_name: app-redis + context: ./.. + dockerfile: docker/fpm/Dockerfile + image: myapp/php + container_name: app1 + volumes: + - ../src:/app networks: - app-network - mysql: + # second php-fpm + app2: build: - context: ./mysql - dockerfile: Dockerfile - restart: always - ports: - - "3306:3306" - container_name: app-mysql + context: ./.. + dockerfile: docker/fpm/Dockerfile + image: myapp/php + container_name: app2 + volumes: + - ../src:/app + networks: + - app-network + + # second php-fpm + app3: + build: + context: ./.. + dockerfile: docker/fpm/Dockerfile + image: myapp/php + container_name: app3 volumes: - - ../mysql-data:/var/lib/mysql - environment: - MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} - MYSQL_DATABASE: ${MYSQL_DATABASE} - MYSQL_USER: ${MYSQL_USER} - MYSQL_PASSWORD: ${MYSQL_PASSWORD} + - ../src:/app + networks: + - app-network networks: app-network: diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile index 783424635..08661644e 100644 --- a/docker/nginx/Dockerfile +++ b/docker/nginx/Dockerfile @@ -2,8 +2,6 @@ FROM nginx COPY ./application.local.conf /etc/nginx/conf.d/application.local.conf -COPY ./index.html /data/application.local/index.html - WORKDIR /app VOLUME /app diff --git a/docker/nginx/application.local.conf b/docker/nginx/application.local.conf index 134b4f55f..f35cf9985 100644 --- a/docker/nginx/application.local.conf +++ b/docker/nginx/application.local.conf @@ -1,3 +1,10 @@ +upstream php-fpm-backend { + least_conn; + server app1:9000; + server app2:9000; + server app3:9000; +} + server { # указываем 80 порт для соединения listen 80; @@ -27,8 +34,7 @@ server { location ~* .php$ { try_files $uri = 404; fastcgi_split_path_info ^(.+.php)(/.+)$; - fastcgi_pass app:9000; - #fastcgi_pass unix:/var/run/php-fpm.sock; + fastcgi_pass php-fpm-backend; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; diff --git a/docker/nginx/index.html b/docker/nginx/index.html deleted file mode 100644 index bebbfc558..000000000 --- a/docker/nginx/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - -
- -