A basic pipeline that integrates Docker, CircleCI and Heroku in a PHP project for Continuous Integration and Continuous Deployment.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
-
An account on CircleCI created using your GitHub profile.
-
An account on Heroku.
-
Docker and Docker Compose installed on your system.
sudo apt-get install docker.io docker-compose
Fork and clone this repository.
php-template directory contains:
srcis the folder where you will write your PHP source code files.databaseis the folder where you save your mysql database dump. Create a database dump of your project using mysqldump and save it here asdb.sql.testsis the folder where your test files using PHPUnit are stored. Tests are explained in a later stage.
- Create a new project
- Go to account settings and copy your API Key
- Add
ClearDB MySQLby clickingConfigure Add-onson your project's overview page.
- Add and set up this forked project and click on
Start Building. Here the build will fail, but continue to step 2. - Go to this project's settings and navigate to environment variables section to add the following three environment variables.
NAME: HEROKU_API_KEY
VALUE: the key that you copied from heroku
NAME: HEROKU_APP_NAME
VALUE: your project name on heroku
NAME: HEROKU_USERNAME
VALUE: email id used to login for heroku
- Rebuild the project. The build should now be fixed.
We use PHPUnit 7.0 for unit testing.
This project contains sampleEmail.php in src directory and corresponding EmailTest.php in tests directory.
Place your unit tests (in line with PHPUnit) corresponding to source code files in tests directory.
Open your app's Heroku Dashboard to find your PHP project deployed. Visit https://<your-app-name>.herokuapp.com/ to see your website.
- Dalton Fury - - Dalton Fury