From 95f0d336f9d49e3bd58317a603882f903309097c Mon Sep 17 00:00:00 2001 From: Allan Kong Date: Mon, 18 Aug 2025 19:56:25 -0700 Subject: [PATCH 1/7] Envoy --- Envoy.blade.php | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ composer.json | 1 + composer.lock | 65 ++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 Envoy.blade.php diff --git a/Envoy.blade.php b/Envoy.blade.php new file mode 100644 index 00000000..2f136f42 --- /dev/null +++ b/Envoy.blade.php @@ -0,0 +1,64 @@ +@servers(['local' => ['127.0.0.1'], 'server' => ['root@143.198.129.111']]) + +@story('deploy', ['skipBackup' => false]) + prepare-frontend-locally + @if(!$skipBackup) + backup-database + @endif + update-code + install-dependencies + down + perform-migration + deploy-frontend + up +@endstory + +@task('down', ['on' => 'server']) + set -e + cd /var/www/ComputerScienceResources.com + php artisan down +@endtask + +@task('up', ['on' => 'server']) + set -e + cd /var/www/ComputerScienceResources.com + php artisan up +@endtask + +@task('backup-database', ['on' => 'server']) + set -e + cd /var/www/ComputerScienceResources.com + php artisan backup:run --only-db +@endtask + +@task('update-code', ['on' => 'server']) + set -e + cd /var/www/ComputerScienceResources.com + git pull origin master +@endtask + +@task('install-dependencies', ['on' => 'server']) + set -e + cd /var/www/ComputerScienceResources.com + composer install --no-dev --optimize-autoloader +@endtask + +@task('perform-migration', ['on' => 'server']) + set -e + cd /var/www/ComputerScienceResources.com + php artisan migrate --force +@endtask + +@task('prepare-frontend-locally', ['on' => 'local']) + set -e + echo "Building frontend locally..." + npm ci + npm run build + echo "Frontend build complete. Ready to deploy." +@endtask + +@task('deploy-frontend', ['on' => 'local']) + set -e + echo "Copying compiled assets to server..." + scp -r {{ __DIR__ }}/public/build root@143.198.129.111:/var/www/ComputerScienceResources.com/public +@endtask diff --git a/composer.json b/composer.json index 8c30a73d..33651e45 100644 --- a/composer.json +++ b/composer.json @@ -32,6 +32,7 @@ "barryvdh/laravel-ide-helper": "^3.5", "beyondcode/laravel-query-detector": "^2.0", "fakerphp/faker": "^1.23", + "laravel/envoy": "^2.10", "laravel/pail": "^1.1", "laravel/pint": "^1.24", "laravel/sail": "^1.40", diff --git a/composer.lock b/composer.lock index 91de3eea..ad8278e2 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": "0a34ae037978e458ee6daf51abd64db0", + "content-hash": "c493072e6134d3bec63f0128b71e6e66", "packages": [ { "name": "anourvalar/eloquent-serialize", @@ -10719,6 +10719,69 @@ }, "time": "2025-04-30T06:54:44+00:00" }, + { + "name": "laravel/envoy", + "version": "v2.10.2", + "source": { + "type": "git", + "url": "https://github.com/laravel/envoy.git", + "reference": "819a519e3d86b056c7aa3bd5d0801952a6fc14fd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/envoy/zipball/819a519e3d86b056c7aa3bd5d0801952a6fc14fd", + "reference": "819a519e3d86b056c7aa3bd5d0801952a6fc14fd", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.0|^7.0", + "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0", + "php": "^7.2|^8.0", + "symfony/console": "^4.3|^5.0|^6.0|^7.0", + "symfony/process": "^4.3|^5.0|^6.0|^7.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^8.0|^9.0|^10.4" + }, + "suggest": { + "ext-posix": "Required to determine the System user on Unix systems." + }, + "bin": [ + "bin/envoy" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Laravel\\Envoy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Elegant SSH tasks for PHP.", + "keywords": [ + "laravel", + "ssh" + ], + "support": { + "issues": "https://github.com/laravel/envoy/issues", + "source": "https://github.com/laravel/envoy/tree/v2.10.2" + }, + "time": "2025-01-28T15:47:18+00:00" + }, { "name": "laravel/pail", "version": "v1.2.1", From c9bd24a0f945c8f3be2fc847e0b087a158806fc4 Mon Sep 17 00:00:00 2001 From: Allan Kong Date: Thu, 21 Aug 2025 20:15:17 -0700 Subject: [PATCH 2/7] Envoy --- Envoy.blade.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Envoy.blade.php b/Envoy.blade.php index 2f136f42..6c59247b 100644 --- a/Envoy.blade.php +++ b/Envoy.blade.php @@ -1,5 +1,6 @@ @servers(['local' => ['127.0.0.1'], 'server' => ['root@143.198.129.111']]) +{{-- Add Caching, for production app --}} @story('deploy', ['skipBackup' => false]) prepare-frontend-locally @if(!$skipBackup) From 396a2d40631e6af31854ab4c4c788a7f4635f630 Mon Sep 17 00:00:00 2001 From: Allan Kong <74692833+AllanKoder@users.noreply.github.com> Date: Thu, 21 Aug 2025 20:27:54 -0700 Subject: [PATCH 3/7] Update Envoy.blade.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Envoy.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Envoy.blade.php b/Envoy.blade.php index 6c59247b..8376baa8 100644 --- a/Envoy.blade.php +++ b/Envoy.blade.php @@ -1,4 +1,4 @@ -@servers(['local' => ['127.0.0.1'], 'server' => ['root@143.198.129.111']]) +@servers(['local' => ['127.0.0.1'], 'server' => [getenv('DEPLOY_USER') . '@' . getenv('DEPLOY_HOST')]]) {{-- Add Caching, for production app --}} @story('deploy', ['skipBackup' => false]) From a9e3a63683e9ce1c8896538db9c683f4781d99c5 Mon Sep 17 00:00:00 2001 From: Allan Kong <74692833+AllanKoder@users.noreply.github.com> Date: Thu, 21 Aug 2025 20:28:16 -0700 Subject: [PATCH 4/7] Update Envoy.blade.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Envoy.blade.php | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/Envoy.blade.php b/Envoy.blade.php index 8376baa8..25a97c2f 100644 --- a/Envoy.blade.php +++ b/Envoy.blade.php @@ -46,7 +46,37 @@ @task('perform-migration', ['on' => 'server']) set -e - cd /var/www/ComputerScienceResources.com + cd {{ $DEPLOY_PATH }} + php artisan down +@endtask + +@task('up', ['on' => 'server']) + set -e + cd {{ $DEPLOY_PATH }} + php artisan up +@endtask + +@task('backup-database', ['on' => 'server']) + set -e + cd {{ $DEPLOY_PATH }} + php artisan backup:run --only-db +@endtask + +@task('update-code', ['on' => 'server']) + set -e + cd {{ $DEPLOY_PATH }} + git pull origin master +@endtask + +@task('install-dependencies', ['on' => 'server']) + set -e + cd {{ $DEPLOY_PATH }} + composer install --no-dev --optimize-autoloader +@endtask + +@task('perform-migration', ['on' => 'server']) + set -e + cd {{ $DEPLOY_PATH }} php artisan migrate --force @endtask From efab9b277f4a1d141d6eed31f4e8ee9a3e073926 Mon Sep 17 00:00:00 2001 From: Allan Kong Date: Sat, 23 Aug 2025 16:19:05 -0700 Subject: [PATCH 5/7] Mailgun --- .env.example | 4 + composer.json | 2 + composer.lock | 248 +++++++++++++++++++++++++++++++++++++++++++- config/app.php | 1 - config/mail.php | 4 + config/services.php | 6 ++ 6 files changed, 263 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index d9a1a7b8..b67083fa 100644 --- a/.env.example +++ b/.env.example @@ -71,5 +71,9 @@ B2_ENDPOINT= VITE_APP_NAME="${APP_NAME}" +DEPLOY_USER= +DEPLOY_HOST= +DEPLOY_PATH= + SAIL_XDEBUG_MODE=develop,debug,coverage SAIL_XDEBUG_CONFIG="discover_client_host=1 client_port=9003" diff --git a/composer.json b/composer.json index 33651e45..0fd4f140 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,8 @@ "spatie/laravel-activitylog": "^4.10", "spatie/laravel-backup": "^9.3", "spatie/laravel-tags": "^4.9", + "symfony/http-client": "^7.3", + "symfony/mailgun-mailer": "^7.3", "tightenco/ziggy": "^2.0", "yaza/laravel-google-drive-storage": "^4.1" }, diff --git a/composer.lock b/composer.lock index ad8278e2..ac42030a 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": "c493072e6134d3bec63f0128b71e6e66", + "content-hash": "e4dbfba9cfedc7e4d7d4745986019a8b", "packages": [ { "name": "anourvalar/eloquent-serialize", @@ -8039,6 +8039,183 @@ ], "time": "2025-03-31T08:49:55+00:00" }, + { + "name": "symfony/http-client", + "version": "v7.3.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client.git", + "reference": "1c064a0c67749923483216b081066642751cc2c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client/zipball/1c064a0c67749923483216b081066642751cc2c7", + "reference": "1c064a0c67749923483216b081066642751cc2c7", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "psr/log": "^1|^2|^3", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/http-client-contracts": "~3.4.4|^3.5.2", + "symfony/service-contracts": "^2.5|^3" + }, + "conflict": { + "amphp/amp": "<2.5", + "amphp/socket": "<1.1", + "php-http/discovery": "<1.15", + "symfony/http-foundation": "<6.4" + }, + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "1.0", + "symfony/http-client-implementation": "3.0" + }, + "require-dev": { + "amphp/http-client": "^4.2.1|^5.0", + "amphp/http-tunnel": "^1.0|^2.0", + "guzzlehttp/promises": "^1.4|^2.0", + "nyholm/psr7": "^1.0", + "php-http/httplug": "^1.0|^2.0", + "psr/http-client": "^1.0", + "symfony/amphp-http-client-meta": "^1.0|^2.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/messenger": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/rate-limiter": "^6.4|^7.0", + "symfony/stopwatch": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpClient\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", + "homepage": "https://symfony.com", + "keywords": [ + "http" + ], + "support": { + "source": "https://github.com/symfony/http-client/tree/v7.3.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-07-15T11:36:08+00:00" + }, + { + "name": "symfony/http-client-contracts", + "version": "v3.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client-contracts.git", + "reference": "75d7043853a42837e68111812f4d964b01e5101c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/75d7043853a42837e68111812f4d964b01e5101c", + "reference": "75d7043853a42837e68111812f4d964b01e5101c", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\HttpClient\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to HTTP clients", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/http-client-contracts/tree/v3.6.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-04-29T11:18:49+00:00" + }, { "name": "symfony/http-foundation", "version": "v7.3.1", @@ -8312,6 +8489,75 @@ ], "time": "2025-06-27T19:55:54+00:00" }, + { + "name": "symfony/mailgun-mailer", + "version": "v7.3.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/mailgun-mailer.git", + "reference": "8c18f2bff4e70ed5669ab8228302edd2fecd689b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/mailgun-mailer/zipball/8c18f2bff4e70ed5669ab8228302edd2fecd689b", + "reference": "8c18f2bff4e70ed5669ab8228302edd2fecd689b", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/mailer": "^7.2" + }, + "conflict": { + "symfony/http-foundation": "<6.4" + }, + "require-dev": { + "symfony/http-client": "^6.4|^7.0", + "symfony/webhook": "^6.4|^7.0" + }, + "type": "symfony-mailer-bridge", + "autoload": { + "psr-4": { + "Symfony\\Component\\Mailer\\Bridge\\Mailgun\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Mailgun Mailer Bridge", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/mailgun-mailer/tree/v7.3.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-06-20T16:15:52+00:00" + }, { "name": "symfony/mime", "version": "v7.3.0", diff --git a/config/app.php b/config/app.php index f4672673..a997d907 100644 --- a/config/app.php +++ b/config/app.php @@ -122,5 +122,4 @@ 'driver' => env('APP_MAINTENANCE_DRIVER', 'file'), 'store' => env('APP_MAINTENANCE_STORE', 'database'), ], - ]; diff --git a/config/mail.php b/config/mail.php index 756305b3..877703e5 100644 --- a/config/mail.php +++ b/config/mail.php @@ -49,6 +49,10 @@ 'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL', 'http://localhost'), PHP_URL_HOST)), ], + 'mailgun' => [ + 'transport' => 'mailgun' + ], + 'ses' => [ 'transport' => 'ses', ], diff --git a/config/services.php b/config/services.php index b3e31df0..aafa4b80 100644 --- a/config/services.php +++ b/config/services.php @@ -41,4 +41,10 @@ 'redirect' => '/oauth/github/callback', ], + 'mailgun' => [ + 'domain' => env('MAILGUN_DOMAIN'), + 'secret' => env('MAILGUN_SECRET'), + 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), + 'scheme' => 'https', + ], ]; From c0f6e2f6564a4d1335b27b29323e90862914c573 Mon Sep 17 00:00:00 2001 From: AllanKoder <74692833+AllanKoder@users.noreply.github.com> Date: Sat, 23 Aug 2025 23:19:36 +0000 Subject: [PATCH 6/7] Apply automatic changes --- config/mail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/mail.php b/config/mail.php index 877703e5..3edb2ee5 100644 --- a/config/mail.php +++ b/config/mail.php @@ -50,7 +50,7 @@ ], 'mailgun' => [ - 'transport' => 'mailgun' + 'transport' => 'mailgun', ], 'ses' => [ From 1de78f6bfb293d8517cf278de8449c7d781c9c62 Mon Sep 17 00:00:00 2001 From: Allan Kong Date: Sat, 23 Aug 2025 18:13:16 -0700 Subject: [PATCH 7/7] Favicon --- Envoy.blade.php | 42 +++-------------------------------- resources/views/app.blade.php | 4 ++++ 2 files changed, 7 insertions(+), 39 deletions(-) diff --git a/Envoy.blade.php b/Envoy.blade.php index 25a97c2f..fedad9ea 100644 --- a/Envoy.blade.php +++ b/Envoy.blade.php @@ -1,8 +1,6 @@ -@servers(['local' => ['127.0.0.1'], 'server' => [getenv('DEPLOY_USER') . '@' . getenv('DEPLOY_HOST')]]) +@servers(['local' => ['127.0.0.1'], 'server' => ['root@143.198.129.111']]) -{{-- Add Caching, for production app --}} @story('deploy', ['skipBackup' => false]) - prepare-frontend-locally @if(!$skipBackup) backup-database @endif @@ -46,50 +44,16 @@ @task('perform-migration', ['on' => 'server']) set -e - cd {{ $DEPLOY_PATH }} - php artisan down -@endtask - -@task('up', ['on' => 'server']) - set -e - cd {{ $DEPLOY_PATH }} - php artisan up -@endtask - -@task('backup-database', ['on' => 'server']) - set -e - cd {{ $DEPLOY_PATH }} - php artisan backup:run --only-db -@endtask - -@task('update-code', ['on' => 'server']) - set -e - cd {{ $DEPLOY_PATH }} - git pull origin master -@endtask - -@task('install-dependencies', ['on' => 'server']) - set -e - cd {{ $DEPLOY_PATH }} - composer install --no-dev --optimize-autoloader -@endtask - -@task('perform-migration', ['on' => 'server']) - set -e - cd {{ $DEPLOY_PATH }} + cd /var/www/ComputerScienceResources.com php artisan migrate --force @endtask -@task('prepare-frontend-locally', ['on' => 'local']) +@task('deploy-frontend', ['on' => 'local']) set -e echo "Building frontend locally..." npm ci npm run build - echo "Frontend build complete. Ready to deploy." -@endtask -@task('deploy-frontend', ['on' => 'local']) - set -e echo "Copying compiled assets to server..." scp -r {{ __DIR__ }}/public/build root@143.198.129.111:/var/www/ComputerScienceResources.com/public @endtask diff --git a/resources/views/app.blade.php b/resources/views/app.blade.php index 334627a3..45049f72 100644 --- a/resources/views/app.blade.php +++ b/resources/views/app.blade.php @@ -4,6 +4,10 @@ + + + + {{ config('app.name', 'Laravel') }}