Commit c24674d9 authored by Адлан Шамавов's avatar Адлан Шамавов
Browse files

SYM-3 | Реализация сущностей и фикстур

parent c7ca8375
Loading
Loading
Loading
Loading
+47 −1
Original line number Diff line number Diff line
CONTAINER_NAME=e-shop

APP_BASE_DIR=./

# Nginx
HTTP_PORT=80

# База данных (PostreSQL)
DB_DATABASE=shop_db
DB_USERNAME=user
DB_PASSWORD=password
DB_ROOT_USERNAME=root
DB_PORT=5433
GROUP_ID=1000
USER_ID=1000

# IDE
XDEBUG_IDE_KEY=myproject

# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
@@ -16,5 +35,32 @@

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=62a9f294477c532c72bad4b25cf23005
APP_SECRET=
###< symfony/framework-bundle ###

###> symfony/messenger ###
# Choose one of the transports below
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
# MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
###< symfony/messenger ###

# doctrine env
DB_DRIVER=pdo_pgsql
DB_DOCTRINE_PORT=5432
DB_HOST=e-shop-db

# elasticsearch
ES_PORT=9200
ELASTICSEARCH_URL=http://elasticsearch:9200/
###> friendsofsymfony/elastica-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
# DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8"
###< doctrine/doctrine-bundle ###

compose.yaml

0 → 100644
+77 −0
Original line number Diff line number Diff line
services:
  app:
    container_name: ${CONTAINER_NAME}-app
    build:
      context: ./
      dockerfile: ./docker/app/Dockerfile
      target: app-dev
      args:
        COMPOSER_AUTH: "{}"
        APP_BASE_DIR: ${APP_BASE_DIR-.}
    depends_on:
      db:
        condition: service_healthy
    environment:
      XDEBUG_IDE_KEY: ${XDEBUG_IDE_KEY}
    restart: unless-stopped
    extra_hosts:
      - "host.docker.internal:host-gateway"
    volumes:
      - ${APP_BASE_DIR-.}:/app

  web:
    container_name: ${CONTAINER_NAME}-web
    build:
      context: ./
      dockerfile: ./docker/web/Dockerfile
      args:
        APP_BASE_DIR: ${APP_BASE_DIR-.}
    restart: unless-stopped
    ports:
      - ${HTTP_PORT}:8080
    environment:
      PHP_FPM_HOST: app
    volumes:
      - ${APP_BASE_DIR-.}/public:/app/public
    depends_on:
      app:
        condition: service_healthy

  db:
    container_name: ${CONTAINER_NAME}-db
    image: postgres:16-alpine3.18
    environment:
      USER_ID: ${USER_ID}
      GROUP_ID: ${GROUP_ID}
      PGDATA: /data/postgres
      PGUSER: ${DB_ROOT_USERNAME}
      POSTGRES_DB: ${DB_DATABASE}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_PASSWORD: ${DB_PASSWORD}
    volumes:
      - sqldata:/data/postgres
    ports:
      - ${DB_PORT}:5432
    restart: unless-stopped
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready", "-d" ]
      timeout: 5s
      retries: 3

  elasticsearch:
    image: elasticsearch:7.17.14
    container_name: ${CONTAINER_NAME}-elasticsearch
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - discovery.type=single-node
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    ports:
      - ${ES_PORT}:9200

volumes:
  sqldata:
+8 −2
Original line number Diff line number Diff line
@@ -7,6 +7,10 @@
        "php": ">=8.2",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "doctrine/dbal": "^3",
        "doctrine/doctrine-bundle": "^2.12",
        "doctrine/doctrine-migrations-bundle": "^3.3",
        "doctrine/orm": "^3.2",
        "symfony/console": "7.1.*",
        "symfony/dotenv": "7.1.*",
        "symfony/flex": "^2",
@@ -14,8 +18,6 @@
        "symfony/runtime": "7.1.*",
        "symfony/yaml": "7.1.*"
    },
    "require-dev": {
    },
    "config": {
        "allow-plugins": {
            "php-http/discovery": true,
@@ -64,5 +66,9 @@
            "allow-contrib": false,
            "require": "7.1.*"
        }
    },
    "require-dev": {
        "doctrine/doctrine-fixtures-bundle": "^3.6",
        "symfony/maker-bundle": "^1.60"
    }
}
+1788 −13

File changed.

Preview size limit exceeded, changes collapsed.

+4 −0
Original line number Diff line number Diff line
@@ -2,4 +2,8 @@

return [
    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
    Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
    Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
    Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
    Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
];
Loading