Отделены параметры конфигурации для приложения от параметров конфигурации необходимых контейнеров

This commit is contained in:
ErickSkrauch 2016-12-04 15:34:32 +03:00
parent 6fc558c3c8
commit 9274155cfc
6 changed files with 85 additions and 64 deletions

View File

@ -1,20 +1,56 @@
# Основные параметры # Параметры приложения
## Env приложения
YII_DEBUG=true YII_DEBUG=true
YII_ENV=dev YII_ENV=dev
## Параметры, отвечающие за безопасность
JWT_USER_SECRET= JWT_USER_SECRET=
## Внешние сервисы
RECAPTCHA_PUBLIC= RECAPTCHA_PUBLIC=
RECAPTCHA_SECRET= RECAPTCHA_SECRET=
## SMTP параметры
SMTP_USER=
SMTP_PASS=
SMTP_PORT=
## Параметры подключения к базе данных
DB_HOST=db
DB_DATABASE=ely_accounts
DB_USER=ely_accounts_user
DB_PASSWORD=ely_accounts_password
## Параметры подключения к redis
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_DATABASE=0
REDIS_PASSWORD=
## Параметры подключения к redis
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_DATABASE=0
REDIS_PASS=
## Параметры подключения к rabbitmq
RABBITMQ_HOST=rabbitmq
RABBITMQ_PORT=5672
RABBITMQ_USER=ely-accounts-app
RABBITMQ_PASS=ely-accounts-app-password
RABBITMQ_VHOST=/ely.by
## Конфигурация для Dev.
XDEBUG_CONFIG=remote_host=10.254.254.254
PHP_IDE_CONFIG=serverName=docker
# Web # Web
VIRTUAL_HOST=account.ely.by,authserver.ely.by VIRTUAL_HOST=account.ely.by,authserver.ely.by
AUTHSERVER_HOST=authserver.ely.by AUTHSERVER_HOST=authserver.ely.by
# LETSENCRYPT_HOST=account.ely.by # LETSENCRYPT_HOST=account.ely.by
# LETSENCRYPT_EMAIL=erickskrauch@ely.by # LETSENCRYPT_EMAIL=erickskrauch@ely.by
# SMTP (только для production)
SMTP_USER=
SMTP_PASS=
# MySQL # MySQL
MYSQL_ALLOW_EMPTY_PASSWORD=yes MYSQL_ALLOW_EMPTY_PASSWORD=yes
MYSQL_ROOT_PASSWORD= MYSQL_ROOT_PASSWORD=
@ -26,7 +62,3 @@ MYSQL_PASSWORD=ely_accounts_password
RABBITMQ_DEFAULT_USER=ely-accounts-app RABBITMQ_DEFAULT_USER=ely-accounts-app
RABBITMQ_DEFAULT_PASS=ely-accounts-app-password RABBITMQ_DEFAULT_PASS=ely-accounts-app-password
RABBITMQ_DEFAULT_VHOST=/ely.by RABBITMQ_DEFAULT_VHOST=/ely.by
# Конфигурация для Dev.
XDEBUG_CONFIG=remote_host=10.254.254.254
PHP_IDE_CONFIG=serverName=docker

View File

@ -6,22 +6,5 @@ return [
'schemaCacheDuration' => 3600, 'schemaCacheDuration' => 3600,
'schemaCache' => 'cache', 'schemaCache' => 'cache',
], ],
'mailer' => [
'useFileTransport' => false,
'transport' => [
'class' => Swift_SmtpTransport::class,
'host' => 'ely.by',
'username' => getenv('SMTP_USER'),
'password' => getenv('SMTP_PASS'),
'port' => 587,
'encryption' => 'tls',
'streamOptions' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
],
],
],
],
], ],
]; ];

View File

