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

STA-1280 | CRUD для Users

parent f856dee4
Loading
Loading
Loading
Loading
+40 −1
Original line number Diff line number Diff line
CONTAINER_NAME=users

APP_BASE_DIR=./

# База данных (PostreSQL)
DB_DATABASE=mydatabase
DB_USERNAME=user
DB_PASSWORD=password
DB_DRIVER=pdo_pgsql
DB_ROOT_USERNAME=root
DB_PORT=5433
GROUP_ID=1000
USER_ID=1000
DB_DOCTRINE_PORT=5432
DB_HOST=users-db

# 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,25 @@

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=5ad00899cba1f78455f996ba16e1aa60
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 ###

# kafka
KAFKA_BROKERS=kafka:9092

###> 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://user:password@users-db:5432/mydatabase?serverVersion=16&charset=utf8"
###< doctrine/doctrine-bundle ###
+5 −1
Original line number Diff line number Diff line
@@ -9,3 +9,7 @@
/vendor/
###< symfony/framework-bundle ###
/.idea/
###> friendsofphp/php-cs-fixer ###
/.php-cs-fixer.php
/.php-cs-fixer.cache
###< friendsofphp/php-cs-fixer ###

.php-cs-fixer.dist.php

0 → 100644
+13 −0
Original line number Diff line number Diff line
<?php

$finder = (new PhpCsFixer\Finder())
    ->in(__DIR__)
    ->exclude(['var', 'vendor'])
;

return (new PhpCsFixer\Config())
    ->setRules([
        '@Symfony' => true,
    ])
    ->setFinder($finder)
;

compose.yaml

0 → 100644
+44 −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

  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

volumes:
  sqldata:
+9 −2
Original line number Diff line number Diff line
@@ -7,15 +7,19 @@
        "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",
        "symfony/framework-bundle": "7.1.*",
        "symfony/messenger": "7.1.*",
        "symfony/runtime": "7.1.*",
        "symfony/uid": "7.1.*",
        "symfony/yaml": "7.1.*"
    },
    "require-dev": {
    },
    "config": {
        "allow-plugins": {
            "php-http/discovery": true,
@@ -64,5 +68,8 @@
            "allow-contrib": false,
            "require": "7.1.*"
        }
    },
    "require-dev": {
        "friendsofphp/php-cs-fixer": "^3.59"
    }
}
Loading