Add Docker Compose production stack (php-apache, mariadb, node/pm2)
Single-command deploy: docker compose up -d --build brings up the LEMP stack plus the Node realtime/scheduler service. app/config.php and DB secrets are generated from .env at container start, never baked into the image or committed.
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
//<><><><><><><><> MAIN CONFIG (docker-generated) <><><><><><><><>//
|
||||
if(true){
|
||||
$isTest = "master";
|
||||
$base_url = "/wms-app/";
|
||||
$server_url = $base_url."app/";
|
||||
$include_url = $_SERVER['DOCUMENT_ROOT'].$server_url;
|
||||
|
||||
$db_server = "db";
|
||||
$db_user = "root";
|
||||
$db_pass = "${DB_ROOT_PASSWORD}";
|
||||
$db_type = "mysql";
|
||||
$db_database = "wms";
|
||||
$db_database2 = "wms2";
|
||||
|
||||
$db_server2 = (!empty($db_server2))?$db_server2:$db_server;
|
||||
$db_user2 = (!empty($db_user2))?$db_user2:$db_user;
|
||||
$db_pass2 = (!empty($db_pass2))?$db_pass2:$db_pass;
|
||||
$db_type2 = (!empty($db_type2))?$db_type2:$db_type;
|
||||
|
||||
$time_zone = "Asia/Bangkok";
|
||||
}
|
||||
|
||||
// ── Real-time Node.js server ─────────────────────────────────────────────────
|
||||
if (!defined('NODE_PUBLIC_URL')) {
|
||||
define('NODE_PUBLIC_URL', 'http://${PUBLIC_HOST}:3000');
|
||||
}
|
||||
if (!defined('NODE_EMIT_URL')) {
|
||||
define('NODE_EMIT_URL', 'http://node:3000/emit');
|
||||
}
|
||||
if (!defined('NODE_EMIT_SECRET')) {
|
||||
define('NODE_EMIT_SECRET', '${EMIT_SECRET}');
|
||||
}
|
||||
|
||||
// ── Usage packages ───────────────────────────────────────────────────────────
|
||||
$packages = [
|
||||
'starter' => [
|
||||
'daily_limit' => 30,
|
||||
'weekly_limit' => 100,
|
||||
'lock_on_limit' => ['dashboard'],
|
||||
],
|
||||
];
|
||||
|
||||
// unique key — used for SMTP password encryption, keep consistent across deploys
|
||||
$pinkey = "wms";
|
||||
|
||||
$SMTP = [];
|
||||
$SMTP['server'] = "smtp.gmail.com";
|
||||
$SMTP['username'] = "${SMTP_USERNAME}";
|
||||
$SMTP['port'] = "587";
|
||||
$SMTP['password'] = "${SMTP_PASSWORD}"; // Gmail app password, not your login password
|
||||
$method = "AES-256-CBC";
|
||||
$iv = "1234567890123456"; // Must be exactly 16 bytes
|
||||
$SMTP['password'] = openssl_encrypt($SMTP['password'], $method, $pinkey, 0, $iv);
|
||||
Reference in New Issue
Block a user