Description | Pros | Cons | |
---|---|---|---|
Bare-metal | Apache/nginx, MySQL, etc. |
|
|
Cloud (AWS/GCP/Azure/Oracle Cloud) | Using a cloud provider |
|
|
Docker, WAMPP, XAMPP, Laragon | Idea of a separate environs per app |
|
|
Docker-compose (Galley/Devilbox) | docker-compose.yml to keep services separate |
|
|
Hybrid Kubernetes | Containerize everything. Use AWS + on-prem |
|
|
Hybrid-hybrid | Containerize some things, deploy some places |
|
|
#!/usr/bin/env bash
DEBUG=true
SITE_KEY="WhiteLabel" # Cassini Mars Vseo Cluster Enpa WhiteLabel Merit Lucy
# used for cake and docker-compose.yml
DB_HOST="mysql" # mysql for docker, localhost for testserver, etc
DB_DATABASE="sitename" # vseo
DB_USERNAME="root"
DB_PASSWORD="XXXXXX"
# These are what we use in docker-compose.yml
RABBITMQ_USERNAME="myuser"
RABBITMQ_PASSWORD="mypassword"
config/.env
ln -s config/.env .env
/*
* See https://github.com/josegonzalez/php-dotenv for API details.
*
* Uncomment block of code below if you want to use `.env` file during development.
* You should copy `config/.env.example` to `config/.env` and set/modify the
* variables as required.
*
* The purpose of the .env file is to emulate the presence of the environment
* variables like they would be present in production.
*
* If you use .env files, be careful to not commit them to source control to avoid
* security risks. See https://github.com/josegonzalez/php-dotenv#general-security-information
* for more information for recommended practices.
*/
if (!getenv('SITE_KEY')) {
if (!env('APP_NAME') && file_exists(CONFIG . '.env')) {
$dotenv = new Loader([CONFIG . '.env']);
$dotenv->parse()
->putenv()
->toEnv()
->toServer();
}
if (is_string('SITE_KEY')) {
define('SITE_KEY', getenv('SITE_KEY'));
} else {
dd('SITE_KEY NOT DEFINED. Create config/.env file from config/.env.example');
}
}
bootstrap.php
/*
* Load an plugin configuration file to
* provide overrides to your configuration.
*/
$siteKey = strtolower(getenv ('SITE_KEY'));
$pluginAppPath =
Configure::read('App.paths.plugins')[0] .
getenv ('SITE_KEY') . DS . 'config' . DS;
$pluginAppFile = 'app_' . $siteKey;
if (file_exists($pluginAppPath . $pluginAppFile . '.php')) {
Configure::config('plugin', new PhpConfig($pluginAppPath));
Configure::load($pluginAppFile, 'plugin');
}
bootstrap.php
'AdditionalPlugins' => [
'HealthAndSafety' => [
'configFiles' => [
'Telemetry Definitions' => 'tlm_def',
'Science Lookup Table' => 'sci_lut',
'Energy Tables for Hi' => 'energy_tables_hi',
'Energy Tables for Lo' => 'energy_tables_lo',
],
'configFileExts' => ['xls', 'xlsx', 'xlsm', 'xtce'],
],
'QueueableTasks'
],
'Codice' => [
'Constants' => [
'SITE_THEME' => 'Codice',
'SITE_NAME' => 'IMAP/CoDICE',
'SITE_TITLE' => 'IMAP: Interstellar Mapping and Acceleration Probe / CoDICE: Compact Dual Ion Composition Experiment',
'POWERPOINT_COLOR' => '605ca8',
'SKIN' => 'grey',
],
'Helpers' => [
'Treeview' => [...],
],
],
],
app_codice.php
$additionalPlugins = Configure::read('AdditionalPlugins');
if (!empty($additionalPlugins)) {
foreach ($additionalPlugins as $additionalPlugin => $additionalPluginConfig) {
if (is_array($additionalPluginConfig)) {
$this->addPluginToPsr($additionalPlugin);
} else {
$this->addPluginToPsr($additionalPluginConfig);
}
}
}
bootstrap()
private function addPluginToPsr($plugin): void
{
/** @var ClassLoader $loader */
$loader = require ROOT . '/vendor/autoload.php';
$loader->addPsr4($plugin . '\\', ROOT . DS . 'plugins' . DS . $plugin . DS . 'src');
$this->addPlugin($plugin, ['bootstrap' => true, 'routes' => true]);
}
$builder->connect('/{controller}', ['action' => 'index', 'plugin' => getenv ('SITE_KEY')]);
$builder->connect('/{controller}/{action}/*', ['plugin' => getenv ('SITE_KEY')]);
routes.php
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$params = $request->getAttribute('params', []);
// If controller does not exist in plugin, direct to Base src
if (
!empty($params['plugin']) &&
$params['plugin'] === SITE_KEY &&
!empty($params['controller']) &&
!class_exists($params['plugin'] . '\Controller\\' . $params['controller'] . 'Controller')
) {
$params['plugin'] = null;
}
$request = $request->withAttribute('params', $params);
return $handler->handle($request);
}
PluginRoutingMiddleware.php
Pros | Cons | What we use | |
---|---|---|---|
dereuromark-queue |
|
|
|
Cake/queue |
|
|
|
git config --system http.sslCAPath /etc/pki/tls/certs
git config --global http.sslVerify "false"