From f8f6c2c1121db35013a13e8a03bb24b6987cbfff Mon Sep 17 00:00:00 2001 From: floofyjin Date: Thu, 30 Oct 2025 00:43:50 -0700 Subject: [PATCH] add key for access laravel server. modified readme to reflect what is needed for new users --- Dockerfile | 14 +++++++++++++- README.md | 20 ++++++++++++++++++++ composer.json | 2 +- config/database.php | 8 ++++---- config/queue.php | 4 ++-- database/.gitignore | 2 +- phpunit.xml | 2 +- 7 files changed, 42 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3274dbd..076bb42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,11 @@ FROM php:8.3-apache RUN apt-get update && apt-get install -y \ libpq-dev \ curl \ + git \ + libzip-dev \ && curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \ && apt-get install -y nodejs \ - && docker-php-ext-install pdo pdo_pgsql pcntl + && docker-php-ext-install pdo pdo_pgsql pcntl zip # Enable Apache mod_rewrite RUN a2enmod rewrite @@ -14,5 +16,15 @@ RUN a2enmod rewrite # Set working directory WORKDIR /var/www/html +# Copy only package files, install node deps (faster caches) +COPY package*.json ./ +RUN npm ci --unsafe-perm + +# Make git accept repo path (prevents dubious ownership) +RUN git config --global --add safe.directory /var/www/html + +# Now copy app code +COPY . . + # Install composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer \ No newline at end of file diff --git a/README.md b/README.md index 2f98d50..675bef7 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,26 @@ Apply all migrations to the database: php artisan migrate ``` +### 3. Generate key + +Your .env should look something like this prior to running the command: + +``` +DB_CONNECTION=pgsql +DB_HOST=db +DB_PORT=5432 +DB_DATABASE=laravel +DB_USERNAME=laravel +DB_PASSWORD=secret +APP_KEY= +``` + +Generate Artisan key necessary for accessing endpoint: + +```bash +exec laravel php artisan key:generate +``` + **Note:** this step has to be redone every time a new database migration is written. ## Development diff --git a/composer.json b/composer.json index 2c38b11..de2977e 100644 --- a/composer.json +++ b/composer.json @@ -66,7 +66,7 @@ ], "post-create-project-cmd": [ "@php artisan key:generate --ansi", - "@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"", + "@php -r \"file_exists('database/database.pgsql') || touch('database/database.pgsql');\"", "@php artisan migrate --graceful --ansi" ], "pre-package-uninstall": [ diff --git a/config/database.php b/config/database.php index 53dcae0..ea07bb1 100644 --- a/config/database.php +++ b/config/database.php @@ -16,7 +16,7 @@ return [ | */ - 'default' => env('DB_CONNECTION', 'sqlite'), + 'default' => env('DB_CONNECTION', 'pgsql'), /* |-------------------------------------------------------------------------- @@ -31,10 +31,10 @@ return [ 'connections' => [ - 'sqlite' => [ - 'driver' => 'sqlite', + 'pgsql' => [ + 'driver' => 'pgsql', 'url' => env('DB_URL'), - 'database' => env('DB_DATABASE', database_path('database.sqlite')), + 'database' => env('DB_DATABASE', database_path('database.pgsql')), 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 'busy_timeout' => null, diff --git a/config/queue.php b/config/queue.php index 9d5e589..81c4713 100644 --- a/config/queue.php +++ b/config/queue.php @@ -99,7 +99,7 @@ return [ */ 'batching' => [ - 'database' => env('DB_CONNECTION', 'sqlite'), + 'database' => env('DB_CONNECTION', 'pgsql'), 'table' => 'job_batches', ], @@ -118,7 +118,7 @@ return [ 'failed' => [ 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), - 'database' => env('DB_CONNECTION', 'sqlite'), + 'database' => env('DB_CONNECTION', 'pgsql'), 'table' => 'failed_jobs', ], diff --git a/database/.gitignore b/database/.gitignore index 9b19b93..d229486 100644 --- a/database/.gitignore +++ b/database/.gitignore @@ -1 +1 @@ -*.sqlite* +*.pgsql* diff --git a/phpunit.xml b/phpunit.xml index d703241..30886ad 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -23,7 +23,7 @@ - +