This is a Demo application related to the talk AWS Elastic Beanstalk & Docker for Rails developers
>>>>Talk Video<<<<
Pre-built application (puppies app) Docker images:
- https://hub.docker.com/r/equivalent/eb-demo-rails/
- https://hub.docker.com/r/equivalent/eb-demo-nginx/
Clone this repo and cd
into it:
$ git clone [email protected]:equivalent/docker_rails_aws_elasticbeanstalk_demmo_app.git
$ cd docker_rails_aws_elasticbeanstalk_demmo_app
Once the application is running and is successfully connected to DB be sure to
run rake db:seed
inside the container. You can leart out how to run commands
inside Docker container here.
Production version of docker-compose.yml
is located in the root folder of
this git repo.
to run in production mode, all you need to do:
- install Docker and docker-compose
$ docker-compose up
or$ sudo docker-compose up
docker-compose -f docker-compose-development.yml up
Elastic Beanstalk's Dockerrun.aws.json
is located in ./aws_elastic_beanstalk
.
In that folder is separate README.md file containing useful information on AWS Elastic Beanstalk CLI
Step 1: Configure new Docker based AWS Beanstalk Enviroment, PostgreSQL RDS, Redis Elastic Cache and ensure the Security Groups are set in a way that endpoints can communicate to each other. In order to achieve this you can follow steps in this article: http://www.eq8.eu/blogs/34-set-up-aws-elastic-beanstalk
Step 2:: Once in the configured EB environment, from web interface Click "Upload" and chose
./aws_elastic_beanstalk/Dockerrun.aws.json
.
Step 2:: Install and configure EB CLI. You can find my instructions on EB CLI here
Step 3: $ cd ./aws_elastic_beanstalk
and $ eb deploy
Nginx image source code located in ./nginx
folder.
From host machine you can lunch:
bash docker/puppiesbash.sh # enter bash in the puppies_web container
bash docker/puppiesconsole.sh # enter rails console in the puppies_web container
bash docker/puppiespry.sh # pry debugger - where you introduce `binding.pry`
bash docker/nginxbash.sh # enter bash in the proxy container
Or manually type:
docker ps
docker exec -it xxIdOfAContainerxx bash
docker-compose build
docker-compose push
mkdir docker_rails_aws_elasticbeanstalk_demo_app
cd docker_rails_aws_elasticbeanstalk_demo_app
gem install bundler rails
rails new puppies --skip-test --skip-action-mailer
rake db:create
rake db:seed