Open dragoonis opened 4 years ago
/cc @Sekhar-Kutikuppala
/cc @chadhayton
/cc @jsheld
I'm sorry for the spam guys. I have a deadline due tomorrow, and this is blocking me.
@chadhayton @jsheld @Sekhar-Kutikuppala
What I'm saying is, is this already a feature of EB AL2? Having hooks run on specific environments? (prod only), or not.
If it is a feature can you just link me to your docs.
If it's not, what are your opinions on adding it?
@dragoonis you can use the environment variables for this, see https://aws.amazon.com/premiumsupport/knowledge-center/elastic-beanstalk-pass-variables/
for example set APP_ENV=production
on EB of production server and APP_ENV=staging
for staging server. then your bash script can use it to determine the deployment tasks
i see you are using EB Amazon Linux 2, not sure which platform you're using but in the case of PHP 7.4, my suggestion above won't work straight forward as the ENV variables are not set in the shell and only set in PHP-FPM, see: https://github.com/aws/elastic-beanstalk-roadmap/issues/72
Same here! I want to run different shell scripts, depending on the environment is currently performing the deploy. I have a workaround that uses get-config:
#!/bin/bash
EB_ENV=$(/opt/elasticbeanstalk/bin/get-config environment -k APP_ENV)
case "$EB_ENV" in
app-pp) SYMFONY_ENV=preproduction ;;
app-production) SYMFONY_ENV=prod ;;
*) SYMFONY_ENV=dev ;;
esac
But that just doesn't feel right.
I have hooks in
.platform/hooks/postdeploy/xxxx.sh
This application is being deployed on staging and production.I was some hooks to deploy on prod, and others to deploy on staging.
How can I have sets of hooks run, based on the environment name?