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/Envoy.blade.php b/Envoy.blade.php new file mode 100644 index 00000000..fedad9ea --- /dev/null +++ b/Envoy.blade.php @@ -0,0 +1,59 @@ +@servers(['local' => ['127.0.0.1'], 'server' => ['root@143.198.129.111']]) + +@story('deploy', ['skipBackup' => false]) + @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('deploy-frontend', ['on' => 'local']) + set -e + echo "Building frontend locally..." + npm ci + npm run build + + 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..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" }, @@ -32,6 +34,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..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": "0a34ae037978e458ee6daf51abd64db0", + "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", @@ -10719,6 +10965,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", 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..3edb2ee5 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', + ], ]; 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 @@ + + + +