Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial page for setting Vite Secrets for Laravel apps #1521

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

KTanAug21
Copy link
Contributor

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!

Copy link

@hmshwt hmshwt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your instead of You're

@KTanAug21
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants