1) Can someone confirm that the instructions here https://docs.nhost.io/platform/environment-variables to redeploy are required: "When an Environment Variable is changed, you must deploy your project again using the GitHub integration for the changes to take effect." If needed, is there a "redeploy" option/button without making an unneeded code change via GH? Yesterday I felt like it was _not_ needed - I'd change an ENV value and a few minutes later I think I'd see in the logs a NHost servers restart. But it's actually quite difficult to tell - there's not actually a line that says 'Restarting' nor one that says 'Server up'. Just now I made a change and the change definitely did NOT take as far as I can tell - I added my own logging in a Function of the ENV values at startup. And opening and saving the Dashboard's > Settings > Env value didn't cause the same type of restart. Suggestions needed! 2) I'm curious about the `.env.development` file. First, does `.env.development` have any effect on the live project if it's included in the GH repo? I believe it _doesn't_ but looking for confirmation. Second, isn't it generally the case that the .env files should _not_ be added to git? Esp if they contain secrets - and typically people do add them here. Yes, it's local secrets but that shouldn't be assumed. So I'm wondering whether the code here should include `.env.development` in `.gitignore` by default since CLI writes the initial file. https://github.com/nhost/cli/blob/a23f8ceebf2d87f932559d4bce0570fe59da68d3/cmd/init.go#L223
Last active 4 months ago
26 replies
20 views
- PK
1) Can someone confirm that the instructions here https://docs.nhost.io/platform/environment-variables to redeploy are required: "When an Environment Variable is changed, you must deploy your project again using the GitHub integration for the changes to take effect."
If needed, is there a "redeploy" option/button without making an unneeded code change via GH?
Yesterday I felt like it was not needed - I'd change an ENV value and a few minutes later I think I'd see in the logs a NHost servers restart. But it's actually quite difficult to tell - there's not actually a line that says 'Restarting' nor one that says 'Server up'.
Just now I made a change and the change definitely did NOT take as far as I can tell - I added my own logging in a Function of the ENV values at startup. And opening and saving the Dashboard's > Settings > Env value didn't cause the same type of restart.
Suggestions needed!
2) I'm curious about the
.env.development
file.First, does
.env.development
have any effect on the live project if it's included in the GH repo? I believe it doesn't but looking for confirmation.Second, isn't it generally the case that the .env files should not be added to git? Esp if they contain secrets - and typically people do add them here. Yes, it's local secrets but that shouldn't be assumed.
So I'm wondering whether the code here should include
.env.development
in.gitignore
by default since CLI writes the initial file.https://github.com/nhost/cli/blob/a23f8ceebf2d87f932559d4bce0570fe59da68d3/cmd/init.go#L223
- PK
Ok, this time the restart took a bit longer - or the new logger was delayed - but I did see the services restart.
- PK
BUT! The Env value change I made via the Dashboard was not in evidence, it's using the previous value.
- PK
I've just tried following the instruction in the docs, committing a change to a markup file in order get the project to reload and that worked.
- PK
Summary observations on my point 1) above:
- it seems as though changing an env value through the dashboard causes a restart but the restart doesn't include the value.
- it seems like a deploy of even the tiniest change causes a restart but the project then does include the new dashboard env value.
- even though deployment shows the new deploy, the new logs tool does not include any info on this latest restart. That's weird. Yet checking the console logs on my test Function does show the new env value I expected.
- PK
Point 2) about .env.development and .gitignore shouldn't be in this thread, will repost π
- PK
Any thoughts on projects picking up changes from editing env values via Dashboard?
- EL
Changing env vars should not cause projects to restart
- EL
When you make a deployment we'll deploy your functions and use the latest env vars for your project.
- EL
I just tested and it worked as expected. New env vars are working in my serverless functions after a redeployment.
- EL
Does it not work for you? Would you mind adding a description of how to reproduce?
- PK
Env changes work after redeployment.
Env changes do not work after changing in Dashboard.
But - app does restart (without env changes) after Dashboard env changes - according to what I see in logs. Though as mentioned above, its not that clear in logs what is actually happening but it looks like a series of service restarts. - PK
The restart is delayed by some minutes, so it could be a regular recycle??
- EL
> app does restart (without env changes) after Dashboard env changes
I don't understand what you mean here - PK
I'm seeing what looks like an app restart despite what you say above: "Changing env vars should not cause projects to restart"
- PK
It's likely I'm wrong because it's hard to tell, could just be instances spinning up but since it's on our Staging project I felt like was the only person driving requests to that server.
- PK
Again, my purpose - after a while of making ENV changes and nothing happening in the app - was to confirm a single line of text in the ENV docs that I really needed to do a noop deployment to get the app to restart.
- EL
Checking now, you might be right that env vars are being applied to all services except serverless functions directly. I see something in our backend indicating that. Maybe @mention can clarify on Monday or if he has time during the weekend.
- EL
But I'm 99% sure that env vars are not automatically updated for serverless functions. For that, you need to redeploy.
- PK
That matches what I experienced multiple instances of (seemingly) all services restarted e.g. this is in the logs:
2022-11-11 08:45:54 hasura-auth > node ./dist/start.js
each time I changed an ENV value. - PK
But you're saying that Functions are treated differently (similar to how logs doesn't list Functions as a source and Functions have their own logging)
- EL
yes
- PK
Then here's another Docs change for the 'crazy commit' you're busy with π
https://docs.nhost.io/platform/environment-variables
Doesn't call out that Functions vs other services are different.
- PK
Definitely wasn't expecting to since services were restarting.
- EL
Yea, I'll double check everything on Monday and update accordingly. Nice catch!
- EL
Need to update the image of the dashboard for that page too
Last active 4 months ago
26 replies
20 views