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

Add Heroku helper scripts #23

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

Add Heroku helper scripts #23

wants to merge 4 commits into from

Conversation

whusterj
Copy link
Member

@whusterj whusterj commented Nov 9, 2024

What This Does

Adds some scripts that help accelerate Heroku setup.

These were already mostly written up in tn-gists, but this should help make them more accessible.

To Do

  • Add script for pipeline creation and config
  • Add script(s) for staging and production app creation and config
  • Add script for setting env vars on an app
  • How to handle ALLOWED_HOSTS?
  • Add nodejs and Python buildpacks
  • Add heroku config:set NPM_CONFIG_PRODUCTION=false so devDependencies are installed and the NodeJS build will succeed.

else
env_file="{{env_file}}"
fi
Copy link
Member Author

@whusterj whusterj Nov 9, 2024

Choose a reason for hiding this comment

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

It's verbose, but I think I might like this as a standard pattern for tn-cli scripts. Here this recipe allows you to EITHER pass in your variables from the command line — in this case env_var and app_name — OR pass nothing and the script will prompt you for what it needs.

This could help with the documentation issue @oudeismetis brought up in #16. Because the prompts within the script can give users more context on what each variable means.

@whusterj whusterj self-assigned this Nov 9, 2024
function set_env() {
echo "Setting env vars from $env_file..."
[ -f "$env_file" ] && grep -vE '^(\s*$|#|DB_|REDIS_|ENVIRONMENT)' "$env_file" | tr '\n' ' ' | xargs heroku config:set -a $app_name || echo "Env file $env_file is not present, unable to set vars."
Copy link
Member Author

@whusterj whusterj Nov 9, 2024

Choose a reason for hiding this comment

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

This departs from the tn-gist version by also protecting against overwriting the ENVIRONMENT variable on the app, which is set when the app is created.

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

Successfully merging this pull request may close these issues.

1 participant