After getting help from Herokai, David Zuelke, I decided to create a how-to on the subject of "Creating Yii2 App in Cloud9 → Pushing to Github → Deploying to Heroku". Please see below:
- Create Yii2 “basic” app:
290795 $ composer create-project --prefer-dist yiisoft/yii2-app-basic basic
- Move into “basic” directory
290795 $ cd basic/
- Initialize local repo for “basic” directory
basic $ git init
- Add and commit Yii project
basic $ git add .
basic $ git commit -m "basic Yii project"
- Add procfile that will point to index.php (entry script) in “web” directory
basic $ echo "web: vendor/bin/heroku-php-apache2 web/" > Procfile
basic $ git add Procfile
basic $ git commit -m "Procfile for Heroku"
- Comment out debugging stuff (I do this manually instead of from command line)
basic $ vim web/index.php # remove dev/debug env stuff (not my way)
basic $ git add web/index.php
basic $ git commit -m "remove dev/debug env"
- This updates the dependency from v1.0.3 to v1.1 (absolute necessity)
basic $ composer require fxp/composer-asset-plugin
basic $ git add composer.json composer.lock
basic $ git commit -m "use fxp/composer-asset-plugin in project"
Create Heroku app and push to it. (I instead create and push to Github repo)
basic $ heroku create
basic $ git push heroku master (again I push to Github Repo synced with Heroku)
- Add logging to Heroku for Yii app (no logging for Yii out of the box)
basic $ echo "web: vendor/bin/heroku-php-apache2 -l runtime/logs/app.log web/" > Procfile
basic $ git add Procfile
basic $ git commit -m "tail runtime/logs/app.log"
basic $ git push heroku master (again I push to Github Repo synced with Heroku)
- This allows the “Contact” page to work (not sure why)
basic $ composer require ext-gd:* --ignore-platform-reqs
basic $ git add composer.json composer.lock
basic $ git commit -m "require GD for contact CAPTCHA"
basic $ git push heroku master (again I push to Github Repo synced with Heroku)