Reputation: 49
I need to do the following
Change environment variables according to the published env. Set Set up cron jobs according to the dev. I I would like to run just 1 command line "eb deploy dev" or something similar.
Upvotes: 4
Views: 2760
Reputation: 49
This is my solution to the problem, it took some time to setup but now i can do all the changes with 1 command line.
Make your own folder with all the files for all the environments. In .ebextensions folder setup empty config files for eb. npm runs a script named "deploy.js" together with the flag of the specific env. The script will do the following
So now i can tun npm run deploy:dev and everything runs
Upvotes: 0
Reputation: 324
setenv
You can set environment variables with setenv
. These will then be remembered for that environment.
More details: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-setenv.html
For example, suppose you have created an EB environment called 'staging' and you want to set the variable DB
to 'localhost', you can use:
eb setenv DB=localhost -e staging
Now that you have a different environment variables, you can check them in a script etc. to decide if the cron should be set up.
Note that the crons may not actually have access to your environment variables so you need to set those again for the cron while setting up the cron.
Upvotes: 1