@ -8,9 +8,9 @@ return [
], ],
'db' => [ 'db' => [
'class' => yii\db\Connection::class, 'class' => yii\db\Connection::class,
'dsn' => 'mysql:host=db;dbname=' . getenv('MYSQL_DATABASE'), 'dsn' => 'mysql:host=' . (getenv('DB_HOST') ?: 'db') . ';dbname=' . getenv('DB_DATABASE'),
'username' => getenv('MYSQL_USER'), 'username' => getenv('DB_USER'),
'password' => getenv('MYSQL_PASSWORD'), 'password' => getenv('DB_PASSWORD'),
'charset' => 'utf8', 'charset' => 'utf8',
'schemaMap' => [ 'schemaMap' => [
'mysql' => common\db\mysql\Schema::class, 'mysql' => common\db\mysql\Schema::class,
@ -19,24 +19,38 @@ return [
'mailer' => [ 'mailer' => [
'class' => yii\swiftmailer\Mailer::class, 'class' => yii\swiftmailer\Mailer::class,
'viewPath' => '@common/mail', 'viewPath' => '@common/mail',
'transport' => [
'class' => Swift_SmtpTransport::class,
'host' => 'ely.by',
'username' => getenv('SMTP_USER'),
'password' => getenv('SMTP_PASS'),
'port' => getenv('SMTP_PORT') ?: 587,
'encryption' => 'tls',
'streamOptions' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
],
],
],
], ],
'security' => [ 'security' => [
'passwordHashStrategy' => 'password_hash', 'passwordHashStrategy' => 'password_hash',
], ],
'redis' => [ 'redis' => [
'class' => common\components\Redis\Connection::class, 'class' => common\components\Redis\Connection::class,
'hostname' => 'redis', 'hostname' => getenv('REDIS_HOST') ?: 'redis',
'password' => null, 'password' => getenv('REDIS_PASS') ?: null,
'port' => 6379, 'port' => getenv('REDIS_PORT') ?: 6379,
'database' => 0, 'database' => getenv('REDIS_DATABASE') ?: 0,
], ],
'amqp' => [ 'amqp' => [
'class' => common\components\RabbitMQ\Component::class, 'class' => common\components\RabbitMQ\Component::class,
'host' => 'rabbitmq', 'host' => getenv('RABBITMQ_HOST') ?: 'rabbitmq',
'port' => 5672, 'port' => getenv('RABBITMQ_PORT') ?: 5672,
'user' => getenv('RABBITMQ_DEFAULT_USER'), 'user' => getenv('RABBITMQ_USER'),
'password' => getenv('RABBITMQ_DEFAULT_PASS'), 'password' => getenv('RABBITMQ_PASS'),
'vhost' => getenv('RABBITMQ_DEFAULT_VHOST'), 'vhost' => getenv('RABBITMQ_VHOST'),
], ],
'guzzle' => [ 'guzzle' => [
'class' => GuzzleHttp\Client::class, 'class' => GuzzleHttp\Client::class,

View File

@ -23,4 +23,4 @@ modules:
username: 'ely-accounts-tester' username: 'ely-accounts-tester'
password: 'tester-password' password: 'tester-password'
vhost: '/account.ely.by/tests' vhost: '/account.ely.by/tests'
queues: ['account-operations'] queues: []

View File

@ -10,26 +10,9 @@ return [
], ],
], ],
'components' => [ 'components' => [
'db' => [
'dsn' => 'mysql:host=testdb;dbname=ely_accounts_test',
'username' => 'ely_accounts_tester',
'password' => 'ely_accounts_tester_password',
],
'mailer' => [
'useFileTransport' => true,
],
'urlManager' => [ 'urlManager' => [
'showScriptName' => true, 'showScriptName' => true,
], ],
'redis' => [
'hostname' => 'testredis',
],
'amqp' => [
'host' => 'testrabbit',
'user' => 'ely-accounts-tester',
'password' => 'tester-password',
'vhost' => '/account.ely.by/tests',
],
'security' => [ 'security' => [
// Для тестов нам не сильно важна безопасность, а вот время прохождения тестов значительно сокращается // Для тестов нам не сильно важна безопасность, а вот время прохождения тестов значительно сокращается
'passwordHashCost' => 4, 'passwordHashCost' => 4,

View File

@ -11,16 +11,25 @@ services:
- testredis - testredis
- testrabbit - testrabbit
volumes: volumes:
- ./codeception/_output:/var/www/html/tests/codeception/_output - ./..:/var/www/html
- ./codeception/api/_output:/var/www/html/tests/codeception/api/_output
- ./codeception/common/_output:/var/www/html/tests/codeception/common/_output
- ./codeception/console/_output:/var/www/html/tests/codeception/console/_output
environment: environment:
- YII_DEBUG=true YII_DEBUG: "true"
- YII_ENV=test YII_ENV: "test"
# DB config
DB_HOST: "testdb"
DB_DATABASE: "ely_accounts_test"
DB_USER: "ely_accounts_tester"
DB_PASSWORD: "ely_accounts_tester_password"
# Redis config
REDIS_HOST: "testredis"
# RabbitMQ config
RABBITMQ_HOST: "testrabbit"
RABBITMQ_USER: "ely-accounts-tester"
RABBITMQ_PASS: "tester-password"
RABBITMQ_VHOST: "/account.ely.by/tests"
# Это я потом, когда-нибудь, уберу # Это я потом, когда-нибудь, уберу
- XDEBUG_CONFIG=remote_host=10.254.254.254 XDEBUG_CONFIG: "remote_host=10.254.254.254"
- PHP_IDE_CONFIG=serverName=docker PHP_IDE_CONFIG: "serverName=docker"
testdb: testdb:
container_name: accountelyby_testdb container_name: accountelyby_testdb