Skip to content

Commit

Permalink
5.0 constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
nadar committed Apr 29, 2024
1 parent 6f08bd0 commit 45eaeed
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 73 deletions.
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
"type": "luya-kickstarter",
"license":"MIT",
"require": {
"luyadev/luya-module-admin" : "^4.0",
"luyadev/luya-module-cms" : "^4.0",
"luyadev/luya-module-admin" : "^5.0",
"luyadev/luya-module-cms" : "^5.0",
"luyadev/luya-bootstrap4": "^1.0",
"luyadev/luya-generic" : "^1.0"
},
"require-dev": {
"yiisoft/yii2-debug" : "^2.0",
"yiisoft/yii2-gii" : "^2.0",
"luyadev/luya-deployer": "^1.0",
"luyadev/luya-deployer": "^3.0",
"twbs/bootstrap": "^4.0"
},
"config": {
"fxp-asset": {
"enabled": false
"platform": {
"php": "8.2"
},
"allow-plugins": {
"yiisoft/yii2-composer": true,
Expand Down
90 changes: 46 additions & 44 deletions configs/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,55 +69,57 @@
]
]);

$config->callback(function() {
define('YII_DEBUG', true);
define('YII_ENV', 'local');
})->env(Config::ENV_LOCAL);
/************ 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);
$config->env(Config::ENV_LOCAL, function (Config $config) {
$config->callback(function () {
define('YII_DEBUG', true);
define('YII_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);
*/
// docker mysql config
$config->component('db', [
'dsn' => 'mysql:host=luya_db;dbname=luya',
'username' => 'luya',
'password' => 'luya',
]);

$config->component('assetManager', [
'class' => 'luya\web\AssetManager',
'linkAssets' => true
]);

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

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

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

$config->application([
'ensureSecureConnection' => true, // https://luya.io/guide/app-security
])->env(Config::ENV_PROD);
$config->env(Config::ENV_PROD, function (Config $config) {
$config->component('db', [
'dsn' => 'mysql:host=localhost;dbname=DB_NAME',
'username' => '',
'password' => '',
'enableSchemaCache' => true,
'schemaCacheDuration' => 0,
]);

// 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);
$config->component('cache', [
'class' => 'yii\caching\FileCache'
]);

$config->application([
'ensureSecureConnection' => true, // https://luya.io/guide/app-security
]);
});

return $config;
28 changes: 8 additions & 20 deletions deploy.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
<?php

require 'vendor/luyadev/luya-deployer/luya.php';
namespace Deployer;

// DEV environment
server('dev', 'server.tld', 22)
->user('username')
->password('password')
->stage('dev')
->env('deploy_path', '/path/to/dev/project/public_html');
require 'vendor/luyadev/luya-deployer/luya.php';

// Preproduction environment
server('prep', 'server.tld', 22)
->user('username')
->password('password')
->stage('prep')
->env('deploy_path', '/path/to/prep/project/public_html');
host('SSH_HOST')
->setLabels(['stage' => 'prod'])
->set('remote_user', 'SSH_USER_NAME')
->set('deploy_path', '~/httpdocs');

// Production environment
server('prod', 'server.tld', 22)
->user('username')
->password('password')
->stage('prod')
->env('deploy_path', '/path/to/prod/project/public_html');
after('luya:commands', 'unglue');

set('repository', 'https://user:password@github.com/organisation/repository.git');
set('repository', 'https://USER:PASSWORD@github.com/VENDOR/REPO.git');
16 changes: 12 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
version: '3'
services:

luya_composer:
image: composer:latest
image: composer
volumes:
- ./:/app
command: composer install

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_DATABASE: luya
MYSQL_USER: luya
MYSQL_PASSWORD: luya
ports:
- "3306:3306"

luya_web:
image: luyadev/luya-docker:nginx-fpm-php74
image: registry.gitlab.com/zephir.ch/foss/luya-docker:php82
volumes:
- ./:/app
- ./localphp.ini:/etc/php82/conf.d/zzz_custom.ini
- ./:/var/www/html
healthcheck:
disable: true
7 changes: 7 additions & 0 deletions localphp.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[opcache]
opcache.validate_timestamps=1
opcache.revalidate_freq=1
[PHP]
display_errors = On
log_errors = On
error_reporting = E_ALL

0 comments on commit 45eaeed

Please sign in to comment.