47
loading...
This website collects cookies to deliver better user experience
php artisan route:cache
, php artisan queue:restart
and similar. In case you didn't know, you configure your environments in a file called "vapor.yml" which you will see after you install vapor.id: 00000
name: treblle
environments:
production:
memory: 1024
cli-memory: 512
warm: 5
gateway-version: 2
runtime: 'php-8.0:al2'
domain: treblle.com
database: prod-db
cache: prod-cache
queues:
- 'ProdLogs.fifo'
build:
- 'COMPOSER_MIRROR_PATH_REPOS=1 composer install --no-dev'
- 'npm ci && npm run production && rm -rf node_modules'
- 'php artisan route:cache'
- 'php artisan view:cache'
deploy:
- 'php artisan migrate --force'
- 'php artisan queue:restart'
vapor deploy production
what happens in the background is magic. Vapor first compiles the entire code on your computer, everything from node and composer packages to building CSS and JS assets. After that it will create (or update) all the resources you defined under database, cache, domain using a bunch of AWS APIs. Finally it will upload a ZIP file with all of the code to AWS S3 which will then get deployed to AWS Lambda. Sounds complicated. And it is. But imagine having to do this without Vapor! Now there are two ways you can affect this process and that is by using "build" or "deploy" hooks which are defined in the YAML file. Laravel will call those at given stages of the deployment. It's also very important to place them at the correct stage otherwise they won't work.php artisan config:cache
isn't included in any of the stages. That is because it's done for you automatically by Vapor. So your config is cached so you don't have to worry about it.$gateway = new ApiGatewayClient([
'version' => 'latest',
'region' => config('services.aws.region),
'credentials' => new Credentials(
config('services.aws.key'),
config('services.aws.secret')
)
]);
$gateway = new ApiGatewayClient([
'version' => 'latest',
'region' => config('services.aws.region'),
'credentials' => CredentialProvider::env()
]);
d2yzzcow4k19m2.cloudfront.net/c3fb4469-ddda-416d-ad41-5bc4116f5462/css/app.min.css?id=5733d15ea60112431152
assets.treblle.com/css/app.min.css
but it turns out it's a big no no. The reason for that, as Mohamed said, is the dynamic UUID part in that URL that gets appended during the deployment process. Only Vapor knows what that UUID is and there is no option to define a custom subdomain. This is something I would like to see added at one point in time.