docs icon indicating copy to clipboard operation
docs copied to clipboard

Initial page for setting Vite Secrets for Laravel apps

Open KTanAug21 opened this issue 1 year ago • 1 comments

Summary of changes

Create a page in the Laravel section of Fly.io docs to include a page that explains the steps needed in setting Vite environment variable!

Preview

-none please

Related Fly.io community and GitHub links

https://community.fly.io/t/how-to-setup-websocket-with-pusher-and-laravel-echo-on-deployment/19767

Notes

.env files are not included during deployment of Laravel apps in Fly.io. But since Vite reads environment variables from .env files, we need to create a temporary .env.production file in the Dockerfile's asset bundling stage using build secrets during running of fly deploy. This way, an appropriate .env file is present before building the assets and allow reading of the env variables.

This answers the issue raised by a community member here!

KTanAug21 avatar May 12 '24 19:05 KTanAug21

ALSO! This is a missing part of the docs above!

Since we need this .env.production file during build time, make sure that it's not excluded during build. Revise .dockerignore to remove that specific file exclusion:

/* .dockerignore */

// Please still exclude other .env files
.env
.env.backup

// We just need to remove the .env.production from exclusion
- .env.production

KTanAug21 avatar Sep 08 '24 11:09 KTanAug21