Reputation: 804
I'm considering migration for custom hosted Rails app to Elastic Beanstalk.
I've create a simple Rails app and manage to deploy it to on Elastic beanstalk. There are still a few thing I still didn't manage to get:
Amazon have this document (link) but it seems to be deprecated and I can't figure how to do it on current version
elad:...$ eb --version
EB CLI 3.7 (Python 2.7.1)
Upvotes: 3
Views: 2309
Reputation: 18953
Someone considering their options could take a look at AWS Code Pipeline. You define the specific GitHub repo branch. If you push a change to that branch, Code Pipeline detects it and starts a pipeline process.
This is relevant to Elastic Beanstalk because on Step 4 of Code Pipeline, you can deploy to AWS Elastic Beanstalk (among others).
Upvotes: 0
Reputation: 6692
I'm not sure my solution is the best practices or not, I just show here, welcome all comments on this.
- How can I deploy a branch or a specific code to my app?
- Is the deployed version is from last commit or my current workspace?
3.What are the best practices when handling deployment on Beanstalk?
My solution #1: Define which branch will be deployed to a specific environment
In .elasticbeanstalk/config.yml
# .....
branch-defaults:
develop:
environment: mercury-dev-staging
master:
environment: mercury-dev
# .....
Relying on this config, I always switch to develop
branch to deploy to mercury-dev-staging
env, and master
one for mercury-dev
. This will avoid some mistakes like deploying develop
branch to production env
My solution #2: Define some alias commands for quick deployment:
In ~/.bash_profile
(I'm using MacOS)
alias deploy_production="eb deploy mercury-dev;"
alias deploy_staging="eb deploy mercury-dev-staging;"
Now I just type deploy_staging
for staging deployment, this is convenient but risky, because you may deploy your developing feature to production.
Upvotes: 2