-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Use dynamic env params for critical settings and restore Heroku deploys #399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ public function registerBundles() | |
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), | ||
new CodeExplorerBundle\CodeExplorerBundle(), | ||
new AppBundle\AppBundle(), | ||
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), // used for initial population of non-SQLite databases in production envs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it makes sense in a "real" application, might make sense as a demo app though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes and no. Even a real application, when first deployed somewhere, may need e.g. an initial user inserted into the database ;) |
||
// uncomment the following line if your application sends emails | ||
// new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), | ||
]; | ||
|
@@ -34,7 +35,6 @@ public function registerBundles() | |
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); | ||
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); | ||
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); | ||
$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(); | ||
} | ||
|
||
return $bundles; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ framework: | |
# http://symfony.com/doc/current/book/http_cache.html#edge-side-includes | ||
esi: { enabled: true } | ||
translator: { fallback: "%locale%" } | ||
secret: "%secret%" | ||
secret: "%env(SYMFONY_SECRET)%" | ||
router: | ||
resource: "%kernel.root_dir%/config/routing.yml" | ||
strict_requirements: ~ | ||
|
@@ -61,10 +61,10 @@ twig: | |
# Doctrine Configuration (used to access databases and manipulate their information) | ||
doctrine: | ||
dbal: | ||
# if you don't want to use SQLite, comment the two following lines | ||
driver: "pdo_sqlite" | ||
path: "%kernel.root_dir%/data/blog.sqlite" | ||
# uncomment the following lines to use a database different than SQLite | ||
# if you don't want to use SQLite, change the URL in parameters.yml or set the DATABASE_URL environment variable | ||
url: "%env(DATABASE_URL)%" | ||
|
||
# instead of using a URL, you may also uncomment the following lines to configure your database | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you also need to comment the URL (as the URL wins over these params if you configure both) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's why it says "instead of" ;) |
||
# driver: pdo_mysql | ||
# host: "%database_host%" | ||
# port: "%database_port%" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,11 +6,11 @@ parameters: | |
# this demo application uses an embedded SQLite database to simplify setup. | ||
# in a real Symfony application you probably will use a MySQL or PostgreSQL database | ||
# the path must be relative or else it will not work on Windows | ||
database_url: 'sqlite:///%kernel.root_dir%/data/blog.sqlite' | ||
env(DATABASE_URL): 'sqlite:///%kernel.root_dir%/data/blog.sqlite' | ||
|
||
# Uncomment this line to use a MySQL database instead of SQLite: | ||
# | ||
# database_url: 'mysql://root:[email protected]:3306/symfony_demo' | ||
# env(DATABASE_URL): 'mysql://root:[email protected]:3306/symfony_demo' | ||
# | ||
# Furthermore, you must remove or comment out the "doctrine" section from config_dev.yml regarding SQLite! | ||
# | ||
|
@@ -35,4 +35,7 @@ parameters: | |
# used internally by Symfony in several places (CSRF tokens, URI signing, | ||
# 'Remember Me' functionality, etc.) | ||
# see: http://symfony.com/doc/current/reference/configuration/framework.html#secret | ||
secret: 'secret_value_for_symfony_demo_application' | ||
env(SYMFONY_SECRET): 'secret_value_for_symfony_demo_application' | ||
|
||
# Destination for log files; can also be "php://stderr" etc | ||
env(SYMFONY_LOG): %kernel.logs_dir%/%kernel.environment%.log |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it will fail on the 2nd push, won't it? Maybe
php bin/console doctrine:schema:update --force
is a better command here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. The name
postdeploy
for the script is, unfortunately, misleading; it is run only after the very first deploy using the "Deploy to Heroku" button.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I see, thanks!