Skip to content

Commit 80b718d

Browse files
committed
feat:route updated
1 parent 9030a7f commit 80b718d

File tree

10 files changed

+50
-3777
lines changed

10 files changed

+50
-3777
lines changed

.github/workflows/deploy.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ on:
77
branches: [main]
88

99
env:
10-
AWS_REGION: us-east-1
11-
ECR_REPOSITORY: laravel-blog-app
12-
ECS_SERVICE: laravel-blog-service
13-
ECS_CLUSTER: laravel-blog-cluster
14-
ECS_TASK_DEFINITION: laravel-blog-task
15-
CONTAINER_NAME: laravel-app
10+
AWS_REGION: ${{ secrets.AWS_REGION }}
11+
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
12+
ECS_SERVICE: ${{ secrets.ECS_SERVICE }}
13+
ECS_CLUSTER: ${{ secrets.ECS_CLUSTER }}
14+
CONTAINER_NAME: ${{ secrets.CONTAINER_NAME }}
1615

1716
jobs:
1817
test:
@@ -108,7 +107,7 @@ jobs:
108107
IMAGE_TAG: ${{ github.sha }}
109108
run: |
110109
# Build Docker image for production
111-
docker build -f docker/php/Dockerfile.prod -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
110+
docker build --platform linux/amd64 -f docker/php/Dockerfile.prod -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
112111
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
113112
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
114113

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,10 @@ composer.phar
9393

9494
.phpunit.result.cache
9595

96-
.terraform
96+
.terraform
97+
98+
terraform.tfvars
99+
tfplan
100+
.terraform.lock.hcl
101+
102+
.phpunit.result.cache

docker/php/Dockerfile.fixed

Lines changed: 0 additions & 115 deletions
This file was deleted.

docker/php/startup-fix.sh

Lines changed: 0 additions & 57 deletions
This file was deleted.

docker/php/startup.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,30 @@ if [ -f artisan ]; then
4747
echo "Finished environment initialization"
4848

4949
fi
50+
51+
echo "Starting Laravel application..."
52+
53+
# Wait for database to be ready and run migrations
54+
echo "Waiting for database connection..."
55+
until php artisan migrate:status --env=production > /dev/null 2>&1; do
56+
echo "Database not ready yet, waiting 5 seconds..."
57+
sleep 5
58+
done
59+
60+
echo "Database connection established!"
61+
62+
# Run database migrations
63+
echo "Running database migrations..."
64+
php artisan migrate --force --env=production
65+
66+
# Check if migrations were successful
67+
if [ $? -eq 0 ]; then
68+
echo "✅ Database migrations completed successfully!"
69+
else
70+
echo "❌ Database migrations failed!"
71+
exit 1
72+
fi
73+
74+
# Start supervisord
75+
echo "Starting supervisord..."
76+
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf

routes/web.php

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,14 @@
44
use Illuminate\Support\Facades\Auth;
55
use App\Blog\IO\Http\Controllers\PostController;
66
use App\Blog\IO\Http\Controllers\CategoryController;
7+
use App\Blog\IO\Http\Controllers\BlogController;
78

8-
/*
9-
|--------------------------------------------------------------------------
10-
| Web Routes
11-
|--------------------------------------------------------------------------
12-
|
13-
| Here is where you can register web routes for your application. These
14-
| routes are loaded by the RouteServiceProvider and all of them will
15-
| be assigned to the "web" middleware group. Make something great!
16-
|
17-
*/
18-
19-
Route::get('/health', function () {
20-
return response()->json(['status' => 'ok', 'timestamp' => now()]);
21-
});
22-
23-
Route::get('/', function () {
24-
return response()->json([
25-
'message' => 'Laravel Blog Application is running!',
26-
'status' => 'success',
27-
'timestamp' => now(),
28-
'environment' => config('app.env'),
29-
'debug' => config('app.debug')
30-
]);
31-
})->name('home');
32-
33-
// Simple blog routes without complex controllers for now
34-
Route::get('/blog', function () {
35-
return response()->json([
36-
'message' => 'Blog section - Coming soon!',
37-
'status' => 'success',
38-
'timestamp' => now()
39-
]);
40-
})->name('blog.index');
9+
Route::get('/', [BlogController::class, 'index'])->name('blog.index');
10+
Route::get('/blog', [BlogController::class, 'index'])->name('blog.home');
11+
Route::get('/blog/{slug}', [BlogController::class, 'show'])->name('blog.show');
4112

4213
Auth::routes();
4314

44-
// Admin routes (protected by auth middleware)
4515
Route::middleware('auth')->prefix('admin')->name('admin.')->group(function () {
4616
Route::get('/dashboard', function () {
4717
return response()->json([
@@ -51,11 +21,12 @@
5121
]);
5222
})->name('dashboard');
5323

54-
// Post management
5524
Route::resource('posts', PostController::class);
56-
57-
// Category management
5825
Route::resource('categories', CategoryController::class)->except(['show']);
5926
});
6027

61-
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home.controller');
28+
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
29+
30+
Route::get('/health', function () {
31+
return response()->json(['status' => 'ok', 'timestamp' => now()]);
32+
});

0 commit comments

Comments
 (0)