Fix DATABASE_URL environment loading in VPS deployment script#28
Draft
Copilot wants to merge 3 commits intosalman_14_08_25from
Draft
Fix DATABASE_URL environment loading in VPS deployment script#28Copilot wants to merge 3 commits intosalman_14_08_25from
Copilot wants to merge 3 commits intosalman_14_08_25from
Conversation
Co-authored-by: syed-reza98 <71028588+syed-reza98@users.noreply.github.com>
Co-authored-by: syed-reza98 <71028588+syed-reza98@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Prisma schema loaded from prisma/schema.prisma
Fix DATABASE_URL environment loading in VPS deployment script
Aug 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The VPS deployment was failing with a Prisma schema validation error because the
DATABASE_URLenvironment variable was not found during deployment. The error occurred when runningnpx prisma generateandnpx prisma db pushcommands:Root Cause
The
scripts/vps/deploy.shscript was executing Prisma commands without loading the.env.localfile that contains the required environment variables. The GitHub workflow creates this file with the correct MySQL connection string:DATABASE_URL="mysql://wedding_user:W3dd1ng@ArvinIncia2025!@localhost:3306/wedding_db"However, the deploy script wasn't reading this file before running the database migration commands.
Solution
Modified the deployment script to:
.env.localif it exists before running any commandsexport $(grep -v '^#' .env.local | grep -v '^$' | xargs)evalinstead ofbash -lcto preserve environment variables in the current shellChanges
scripts/vps/deploy.shwith environment loading logicTesting
The fix has been thoroughly tested with simulated deployment scenarios, confirming that:
.env.localDATABASE_URLvariableFixes #27.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.