diff --git a/.env.example b/.env.example index 9e86595..dd66977 100644 --- a/.env.example +++ b/.env.example @@ -9,6 +9,7 @@ LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug DB_CONNECTION=sqlite +DATABASE_URL= BROADCAST_DRIVER=log CACHE_DRIVER=file @@ -57,3 +58,14 @@ JWT_ISSUER= JWT_AUDIENCE= JWT_PUBLIC_KEY_PEM= JWT_TOKEN= + +# Railway production example: +# APP_ENV=production +# APP_DEBUG=false +# APP_URL=https://your-service.up.railway.app +# LOG_CHANNEL=stderr +# DB_CONNECTION=pgsql +# DATABASE_URL=${{Postgres.DATABASE_URL}} +# CACHE_DRIVER=file +# SESSION_DRIVER=file +# QUEUE_CONNECTION=sync diff --git a/composer.json b/composer.json index 5445490..79f1e43 100644 --- a/composer.json +++ b/composer.json @@ -6,6 +6,7 @@ "license": "MIT", "require": { "php": "^8.1", + "ext-mbstring": "*", "guzzlehttp/guzzle": "^7.2", "laravel/framework": "^10.10", "laravel/sanctum": "^3.3", diff --git a/composer.lock b/composer.lock index 5591ea4..5758e37 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "dfdbaa9a791903e1a015e16cbcf49f3b", + "content-hash": "f080935717fcb1c63a43fa5940618db0", "packages": [ { "name": "brick/math", @@ -8540,7 +8540,8 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^8.1" + "php": "^8.1", + "ext-mbstring": "*" }, "platform-dev": {}, "plugin-api-version": "2.9.0" diff --git a/railway.json b/railway.json new file mode 100644 index 0000000..c630f34 --- /dev/null +++ b/railway.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://railway.com/railway.schema.json", + "build": { + "builder": "RAILPACK" + }, + "deploy": { + "preDeployCommand": "php artisan migrate --force", + "healthcheckPath": "/api/health", + "healthcheckTimeout": 100, + "restartPolicyType": "ON_FAILURE", + "restartPolicyMaxRetries": 10 + } +} diff --git a/routes/api.php b/routes/api.php index 7acb460..9947d32 100644 --- a/routes/api.php +++ b/routes/api.php @@ -21,11 +21,14 @@ Route::prefix('v1')->middleware(['jwt.auth'])->group(function () { // Jogos Route::get('/games/most-played', [GameController::class, 'mostPlayed']); +}); +Route::get('/health', function () { + return response()->json(['status' => 'ok']); }); Route::middleware(['jwt.auth'])->get('/test-auth', function (Request $request) { return response()->json([ 'userId' => $request->attributes->get('auth')['id'] ]); -}); \ No newline at end of file +});