How to auto deploy test-green docker base symfony application to the Elastic Beanstalk
Presentation Slides
http://www.slideshare.net/redpilot/auto-deploy-symfony-app-with-codeship-and-elastic-beanstalk
- be sure that you install docker and docker-compose
- clone the project
- get in project folder
- stop your local web server if any as our app takes the 80 port
- build the containers
docker-compose build
- run the containers
docker-compose up -d
- check that's containers up
docker-compose ps
- install symfony vendors
docker exec -ti symfony_app composer install
- open browser
http:/localhost/app_dev.php
you should standard Symfony CAMP UA welcome screen - finally setup your own repository to push code back to the github.com for later auto deploy
- I suppose you already have codeship.com account
- connect your github.com account with codeship.com, then choose your version of this repo
- configure project setup commands
# <- this is a comment and won't be executed
# Feel free to delete all the comments and type in your own commands
# Each line is treated like a command that you execute in a local shell.
# i.e.: rvm use 2.2.2
# i.e.: bundle install
# Set Environment Vars for Symfony test
export SYMFONY_ENV=test
export SYMFONY__TEST_DATABASE_USER=$MYSQL_USER
export SYMFONY__TEST_DATABASE_PASSWORD=$MYSQL_PASSWORD
export SYMFONY__TEST_DATABASE_NAME=test
# Copy the parameters.yml.dist
cp app/config/parameters.yml.dist app/config/parameters.yml
# Install dependencies through Composer
composer install --prefer-source --no-interaction
# Clear Cache
php ./bin/console --env=test cache:clear
- configure tests run commands
# <- this is a comment and won't be executed
# Feel free to delete all the comments and type in your own commands
# Each line is treated like a command that you execute in a local shell.
# i.e.: rvm use 2.2.2
# i.e.: bundle install
phpunit -c ./
- push any changes in current README.md file to your repo, just for initiate CI tests run
- finally you should get successful application setup screen
- at the top of screen you find the your new app url like http://default-environment.q45ve7ct8n.eu-central-1.elasticbeanstalk.com/
- setup Elastic Beanstalk eb CLI command, follow the official manual http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html
- check that alright
eb --version
- init your project
eb init
- going back to the http://codeship.com -> project settings, then choose deployment section
- that's all, just make another changes in README.md file, then push to the master
- waiting until the test a green, then follow the magic of codeship.com deploy to the elastic beanstalk app
- open url of you elastic beanstalk app like http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html
- voila!
- for any questions create an issue
- all what you can find at this repo shared under the MIT License