Skip to content
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

Fix Deploying to the Heroku #377

Closed
wants to merge 2 commits into from
Closed

Conversation

bocharsky-bw
Copy link
Contributor

@bocharsky-bw bocharsky-bw commented Sep 2, 2016

Fix #371 .

Let's use SQLite DB with pre-populated data instead of bootstrapping a new PostgreSQL one:

It works for me: https://symfony-demo.herokuapp.com

@javiereguiluz
Copy link
Member

@bocharsky-bw thanks for investigating this issue and providing a fix. Let's see if it works for others too. Thanks.

@dzuelke
Copy link
Contributor

dzuelke commented Oct 31, 2016

Let's please reopen and revert this. SQLite is not a proper solution on a container based production system like Heroku, as the local file system is reset between deploys or on periodic restarts, and obviously also not shared between instances, so if you scale to more than one web instance, they won't share the same database.

dzuelke added a commit to dzuelke/symfony-demo that referenced this pull request Nov 8, 2016
Commit 662e78f / PR symfony#377 removed the Postgres add-on and the initial seeding. This is not the correct solution to issue symfony#371, which arose because the config got changed back to individual parameters rather than a URL in 56cfa66. But we now use Doctrine DBAL 2.5.5, which correctly handles SQLite URLs, so there is no need for individual parameters anymore.

Also, using SQLite in production very obviously does not allow for horizontal scalability...
javiereguiluz added a commit that referenced this pull request Nov 10, 2016
…oku deploys (dzuelke)

This PR was squashed before being merged into the master branch (closes #399).

Discussion
----------

Use dynamic env params for critical settings and restore Heroku deploys

Database, log destination, and secrets are now configurable via environment variables (via the quasi standard `DATABASE_URL`, and `SYMFONY_LOG`, and `SYMFONY_SECRET`). All three fall back to defaults from `parameters.yml(.dist)`.

For simplicity (one param versus many), a URL is now used again for SQLite, because that works fine since Doctrine DBAL 2.5.5.

Deploys to Heroku are now fixed again; @bocharsky-bw's PR #377 was not a fix for #371, because SQLite does not scale horizontally :p The original problem was @javiereguiluz's 56cfa66 change to Symfony 3.1, which used individual parameters for config. Again, no longer a problem since DBAL 2.5.5. It also uses `php://stderr` for env `prod` on Heroku only, which @javiereguiluz had also removed in 56cfa66 (for the future, I'd encourage separate commits for stuff like this, as it makes it much easier to untangle individual parts and reasons for changes).

This demo app ships with sample data in SQLite, but for other databases, the data needs to be seeded, and that can even happen in a prod env. @javiereguiluz' commit e2264b0 removed the fixtures bundle needed for that from the kernel init; it's now back.

This app now works just fine with the usual defaults both in `dev` and `prod` envs, but users who want to try running it on Docker or on a PaaS like Heroku can now trivially adjust relevant settings via environment variables.

/CC @stof @fabpot

Commits
-------

21fcb92 Use dynamic env params for critical settings and restore Heroku deploys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants