Skip to content
Merged
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
1 change: 0 additions & 1 deletion .dockerignore

This file was deleted.

4 changes: 0 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,5 @@ trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false

[*.txt]
trim_trailing_whitespace = false
insert_final_newline = false

[Makefile]
indent_style = tab
8 changes: 5 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
MAILER_DSN=null://null
###< symfony/mailer ###

# Настройки Xdebug
XDEBUG_CLIENT_HOST=host.docker.internal
XDEBUG_IDEKEY=PHPSTORM
###> redis ###
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_DB=0
###< redis ###
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ phpstan.neon
###> IDE files ###
/docker/pgdata
/docker/.env
/docker/.env.*
docker-compose.override.yml
###> IDE files ###
5 changes: 4 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
'blank_line_between_import_groups' => false,
'concat_space' => ['spacing' => 'one'],
'yoda_style' => false,
'global_namespace_import' => true,
'native_function_invocation' => false,
'native_constant_invocation' => false,
])
->setFinder($finder)
->setCacheFile(__DIR__.'/var/.php-cs-fixer.cache')
->setCacheFile(__DIR__ . '/var/.php-cs-fixer.cache')
;
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ phpcsfixer-fix:
vendor/bin/php-cs-fixer fix

phpstan:
vendor/bin/phpstan analyse
vendor/bin/phpstan analyse --memory-limit=512M

phpstan-baseline:
vendor/bin/phpstan analyse src tests --generate-baseline
Expand All @@ -31,5 +31,16 @@ docker-down:

docker-build:
docker-compose --env-file ./docker/.env build
docker-compose --env-file ./docker/.env up -d

docker-rebuild:
docker-compose --env-file ./docker/.env build --no-cache
docker-compose --env-file ./docker/.env up -d

docker-config:
docker-compose --env-file ./docker/.env config

shell:
docker-compose exec php bash

.PHONY: tests
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## IndigoLab test project

### Requirements
- PHP >= 8.4
- PHP >= 8.3
- Composer >= 2
- Make >= 4
- Docker
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"doctrine/orm": "^3.3",
"phpdocumentor/reflection-docblock": "^5.6",
"phpstan/phpdoc-parser": "^2.1",
"predis/predis": "^2.3",
"symfony/asset": "7.2.*",
"symfony/asset-mapper": "7.2.*",
"symfony/console": "7.2.*",
Expand Down
63 changes: 62 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,15 @@ services:

# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones

# Конфиг Redis клиента
Predis\Client:
arguments:
- scheme: 'tcp'
host: '%env(REDIS_HOST)%'
port: '%env(REDIS_PORT)%'
database: '%env(REDIS_DB)%'
# Redis сервис
App\Service\RedisService:
arguments:
$redisClient: '@Predis\Client'
80 changes: 50 additions & 30 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,88 @@
version: '3.8'

services:
ilyaguev_igor-indigolab-php:
app:
build:
context: .
dockerfile: ./docker/php/Dockerfile
container_name: ilyaguev_igor-indigolab-php
dockerfile: docker/php/Dockerfile
args:
UID: ${UID}
GID: ${GID}
APP_ENV: ${APP_ENV}
container_name: "${PROJECT_NAME}-app"
restart: unless-stopped
volumes:
- .:/var/www/html
user: "${UID:-1000}:${GID:-1000}"
working_dir: /var/www/html
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@ilyaguev_igor-indigolab-postgres:5432/${POSTGRES_DB}
- REDIS_URL=redis://ilyaguev_igor-indigolab-redis:6379
# - XDEBUG_CLIENT_HOST=${XDEBUG_CLIENT_HOST}
# - XDEBUG_IDEKEY=${XDEBUG_IDEKEY}
APP_ENV: ${APP_ENV}
APP_DEBUG: ${APP_DEBUG}
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${PROJECT_NAME}-postgres:${POSTGRES_PORT}/${POSTGRES_DB}
REDIS_URL: redis://${PROJECT_NAME}-redis:${REDIS_PORT}
XDEBUG_MODE: ${XDEBUG_MODE:-off}
XDEBUG_TRIGGER: ${XDEBUG_TRIGGER:-TRIGGER}
XDEBUG_CONFIG: "client_host=${XDEBUG_HOST:-host.docker.internal} discover_client_host=1 log=/var/log/xdebug/xdebug.log"
PHP_IDE_CONFIG: "serverName=Docker"
TZ: ${TZ}
volumes:
- ./:/var/www/html
depends_on:
- ilyaguev_igor-indigolab-postgres
- ilyaguev_igor-indigolab-redis
- db
- redis
networks:
- indigolab-network
- app-network

ilyaguev_igor-indigolab-nginx:
image: nginx:latest
container_name: ilyaguev_igor-indigolab-nginx
nginx:
image: nginx:1.25-alpine
container_name: "${PROJECT_NAME}-nginx"
restart: unless-stopped
ports:
- "${HTTP_PORT}:80"
- "${HTTPS_PORT}:443"
volumes:
- ./docker/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
- ./public:/var/www/html/public
depends_on:
- ilyaguev_igor-indigolab-php
- app
networks:
- indigolab-network
- app-network

ilyaguev_igor-indigolab-postgres:
image: postgres:latest
container_name: ilyaguev_igor-indigolab-postgres
db:
image: postgres:16
container_name: "${PROJECT_NAME}-postgres"
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_ROOT_PASSWORD: ${POSTGRES_ROOT_PASSWORD}
TZ: "Europe/Moscow"
TZ: ${TZ}
ports:
- "${POSTGRES_PORT}:5432"
volumes:
- ./docker/pgdata:/var/lib/postgresql/data
- pgdata:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}" ]
interval: 5s
timeout: 5s
retries: 5
networks:
- indigolab-network
- app-network

ilyaguev_igor-indigolab-redis:
image: redis:latest
container_name: ilyaguev_igor-indigolab-redis
redis:
image: redis:7-alpine
container_name: "${PROJECT_NAME}-redis"
restart: unless-stopped
environment:
REDIS_PASSWORD: ${REDIS_PASSWORD}
TZ: ${TZ}
ports:
- "6379:6379"
- "${REDIS_PORT}:6379"
networks:
- indigolab-network
- app-network

volumes:
postgres_data:
pgdata:

networks:
indigolab-network:
app-network:
driver: bridge
28 changes: 26 additions & 2 deletions docker/.env.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
POSTGRES_DB=indigolab
# Общие
PROJECT_NAME=project_name
TZ=Europe/Moscow
UID=1000
GID=1000

# PHP
APP_ENV=dev
APP_DEBUG=true
PHP_MEMORY_LIMIT=256M
PHP_MAX_EXECUTION_TIME=120

# Настройки Xdebug
XDEBUG_MODE=develop,debug,coverage
XDEBUG_TRIGGER=start_debug
XDEBUG_HOST=host.docker.internal

# Nginx
HTTP_PORT=8000
HTTPS_PORT=4430

# DB
POSTGRES_DB=postgres_db
POSTGRES_USER=postgres_user
POSTGRES_PASSWORD=postgres_password
POSTGRES_ROOT_PASSWORD=postgres_root_password
POSTGRES_PORT=5432

HTTP_PORT=8000
# Redis
REDIS_PASSWORD=redis_password
REDIS_PORT=6379
16 changes: 6 additions & 10 deletions docker/nginx/conf.d/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@ server {
root /var/www/html/public;
index index.php;

add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET,POST,PUT,DELETE,HEAD,OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Origin,Content-Type,Accept,Authorization' always;

location / {
try_files $uri /index.php$is_args$args;
}

location ~ ^/index\.php(/|$) {
fastcgi_pass ilyaguev_igor-indigolab-php:9000;
location ~ ^/index\.php(/|$) {
fastcgi_pass app:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
Expand All @@ -26,9 +21,10 @@ location ~ ^/index\.php(/|$) {
internal;
}

location ~ \.php$ {
location ~ \.php$ {
return 404;
}
error_log /var/log/nginx/project_error.log;
access_log /var/log/nginx/project_access.log;

error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
}
Loading