Skip to content

Initial page for setting Vite Secrets for Laravel apps #1521

Open
KTanAug21 wants to merge 2 commits into
mainfrom
create_laravel_vite_secrets_setup_page
Open

Initial page for setting Vite Secrets for Laravel apps #1521
KTanAug21 wants to merge 2 commits into
mainfrom
create_laravel_vite_secrets_setup_page

Conversation

@KTanAug21

Copy link
Copy Markdown
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!

@hmshwt hmshwt left a comment

Copy link
Copy Markdown

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
Copy Markdown
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

@kcmartin

kcmartin commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for this, and apologies that it sat so long! Doing some PR triage and this one still fills a real gap (Vite env vars are a recurring community question), so we're not closing it. Before it can merge it needs the .dockerignore step from your follow-up comment folded in, the typo fix from review, and we'd want to drop VITE_PUSHER_APP_SECRET from the examples since VITE_-prefixed vars get bundled into public client JS. We'll follow up once we've decided whether to update this branch or rework the page.

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.

4 participants