Fix initial setup when using Postgres #392
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I ran into a few different issues when trying to run this locally in Docker (using Docker Compose as recommended).
The main problem is the migrations are not run on first
docker-compose up
, even ifPOPULATE_DATABASE
is set toTrue
. Searching through the issues I was able to find the command to run the migrations (bin/console doctrine:migrations:migrate --env=prod --no-interaction
), and though it throws errors when run, the migrations do succeed. (Running the command a second time will show that no migrations need to be run, and no errors occur, so some part of the command must depend on having the correct database structure.)I also noticed that the database-exists check was failing; when I did a fresh
docker-compose up
, theentrypoint.sh
script detected that thewallabag
database already existed, and I confirmed this by inspecting the Postgres instance myself. My guess is Docker Compose automatically created a database with the same name as the Compose project (which here was alsowallabag
), so by the time the script checks it already exists. To work around this, I instead added a check if any tables exist, and now it works properly.One other issue I found is even though the
entrypoint.sh
provisioner runs thebin/console wallabag:install
command, the defaultwallabag:wallabag
user was not created. I ran the install command again by doing:and after that the default user was created.
I haven't dug into either that or the migration command throwing errors, but will shortly either do so or at least create issues for them.
I found a few similar issues (listed below), but all of them have slight variations from my setup or behavior, e.g. using MySQL instead of Postgres, so I'm listing as
Related
rather thanFixes
.Related: #291, #236, #286, #154, #377.