Last active
February 1, 2016 09:39
-
-
Save dzuelke/f6d28d42879bf3bb536a to your computer and use it in GitHub Desktop.
Deploying Symfony CMF to Heroku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone https://github.com/symfony-cmf/cmf-sandbox.git | |
cd cmf-sandbox | |
composer install | |
# declare optional extensions as required | |
php -dmemory_limit=4G $(which composer) require "ext-gd:*" "ext-exif:*" | |
git add composer.json composer.lock | |
git commit -m "require gd and exif extensions" | |
# add DATABASE_URL mapping to composer.json and update DB config (see database.diff) | |
php -dmemory_limit=4G $(which composer) update --lock | |
git add composer.json composer.lock app/config/config.yml app/config/config_prod.yml | |
git commit -m "map DATABASE_URL" | |
# log to php://stderr in config_prod.yml (see logging.diff) | |
git add app/config/config_prod.yml | |
git commit -m "log to stderr in prod" | |
# this config needs to be in the repo | |
cp app/config/phpcr_doctrine_dbal.yml.dist app/config/phpcr.yml | |
sed -i '' '/phpcr.yml/d' .gitignore | |
git add app/config/phpcr.yml .gitignore | |
git commit -m "PHPCR config" | |
# Procfile | |
echo 'web: $(composer config bin-dir)/heroku-php-apache2 web/' > Procfile | |
git add Procfile | |
git commit -m "Heroku Procfile" | |
# deploy | |
heroku create | |
heroku config:set SYMFONY_ENV=prod | |
heroku addons:create heroku-postgresql | |
git push heroku master | |
# init DB | |
heroku run "php app/console doctrine:phpcr:init:dbal --force" | |
heroku run "php app/console doctrine:phpcr:workspace:create default" | |
heroku run "php app/console doctrine:phpcr:repository:init" | |
heroku run "php app/console -v -n doctrine:phpcr:fixtures:load" | |
# done | |
heroku open |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/config/config.yml b/app/config/config.yml | |
index 3075825..0685fda 100644 | |
--- a/app/config/config.yml | |
+++ b/app/config/config.yml | |
@@ -55,13 +55,6 @@ swiftmailer: | |
# for jackalope-doctrine-dbal | |
doctrine: | |
dbal: | |
- driver: '%database_driver%' | |
- host: '%database_host%' | |
- port: '%database_port%' | |
- dbname: '%database_name%' | |
- user: '%database_user%' | |
- password: '%database_password%' | |
- path: '%database_path%' | |
charset: UTF8 | |
# cmf configuration | |
diff --git a/app/config/config_prod.yml b/app/config/config_prod.yml | |
index aa51fbf..b704da2 100644 | |
--- a/app/config/config_prod.yml | |
+++ b/app/config/config_prod.yml | |
@@ -17,3 +17,7 @@ monolog: | |
type: stream | |
path: '%kernel.logs_dir%/%kernel.environment%.log' | |
level: debug | |
+ | |
+doctrine: | |
+ dbal: | |
+ url: '%database_url%' | |
diff --git a/composer.json b/composer.json | |
index 0d880da..07a3ba8 100644 | |
--- a/composer.json | |
+++ b/composer.json | |
@@ -91,7 +91,9 @@ | |
"incenteev-parameters": [ | |
{ | |
"file": "app/config/parameters.yml", | |
- "env-map": {} | |
+ "env-map": { | |
+ "database_url": "DATABASE_URL" | |
+ } | |
}, | |
{ | |
"file": "app/config/phpcr.yml", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/config/config_prod.yml b/app/config/config_prod.yml | |
index b704da2..755cff9 100644 | |
--- a/app/config/config_prod.yml | |
+++ b/app/config/config_prod.yml | |
@@ -15,7 +15,7 @@ monolog: | |
handler: nested | |
nested: | |
type: stream | |
- path: '%kernel.logs_dir%/%kernel.environment%.log' | |
+ path: 'php://stderr' | |
level: debug | |
doctrine: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment