From 9437483030ae37c23590db1f1cc3070891173496 Mon Sep 17 00:00:00 2001 From: servdal Date: Thu, 17 Jul 2025 08:13:00 +0700 Subject: [PATCH] Update bug waiting laravel --- docker-compose.yml | 3 +- htdocs/Dockerfile | 2 +- .../2024_11_30_075824_create_samples.php | 16 ++++---- .../2024_11_30_075831_create_test_results.php | 22 +++++----- htdocs/database/seeders/DatabaseSeeder.php | 3 +- htdocs/entrypoint.sh | 5 --- htdocs/listenerlis/listener.log | 40 +++++++++++++++++++ 7 files changed, 65 insertions(+), 26 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ab0f038f..1570873b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,7 +36,8 @@ services: ports: - "8088:8080" depends_on: - - postgresql + postgresql: + condition: service_healthy command: php artisan serve --host=0.0.0.0 --port=8080 networks: - proxy diff --git a/htdocs/Dockerfile b/htdocs/Dockerfile index fc749ced..c9e145f8 100644 --- a/htdocs/Dockerfile +++ b/htdocs/Dockerfile @@ -63,7 +63,7 @@ WORKDIR /var/www/html # RUN composer create-project laravel/laravel:^10 /var/www/html # Set permission -RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache +#RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache EXPOSE 9000 #CMD ["php-fpm"] diff --git a/htdocs/database/migrations/2024_11_30_075824_create_samples.php b/htdocs/database/migrations/2024_11_30_075824_create_samples.php index d3804c46..05ebc2c7 100644 --- a/htdocs/database/migrations/2024_11_30_075824_create_samples.php +++ b/htdocs/database/migrations/2024_11_30_075824_create_samples.php @@ -11,13 +11,15 @@ return new class extends Migration */ public function up(): void { - Schema::create('samples', function (Blueprint $table) { - $table->id(); - $table->string('patient_name', 250)->nullable(); - $table->string('test_details', 255)->nullable(); - $table->timestamp('created_at')->useCurrent(); - $table->timestamp('updated_at')->useCurrent(); - }); + if (!Schema::hasTable('samples')) { + Schema::create('samples', function (Blueprint $table) { + $table->id(); + $table->string('patient_name', 250)->nullable(); + $table->string('test_details', 255)->nullable(); + $table->timestamp('created_at')->useCurrent(); + $table->timestamp('updated_at')->useCurrent(); + }); + } } /** diff --git a/htdocs/database/migrations/2024_11_30_075831_create_test_results.php b/htdocs/database/migrations/2024_11_30_075831_create_test_results.php index 49a317c5..fabcdfeb 100644 --- a/htdocs/database/migrations/2024_11_30_075831_create_test_results.php +++ b/htdocs/database/migrations/2024_11_30_075831_create_test_results.php @@ -11,16 +11,18 @@ return new class extends Migration */ public function up(): void { - Schema::create('test_results', function (Blueprint $table) { - $table->id(); // ID primary key - $table->unsignedBigInteger('sample_id'); // Kolom referensi - $table->text('result'); // Kolom result - $table->string('status', 50); // Kolom status - $table->timestamp('created_at')->useCurrent(); - $table->timestamp('updated_at')->useCurrent(); - // Foreign key - $table->foreign('sample_id')->references('id')->on('samples')->onDelete('cascade'); - }); + if (!Schema::hasTable('test_results')) { + Schema::create('test_results', function (Blueprint $table) { + $table->id(); // ID primary key + $table->unsignedBigInteger('sample_id'); // Kolom referensi + $table->text('result'); // Kolom result + $table->string('status', 50); // Kolom status + $table->timestamp('created_at')->useCurrent(); + $table->timestamp('updated_at')->useCurrent(); + // Foreign key + $table->foreign('sample_id')->references('id')->on('samples')->onDelete('cascade'); + }); + } } /** diff --git a/htdocs/database/seeders/DatabaseSeeder.php b/htdocs/database/seeders/DatabaseSeeder.php index 40b16d7f..edf579d4 100644 --- a/htdocs/database/seeders/DatabaseSeeder.php +++ b/htdocs/database/seeders/DatabaseSeeder.php @@ -13,8 +13,7 @@ class DatabaseSeeder extends Seeder */ public function run(): void { - User::factory(10)->create(); - User::factory()->create([ + User::create([ 'nama' => 'Administrator', 'username' => 'admin', 'password' => bcrypt('semangat'), diff --git a/htdocs/entrypoint.sh b/htdocs/entrypoint.sh index 601dc006..4fc840fc 100644 --- a/htdocs/entrypoint.sh +++ b/htdocs/entrypoint.sh @@ -1,10 +1,5 @@ #!/bin/bash -# Tunggu database siap -until php artisan migrate:status > /dev/null 2>&1; do - echo "Waiting for database to be ready..." - sleep 3 -done # Cek apakah migration sudah pernah dijalankan if php artisan migrate:status | grep -q "| Y"; then diff --git a/htdocs/listenerlis/listener.log b/htdocs/listenerlis/listener.log index 27562d4f..a0469f16 100644 --- a/htdocs/listenerlis/listener.log +++ b/htdocs/listenerlis/listener.log @@ -1590,3 +1590,43 @@ OBR|||1|TEST123^Exa 2025-07-17 00:27:40,799 - ERROR - Failed to bind to port 6001: [Errno 98] Address already in use 2025-07-17 00:27:40,825 - WARNING - * Debugger is active! 2025-07-17 00:27:40,826 - INFO - * Debugger PIN: 139-464-079 +2025-07-17 00:57:38,623 - INFO - Listening on TCP port 6001... +2025-07-17 00:57:38,798 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on all addresses (0.0.0.0) + * Running on http://127.0.0.1:5000 + * Running on http://172.18.0.4:5000 +2025-07-17 00:57:38,798 - INFO - Press CTRL+C to quit +2025-07-17 00:57:38,799 - INFO - * Restarting with stat +2025-07-17 00:57:42,059 - ERROR - Failed to bind to port 6001: [Errno 98] Address already in use +2025-07-17 00:57:42,102 - WARNING - * Debugger is active! +2025-07-17 00:57:42,111 - INFO - * Debugger PIN: 682-061-109 +2025-07-17 01:07:55,681 - INFO - Listening on TCP port 6001... +2025-07-17 01:07:56,048 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on all addresses (0.0.0.0) + * Running on http://127.0.0.1:5000 + * Running on http://172.18.0.3:5000 +2025-07-17 01:07:56,048 - INFO - Press CTRL+C to quit +2025-07-17 01:07:56,050 - INFO - * Restarting with stat +2025-07-17 01:08:00,741 - ERROR - Failed to bind to port 6001: [Errno 98] Address already in use +2025-07-17 01:08:00,765 - WARNING - * Debugger is active! +2025-07-17 01:08:00,767 - INFO - * Debugger PIN: 455-916-409 +2025-07-17 01:10:05,931 - INFO - Listening on TCP port 6001... +2025-07-17 01:10:06,006 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on all addresses (0.0.0.0) + * Running on http://127.0.0.1:5000 + * Running on http://172.18.0.3:5000 +2025-07-17 01:10:06,007 - INFO - Press CTRL+C to quit +2025-07-17 01:10:06,008 - INFO - * Restarting with stat +2025-07-17 01:10:10,441 - ERROR - Failed to bind to port 6001: [Errno 98] Address already in use +2025-07-17 01:10:10,464 - WARNING - * Debugger is active! +2025-07-17 01:10:10,465 - INFO - * Debugger PIN: 195-044-760 +2025-07-17 01:11:48,115 - INFO - Listening on TCP port 6001... +2025-07-17 01:11:48,313 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on all addresses (0.0.0.0) + * Running on http://127.0.0.1:5000 + * Running on http://172.18.0.3:5000 +2025-07-17 01:11:48,314 - INFO - Press CTRL+C to quit +2025-07-17 01:11:48,316 - INFO - * Restarting with stat +2025-07-17 01:11:53,049 - ERROR - Failed to bind to port 6001: [Errno 98] Address already in use +2025-07-17 01:11:53,099 - WARNING - * Debugger is active! +2025-07-17 01:11:53,100 - INFO - * Debugger PIN: 804-449-067