Skip to content

Commit

Permalink
feat: laravel-11.x updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp committed May 29, 2024
1 parent 128be93 commit 72225c6
Show file tree
Hide file tree
Showing 20 changed files with 316 additions and 297 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_HOST=database
DB_PORT=5432
DB_DATABASE=wod
DB_USERNAME=wod
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/deploy-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ on: # yamllint disable-line rule:truthy

name: 🚀 Deploy to production

concurrency: production

jobs:
deployment:
runs-on: "ubuntu-22.04"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on: # yamllint disable-line rule:truthy

name: 🚀 Deploy to staging

concurrency: staging

jobs:
deployment:
runs-on: ${{ matrix.os }}
Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,23 @@ lint-yaml: ## Lints yaml files inside project
.PHONY: lint-yaml

lint-php: ## Lints php files inside project using php-cs-fixer
$(APP_COMPOSER) run-script cs:fix
$(APP_COMPOSER) cs:fix
.PHONY: lint-php

lint-diff: ## Shows diff of php-cs-fixer
$(APP_COMPOSER) run-script cs:diff
$(APP_COMPOSER) cs:diff
.PHONY: lint-diff

lint-stan:
$(APP_COMPOSER) run-script stan
$(APP_COMPOSER) stan
.PHONY: lint-stan

lint-stan-baseline: ## Runs phpstan to update its baseline
$(APP_COMPOSER) stan:baseline
.PHONY: lint-stan-baseline

lint-deps:
$(APP_COMPOSER) run-script deptrac
$(APP_COMPOSER) deptrac
.PHONY: lint-deps

test: ## Run project php-unit and pest tests
Expand Down
1 change: 1 addition & 0 deletions app/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"test": "php vendor/bin/pest",
"test:cc": "XDEBUG_MODE=coverage php vendor/bin/pest --coverage-clover coverage.xml",
"stan": "php vendor/bin/phpstan analyse --memory-limit=2G",
"stan:baseline": "php vendor/bin/phpstan analyse --generate-baseline --memory-limit=2G --allow-empty-baseline",
"deptrac": "php vendor/bin/deptrac analyse --config-file=deptrac.yaml -v --cache-file=.build/.deptrac.cache",
"deptrac:ci": "php vendor/bin/deptrac analyse --config-file=deptrac.yaml -v --cache-file=.build/.deptrac.cache --formatter github-actions",
"deptrac:gv": "php vendor/bin/deptrac analyse --config-file=deptrac.yaml -v --cache-file=.build/.deptrac.cache --formatter graphviz-image --output ../assets/deptrac.svg"
Expand Down
26 changes: 13 additions & 13 deletions app/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ public function up(): void
$table->json('updated_by')->nullable();
$table->json('deleted_by')->nullable();
});

Schema::create('password_reset_tokens', function (Blueprint $table): void {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});

Schema::create('sessions', function (Blueprint $table): void {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}

/**
Expand All @@ -40,5 +55,7 @@ public function up(): void
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};
36 changes: 36 additions & 0 deletions app/database/migrations/0001_01_01_000001_create_cache_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table): void {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration');
});

Schema::create('cache_locks', function (Blueprint $table): void {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration');
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};
58 changes: 58 additions & 0 deletions app/database/migrations/0001_01_01_000002_create_jobs_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table): void {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});

Schema::create('job_batches', function (Blueprint $table): void {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});

Schema::create('failed_jobs', function (Blueprint $table): void {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};

This file was deleted.

This file was deleted.

7 changes: 4 additions & 3 deletions app/deploy.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

set('application', 'laravel-starter-tpl');
set('repository', '[email protected]:wayofdev/laravel-starter-tpl.git');
set('base_deploy_path', '/home/ploi');

set('composer_options', '--verbose --no-progress --no-interaction --optimize-autoloader');
set('branch', function () {
Expand All @@ -18,6 +17,8 @@
return host($stage)->get('branch');
});

set('keep_releases', 3);

function getDefaultEnv(mixed $variable, mixed $default = null)
{
$value = getenv($variable);
Expand All @@ -26,7 +27,7 @@ function getDefaultEnv(mixed $variable, mixed $default = null)

host('staging')
->set('branch', getDefaultEnv('DEPLOYER_STAGING_BRANCH', 'develop'))
->set('remote_user', getDefaultEnv('DEPLOYER_STAGING_REMOTE_USER', 'staging-crhev'))
->set('remote_user', getDefaultEnv('DEPLOYER_STAGING_REMOTE_USER', 'staging-trpqg'))
->set('base_deploy_path', '/home/{{ remote_user }}')
->set('hostname', getDefaultEnv('DEPLOYER_STAGING_HOST', 'staging.laravel-starter-tpl.wayof.dev'))
->set('deploy_path', '{{ base_deploy_path }}/{{ hostname}}')
Expand All @@ -35,7 +36,7 @@ function getDefaultEnv(mixed $variable, mixed $default = null)

host('prod')
->set('branch', getDefaultEnv('DEPLOYER_PROD_BRANCH', 'master'))
->set('remote_user', getDefaultEnv('DEPLOYER_PROD_REMOTE_USER', 'prod-ibce8'))
->set('remote_user', getDefaultEnv('DEPLOYER_PROD_REMOTE_USER', 'prod-hi2sb'))
->set('base_deploy_path', '/home/{{ remote_user }}')
->set('hostname', getDefaultEnv('DEPLOYER_PROD_HOST', 'prod.laravel-starter-tpl.wayof.dev'))
->set('deploy_path', '{{ base_deploy_path }}/{{ hostname }}')
Expand Down
Loading

0 comments on commit 72225c6

Please sign in to comment.