From e989f053c4d4d2ee4e9fecd4a57972d6eec58a66 Mon Sep 17 00:00:00 2001 From: ISMAIL MASSERAN Date: Wed, 22 Apr 2026 12:44:16 +0800 Subject: [PATCH] DO NOT PR THIS BRANCHgit add .!; DONE: add docker config for development --- .env.docker | 66 +++++++++++++++++++++++++ .gitignore | 2 +- README.md | 16 ++++++ bootstrap/app.php | 28 +++++++++++ config/app_parameter.php | 2 +- config/logging.php | 103 +++++++++++++++++++++++++++++++++++++++ docker/php/Dockerfile | 40 +++++++-------- 7 files changed, 235 insertions(+), 22 deletions(-) create mode 100644 .env.docker create mode 100644 config/logging.php diff --git a/.env.docker b/.env.docker new file mode 100644 index 0000000..fedbeed --- /dev/null +++ b/.env.docker @@ -0,0 +1,66 @@ +APP_NAME=Lumen +APP_ENV=local +APP_KEY=WbPGkYNmXZ6ZQplGlvl0iZ7zyW1b09xa +APP_DEBUG=true +APP_URL=http://localhost +APP_TIMEZONE=Asia/Kuala_Lumpur + +LOG_CHANNEL=stack +LOG_LEVEL=debug +LOG_SLACK_WEBHOOK_URL= + +DB_CONNECTION=mysql +DB_HOST=mysql +DB_PORT=3306 +DB_DATABASE=erahn_xtra +DB_USERNAME=root +DB_PASSWORD=root + +DB_CONNECTION_7=mysql +DB_HOST_7=mysql +DB_PORT_7=3306 +DB_DATABASE_7=master_erahn +DB_USERNAME_7=root +DB_PASSWORD_7=root + +# DB_CONNECTION_3=mysql +# DB_HOST_3=127.0.0.1 +# DB_PORT_3=3306 +# DB_DATABASE_3=erahn_baling +# DB_USERNAME_3=root +# DB_PASSWORD_3=root + +# DB_CONNECTION_4=mysql +# DB_HOST_4=127.0.0.1 +# DB_PORT_4=3306 +# DB_DATABASE_4=arrahn_ld +# DB_USERNAME_4=root +# DB_PASSWORD_4=root + +# DB_CONNECTION_5=mysql +# DB_HOST_5=127.0.0.1 +# DB_PORT_5=3306 +# DB_DATABASE_5=erahn_segamat +# DB_USERNAME_5=root +# DB_PASSWORD_5=root + +# DB_CONNECTION_6=mysql +# DB_HOST_6=127.0.0.1 +# DB_PORT_6=3306 +# DB_DATABASE_6=arrahn_kb2 +# DB_USERNAME_6=spider +# DB_PASSWORD_6=G0dz!ll42020 + + +# DB_CONNECTION_8=mysql +# DB_HOST_8=127.0.0.1 +# DB_PORT_8=3306 +# DB_DATABASE_8=arrahn_klanas +# DB_USERNAME_8=spider +# DB_PASSWORD_8=G0dz!ll42020 + +TENNANT_MASTER_DB=master_erahn +TENNANT_KAUNTER_DB=kaunter_erahn + +CACHE_DRIVER=file +QUEUE_CONNECTION=sync \ No newline at end of file diff --git a/.gitignore b/.gitignore index 39329cd..89ac166 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,6 @@ Homestead.yaml .env .phpunit.result.cache ray.php -docker-compose.yml /docker_src /.vscode +**/.DS_Store \ No newline at end of file diff --git a/README.md b/README.md index ac83c8d..3b1ebc0 100644 --- a/README.md +++ b/README.md @@ -1 +1,17 @@ You know what is this when you in this project + +If you does't know what is this you probably in wrong project + +```sql +--- for all ip +CREATE USER 'master_erahn'@'%' IDENTIFIED BY 'password'; + +--- for specific ip +CREATE USER 'kaunter_erahn'@'localhost' IDENTIFIED BY 'password'; + +GRANT ALL PRIVILEGES ON kaunter_erahn.* TO 'kaunter_erahn'@'%'; +FLUSH PRIVILEGES; +``` + +Gadai=Pembiayaan +Tebus=penyelesaian penuh/ansuran \ No newline at end of file diff --git a/bootstrap/app.php b/bootstrap/app.php index d358544..e5febcc 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -23,6 +23,33 @@ $app = new Laravel\Lumen\Application( dirname(__DIR__) ); +/* +| Laravel's storage_path() helper resolves app('path.storage'). Lumen does not +| register that binding by default; config files that call storage_path() at +| load time (e.g. config/logging.php) would fail without this. +*/ +$app->instance('path.storage', $app->storagePath()); + +/* +| Laravel's Foundation helpers are loaded before Lumen's and win for names like +| response() and url(). Those helpers resolve Illuminate\Contracts\* from the +| container; Lumen only registers the "url" service, not the contracts. Map the +| contracts to Lumen's implementations so helpers work across the app. +*/ +$app->singleton( + \Illuminate\Contracts\Routing\ResponseFactory::class, + function () { + return new \Laravel\Lumen\Http\ResponseFactory(); + } +); + +$app->singleton( + \Illuminate\Contracts\Routing\UrlGenerator::class, + function ($app) { + return $app->make('url'); + } +); + $app->withFacades(); $app->withEloquent(); @@ -60,6 +87,7 @@ $app->singleton( */ $app->configure('app'); +$app->configure('logging'); $app->configure('tinker'); $app->configure('tennant_database'); $app->configure('report'); diff --git a/config/app_parameter.php b/config/app_parameter.php index c46f175..b9b4014 100644 --- a/config/app_parameter.php +++ b/config/app_parameter.php @@ -1,7 +1,7 @@ env('APP_URL', url('/')), + 'url' => env('APP_URL', 'http://localhost'), 'api_arrahnbid' => env('API_ARRAHNBID', 'http://lelong.test/api/'), 'api_v3' => env('API_V3', 'http://apiv3.localhost/api/') ]; diff --git a/config/logging.php b/config/logging.php new file mode 100644 index 0000000..985406d --- /dev/null +++ b/config/logging.php @@ -0,0 +1,103 @@ + env('LOG_CHANNEL', 'stack'), + + /* + |-------------------------------------------------------------------------- + | Log Channels + |-------------------------------------------------------------------------- + | + | Here you may configure the log channels for your application. Out of + | the box, Laravel uses the Monolog PHP logging library. This gives + | you a variety of powerful log handlers / formatters to utilize. + | + | Available Drivers: "single", "daily", "slack", "syslog", + | "errorlog", "monolog", "custom", "stack" + | + */ + + 'channels' => [ + 'stack' => [ + 'driver' => 'stack', + 'channels' => ['single'], + 'ignore_exceptions' => false, + ], + + 'single' => [ + 'driver' => 'single', + 'path' => storage_path('logs/laravel.log'), + 'level' => env('LOG_LEVEL', 'debug'), + ], + + 'daily' => [ + 'driver' => 'daily', + 'path' => storage_path('logs/laravel.log'), + 'level' => env('LOG_LEVEL', 'debug'), + 'days' => 14, + ], + + 'slack' => [ + 'driver' => 'slack', + 'url' => env('LOG_SLACK_WEBHOOK_URL'), + 'username' => 'Laravel Log', + 'emoji' => ':boom:', + 'level' => env('LOG_LEVEL', 'critical'), + ], + + 'papertrail' => [ + 'driver' => 'monolog', + 'level' => env('LOG_LEVEL', 'debug'), + 'handler' => SyslogUdpHandler::class, + 'handler_with' => [ + 'host' => env('PAPERTRAIL_URL'), + 'port' => env('PAPERTRAIL_PORT'), + ], + ], + + 'stderr' => [ + 'driver' => 'monolog', + 'handler' => StreamHandler::class, + 'formatter' => env('LOG_STDERR_FORMATTER'), + 'with' => [ + 'stream' => 'php://stderr', + ], + ], + + 'syslog' => [ + 'driver' => 'syslog', + 'level' => env('LOG_LEVEL', 'debug'), + ], + + 'errorlog' => [ + 'driver' => 'errorlog', + 'level' => env('LOG_LEVEL', 'debug'), + ], + + 'null' => [ + 'driver' => 'monolog', + 'handler' => NullHandler::class, + ], + + 'emergency' => [ + 'path' => storage_path('logs/laravel.log'), + ], + ], + +]; diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile index 172df1c..45aac51 100644 --- a/docker/php/Dockerfile +++ b/docker/php/Dockerfile @@ -4,22 +4,22 @@ WORKDIR /var/www/html RUN apt-get update \ && apt-get install -y --no-install-recommends \ - git \ - pkg-config \ - unzip \ - libonig-dev \ - libzip-dev \ - libpng-dev \ - libjpeg62-turbo-dev \ - libfreetype6-dev \ + git \ + pkg-config \ + unzip \ + libonig-dev \ + libzip-dev \ + libpng-dev \ + libjpeg62-turbo-dev \ + libfreetype6-dev \ && docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-install -j"$(nproc)" \ - pdo_mysql \ - mbstring \ - bcmath \ - zip \ - exif \ - gd \ + pdo_mysql \ + mbstring \ + bcmath \ + zip \ + exif \ + gd \ && rm -rf /var/lib/apt/lists/* COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer @@ -40,12 +40,12 @@ COPY --chown=www-data:www-data . /var/www/html RUN composer install --no-interaction --prefer-dist --no-dev --optimize-autoloader \ && mkdir -p \ - storage/logs \ - storage/framework/cache/data \ - storage/framework/views \ - storage/framework/sessions \ - storage/app/public \ - bootstrap/cache \ + storage/logs \ + storage/framework/cache/data \ + storage/framework/views \ + storage/framework/sessions \ + storage/app/public \ + bootstrap/cache \ && chown -R www-data:www-data storage bootstrap/cache vendor FROM base AS development