From: Vincent Vanwaelscappel Date: Mon, 29 Jan 2024 17:27:52 +0000 (+0100) Subject: wip #6693 @3 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=7f507b2217b02e91dd0cc54a24c03526a8251075;p=fluidbook-toolbox.git wip #6693 @3 --- diff --git a/app/Http/Controllers/Admin/Operations/Tools/DockerWebContainer.php b/app/Http/Controllers/Admin/Operations/Tools/DockerWebContainer.php index 8a80da4e1..28b824fbe 100644 --- a/app/Http/Controllers/Admin/Operations/Tools/DockerWebContainer.php +++ b/app/Http/Controllers/Admin/Operations/Tools/DockerWebContainer.php @@ -30,16 +30,17 @@ trait DockerWebContainer $form->addField('domain', Text::class, __('Nom du domaine ou sous-domaine'), ['placeholder' => 'containername.dev.cubedesigners.com']); $form->addField('env', SelectFromArrayMultiple::class, __('Environnements'), ['default' => json_encode(['production', 'dev']), 'options' => ['production' => 'production', 'dev' => 'dev', 'staging' => 'staging', 'preprod' => 'preprod']]); $form->addField('public', Checkbox::class, __('Racine dans le dossier "public"'), ['default' => true]); + $form->addField('laravel', Checkbox::class, __('Installer Laravel'), ['default' => true]); $form->addField('phpversion', SelectFromArray::class, __('Version de PHP'), ["options" => ['none' => '-', '5.6' => '5.6', '7.4' => '7.4', - '8.1' => '8.1', '8.2' => '8.2', - ], 'value' => '8.2']); + '8.3' => '8.3', + ], 'value' => '8.3']); $form->addField('mysql', Checkbox::class, __('Serveur Mariadb') . ' (MySQL)', ['default' => true]); $form->addField('redis', Checkbox::class, __('Serveur Redis'), ['default' => true]); - $form->addField('matomo', Checkbox::class, __('Serveur Matomo'), ['default' => true]); + $form->addField('matomo', Checkbox::class, __('Serveur Matomo'), ['default' => false]); $form->addField('elasticsearch', Checkbox::class, __('Serveur ElasticSearch'), ['default' => false]); @@ -57,8 +58,10 @@ trait DockerWebContainer $notification = __('Le container web :name a été crée avec les informations suivantes', ['name' => $name]) . " : \n\n"; foreach ($envs as $env) { + $domain = $request->get('domain', ''); + $notification .= '---- Environnement : ' . $env . " ----\n\n"; - $subDomain = $env === 'production' ? 'www.' : $env . '.'; + $subDomain = $env === 'production' ? (substr_count($domain, '.') >= 2 ? '' : 'www.') : $env . '.'; $dockerSuffix = $env === 'production' ? '' : '-' . $env; if (count($envs) === 1) { @@ -68,7 +71,7 @@ trait DockerWebContainer $variables = ['$name' => $name . $dockerSuffix, '$matomodbpassword' => Str::random(16), '$sshport' => rand(10000, 60000), - '$domain' => $request->get('domain', ''), + '$domain' => $domain, '$dbpassword' => Str::random(16), '$phpfpmimage' => 'php-fpm', '$locale' => 'fr_FR', @@ -88,7 +91,7 @@ trait DockerWebContainer `cp -r $source/* $dir/`; $compose = ['base']; - $variables['$phpversion'] = $request->get('phpversion', '8.1'); + $variables['$phpversion'] = $request->get('phpversion', '8.3'); if ($variables['$phpversion'] !== 'none') { $compose[] = 'php'; if (version_compare($variables['$phpversion'], '5.6', '<=')) { @@ -112,6 +115,19 @@ trait DockerWebContainer $fixRights[] = 'chmod -R 777 ./esdata'; } + if ($request->get('laravel', true)) { + `rm -rf $dir/www;composer create-project laravel/laravel $dir/www`; + $composerFile = $dir . '/www/composer.json'; + $composer = json_decode(file_get_contents($composerFile)); + $composer->name = $name; + $composer->license = 'Proprietary'; + $composer->keywords = [$name]; + $composer->descriptions = $name . ' project'; + $composer->require->{"cubist/cms-back"} = 'dev-backpack5'; + file_put_contents($composerFile, json_encode($composer)); + `rm -rf $dir/www/vendor`; + } + $variables['$fixrights'] = implode("\n", $fixRights); $compose[] = 'network'; diff --git a/resources/tools/dockerwebcontainer/template/images/php-fpm/Dockerfile b/resources/tools/dockerwebcontainer/template/images/php-fpm/Dockerfile index a02c3060c..5166bca3f 100644 --- a/resources/tools/dockerwebcontainer/template/images/php-fpm/Dockerfile +++ b/resources/tools/dockerwebcontainer/template/images/php-fpm/Dockerfile @@ -48,7 +48,7 @@ RUN apt -y --no-install-recommends install \ php$phpversion-tidy \ php$phpversion-xsl \ php$phpversion-curl \ - php$phpversion-mcrypt \ + php$phpversion-bcmath \ php$phpversion-fpm \ less nano wget nodejs