Back
Question
We're a group of makers shipping together. We help each other stay accountable and reach our goals.
Apply for accessGo to Homepage | g h |
Go to Done Todos | g d |
Go to Questions | g q |
Compose a New Todo | n |
Go to Search | / |
Show this dialog | ? |
👋 Join WIP to participate
direnv
Is the direnv used for development envrionments on laptop? or also for production environments on linux VPS servers?
Another vote for direnv 👆only in development though - on production I usually use a PaaS (Heroku, Netlify etc).
Not sure you meant by "managing creds", I'm looking at storing codebase specific env variables for production on github secrets at the repo level.
Then somehow use github actions to deploy and re-create the .env file for production environments
UPDATE:
I wrote up of my current approach as a SO answer to my own question.
Reproduced below:
I realized I should have fleshed out the whole target scenario more explicitly in terms of hard requirements.
Must use:
Must see:
main
branchI discover 2 general approaches.
Outline:
1. checkout action then rsync to update codebase
2. create-envfile then rsync
This approach uses mixture of GitHub Actions. Namely, checkout and create-envfile
This approach uses 1 GitHub Action but it needs more bash scripting
I chose approach 2 because
git clone
is superior to rsync.This is my
ci.yml
As for how to save the secrets to your GitHub repo for SSH access, please check this article
Note: the cloudflare was overzealous in hiding the repo and branch name which uses the
@
symbol. So best to go read the SO answer to see the full responseThank you for sharing KimSia :)
I guess this is particular to my setup, but since I'm using vercel on the front end for nextjs I just do it on their website. This is great if your website is all static.
server side I usually just use an ec2 instance. On there I usually use systemd unit file to run my server. In the unit file I put all my env. variables. But in code I just use dotenv github.com/motdotla/dotenv
we use github.com/GoogleCloudPlatfor…
django-environ: github.com/joke2k/django-envi…
Django Environ is fabulous in production. We can place the .env file anywhere. And no other setup is needed. The env file is picked by Django through
settings.py
.There is also pypi.org/project/python-envir…. This can be helpful if you have a Python project but not Django specific.
thanks for providing both django and python specific