Skip to content

Commit

Permalink
add docker
Browse files Browse the repository at this point in the history
  • Loading branch information
nadar committed Dec 12, 2019
1 parent 0011361 commit 9d0a23d
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 202 deletions.
40 changes: 15 additions & 25 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,21 @@
"luyadev/luya-bootstrap4": "^1.0"
},
"require-dev": {
"yiisoft/yii2-debug" : "~2.0.0",
"yiisoft/yii2-gii" : "~2.0.0",
"luyadev/luya-deployer": "~1.0.0",
"twbs/bootstrap": "~4.0.0"
"yiisoft/yii2-debug" : "^2.0",
"yiisoft/yii2-gii" : "^2.0",
"luyadev/luya-deployer": "^1.0",
"twbs/bootstrap": "^4.0"
},
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::postCreateProject"
]

"config": {
"fxp-asset": {
"enabled": false
}
},
"extra": {
"yii\\composer\\Installer::postCreateProject": {
"setPermission": [
{
"public_html/assets": "0777",
"public_html/storage": "0777"
}
]
},
"asset-installer-paths": {
"bower-asset-library": "vendor/bower"
},
"branch-alias": {
"dev-master": "1.0.x-dev"
},
"asset-pattern-skip-version": "(-build|-patch)"
}
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
]
}
118 changes: 118 additions & 0 deletions configs/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?php

use luya\Config;

$config = new Config('myproject', dirname(__DIR__), [
'siteTitle' => 'My Project',
'defaultRoute' => 'cms',
'aliases' => [
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
],
'modules' => [
/*
* If you have other admin modules (e.g. cmsadmin) then you going to need the admin. The Admin module provides
* a lot of functionality, like storage, user, permission, crud, etc.
*/
'admin' => [
'class' => 'luya\admin\Module',
'secureLogin' => false, // when enabling secure login, the mail component must be proper configured otherwise the auth token mail will not send.
'strongPasswordPolicy' => false, // If enabled, the admin user passwords require strength input with special chars, lower, upper, digits and numbers
'interfaceLanguage' => 'en', // Admin interface default language. Currently supported: en, de, ru, es, fr, ua, it, el, vi, pt, fa
],
// Frontend module for the `cms` module.
'cms' => [
'class' => 'luya\cms\frontend\Module',
'contentCompression' => true, // compressing the cms output (removing white spaces and newlines)
],
// Admin module for the `cms` module.
'cmsadmin' => [
'class' => 'luya\cms\admin\Module',
],
],
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'charset' => 'utf8',
],
/*
* Add your smtp connection to the mail component to send mails (which is required for secure login), you can test your
* mail component with the luya console command ./vendor/bin/luya health/mailer.
*/
'mail' => [
'isSMTP' => false,
'from' => '[email protected]',
'fromName' => '[email protected]',
],
/*
* The composition component handles your languages and they way your urls will look like. The composition components will
* automatically add the language prefix which is defined in `default` to your url (the language part in the url e.g. "yourdomain.com/en/homepage").
*
* hidden: (boolean) If this website is not multi lingual you can hide the composition, other whise you have to enable this.
* default: (array) Contains the default setup for the current language, this must match your language system configuration.
*/
'composition' => [
'hidden' => true, // no languages in your url (most case for pages which are not multi lingual)
'default' => ['langShortCode' => 'en'], // the default language for the composition should match your default language shortCode in the language table.
],
/*
* Translation component. If you don't have translations just remove this component and the folder `messages`.
*/
'i18n' => [
'translations' => [
'app*' => [
'class' => 'yii\i18n\PhpMessageSource',
],
],
],
]
]);

$config->callback(function() {
define('YII_DEBUG', true);
define('YII_ENV', 'local');
})->env(Config::ENV_LOCAL);

// database config for
$config->component('db', [
'dsn' => 'mysql:host=localhost;dbname=DB_NAME',
// 'dsn' => 'mysql:host=localhost;dbname=DB_NAME;unix_socket=/Applications/MAMP/tmp/mysql/mysql.sock', // OSX MAMP
// 'dsn' => 'mysql:host=localhost;dbname=DB_NAME;unix_socket=/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock', // OSX XAMPP
'username' => '',
'password' => '',
])->env(Config::ENV_LOCAL);

/*
// docker mysql config
$config->component('db', [
'dsn' => 'mysql:host=luya_db;dbname=luya_kickstarter_101',
'username' => 'luya',
'password' => 'CHANGE_ME',
])->env(Config::ENV_LOCAL);
*/

$config->component('db', [
'dsn' => 'mysql:host=localhost;dbname=DB_NAME',
'username' => '',
'password' => '',
'enableSchemaCache' => true,
'schemaCacheDuration' => 0,
])->env(Config::ENV_PROD);

$config->component('cache', [
'class' => 'yii\caching\FileCache'
])->env(Config::ENV_PROD);

// debug and gii on local env
$config->module('debug', [
'class' => 'yii\debug\Module',
'allowedIPs' => ['*'],
])->env(Config::ENV_LOCAL);
$config->module('gii', [
'class' => 'yii\gii\Module',
'allowedIPs' => ['*'],
])->env(Config::ENV_LOCAL);

$config->bootstrap(['debug', 'gii'])->env(Config::ENV_LOCAL);

return $config;
19 changes: 0 additions & 19 deletions configs/env-local-db.php.dist

This file was deleted.

151 changes: 0 additions & 151 deletions configs/env-local.php

This file was deleted.

11 changes: 4 additions & 7 deletions configs/env.php.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?php
<?php

$config = require 'config.php';

/**
* server.php returns the currenct configuration instance and must be in the ignore section of your VCS.
*/

// in this case we return the pre production configs:
return require 'env-local.php';
return $config->toArray([\luya\Config::ENV_LOCAL]);
28 changes: 28 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: '2'

services:
luya_composer:
image: composer:latest
volumes:
- ./:/app
command: composer install
luya_php:
image: luyadev/luya-docker-php
volumes:
- ./:/app
luya_db:
image: mysql:5.7
command:
- --character-set-server=utf8
- --collation-server=utf8_general_ci
environment:
MYSQL_ROOT_PASSWORD: luya
MYSQL_DATABASE: luya_core
MYSQL_USER: luya
MYSQL_PASSWORD: luya
luya_web:
image: luyadev/luya-docker-nginx
ports:
- "8080:80"
volumes:
- ./:/app

0 comments on commit 9d0a23d

Please sign in to comment.