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

php pdoexception sqlstate 08006 could not translate host name "firefly_iii_db" to address: Name or service not known #1838

Closed
bartmaniac opened this issue Oct 31, 2018 · 12 comments
Labels
stale No replies or comments. Will be auto-closed in 14 days.

Comments

@bartmaniac
Copy link

I am running Firefly III version 4.7.7

Description
I tried to upgrade from 4.7.7 to 4.7.8 using the following commands
docker-compose pull firefly_iii_app && docker-compose restart firefly_iii_app
followed by

docker-compose exec firefly_iii_app php artisan migrate --seed
docker-compose exec firefly_iii_app php artisan firefly:upgrade-database
docker-compose exec firefly_iii_app php artisan firefly:verify
docker-compose exec firefly_iii_app php artisan passport:install

when i try to reach http:localhost:8081 I first got a blank page. After running the upgrade commands a second time I got the message be right back. I then changed a setting in .env file to get this bug output

Have I lost also my data that I entered in version 4.7.7?

Steps to reproduce
(if relevant of course)

Extra info
MAC OS High Sierra / docker ce for mac

Bonus points
Earn bonus points by:

@bartmaniac
Copy link
Author

some lines of the error output

fireflyiii-error

@bartmaniac
Copy link
Author

I using the app kitematic to add /change guest and host port numbers.

@JC5
Copy link
Member

JC5 commented Oct 31, 2018

How did you use kitematic exactly?

If you did not remove any volumes the upgrade should go smoothly but this is clearly not the case. Did you try a stop/start instead of a restart?

@JC5 JC5 added the question label Oct 31, 2018
@bartmaniac
Copy link
Author

bartmaniac commented Oct 31, 2018

well i have tried restart start stop running upgrade commands again, sorry can't remember the sequence of this. Can I provide you some other info by executing a command?

someone suggested that I changed a setting in the docker-compose.yml file
FF_DB_HOST=firefly_iii_db change it in FF_DB_HOST=localhost.
I have yet not tried this

@bartmaniac
Copy link
Author

bartmaniac commented Oct 31, 2018

I noticed in kitematic that the container documents_firefly_iii_db_1 was not running. A start or a restart did not solve the problem
2018-10-31 18:54:54.264 UTC [1] FATAL: database files are incompatible with server
2018-10-31 18:54:54.264 UTC [1] DETAIL: The data directory was initialized by PostgreSQL version 11, which is not compatible with this version 10.5 (Debian 10.5-2.pgdg90+1).

here is a part of the docker-compose.yml file

firefly_iii_db:
environment:
- POSTGRES_PASSWORD=firefly
- POSTGRES_USER=firefly
image: "postgres:10"

I remembered that when I first installed firefly, the image was "postgres:latest"

@bartmaniac
Copy link
Author

i also found another docker-compose.yml file in /var/www when I execute command "docker exec -it df46a17b56bd bash" Doing this a go from iMac-Bart:Documents bartherbots$ to root@df46a17b56bd. Once in there a can navigate to /var/www.

The other yml file is locate on the imac /Users/myname/Documenten/

@bartmaniac
Copy link
Author

This is what I tried after changing <<image: "postgres:10 -> postgres:latest>>"the yml file (the one located under /Users/myname/Documenten)
I got back from root to iMac-Bart:Documents bartherbots$ and executed "docker-compose pull firefly_iii_app && docker-compose restart firefly_iii_app"
the output was
Pulling firefly_iii_app ... done
Restarting documents_firefly_iii_app_1 ... done

next i did docker-compose exec firefly_iii_app php artisan migrate --seed
the output was

2018-10-31 20:30:12] local.ERROR: SQLSTATE[08006] [7] could not translate host name "firefly_iii_db" to address: Name or service not known {"exception":"[object] (Doctrine\DBAL\Driver\PDOException(code: 7): SQLSTATE[08006] [7] could not translate host name "firefly_iii_db" to address: Name or service not known at /var/www/firefly-iii/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:50, PDOException(code: 7): SQLSTATE[08006] [7] could not translate host name "firefly_iii_db" to address: Name or service not known at /var/www/firefly-iii/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:46)
[stacktrace]
#0 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(67): Doctrine\DBAL\Driver\PDOConnection->__construct('pgsql:host=fire...', 'firefly', 'firefly', Array)
#1 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(100): Illuminate\Database\Connectors\Connector->createPdoConnection('pgsql:host=fire...', 'firefly', 'firefly', Array)
#2 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(50): Illuminate\Database\Connectors\Connector->tryAgainIfCausedByLostConnection(Object(Doctrine\DBAL\Driver\PDOException), 'pgsql:host=fire...', 'firefly', 'firefly', Array)
#3 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connectors/PostgresConnector.php(33): Illuminate\Database\Connectors\Connector->createConnection('pgsql:host=fire...', Array, Array)
#4 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(182): Illuminate\Database\Connectors\PostgresConnector->connect(Array)
#5 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors\{closure}()
#6 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connection.php(916): call_user_func(Object(Closure))
#7 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(248): Illuminate\Database\Connection->getPdo()
#8 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(234): Illuminate\Database\DatabaseManager->refreshPdoConnections('pgsql')
#9 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(168): Illuminate\Database\DatabaseManager->reconnect('pgsql')
#10 [internal function]: Illuminate\Database\DatabaseManager->Illuminate\Database\{closure}(Object(Illuminate\Database\PostgresConnection))
#11 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connection.php(754): call_user_func(Object(Closure), Object(Illuminate\Database\PostgresConnection))
#12 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connection.php(736): Illuminate\Database\Connection->reconnect()
#13 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connection.php(718): Illuminate\Database\Connection->tryAgainIfCausedByLostConnection(Object(Illuminate\Database\QueryException), 'select * from i...', Array, Object(Closure))
#14 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connection.php(627): Illuminate\Database\Connection->handleQueryException(Object(Illuminate\Database\QueryException), 'select * from i...', Array, Object(Closure))
#15 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connection.php(333): Illuminate\Database\Connection->run('select * from i...', Array, Object(Closure))
#16 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Schema/PostgresBuilder.php(20): Illuminate\Database\Connection->select('select * from i...', Array)
#17 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php(169): Illuminate\Database\Schema\PostgresBuilder->hasTable('migrations')
#18 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(556): Illuminate\Database\Migrations\DatabaseMigrationRepository->repositoryExists()
#19 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(91): Illuminate\Database\Migrations\Migrator->repositoryExists()
#20 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(63): Illuminate\Database\Console\Migrations\MigrateCommand->prepareDatabase()
#21 [internal function]: Illuminate\Database\Console\Migrations\MigrateCommand->handle()
#22 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#23 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#24 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#25 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/Container.php(572): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#26 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\Container\Container->call(Array)
#27 /var/www/firefly-iii/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#28 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Console/Command.php(170): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#29 /var/www/firefly-iii/vendor/symfony/console/Application.php(886): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 /var/www/firefly-iii/vendor/symfony/console/Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Database\Console\Migrations\MigrateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /var/www/firefly-iii/vendor/symfony/console/Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Console/Application.php(89): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#34 /var/www/firefly-iii/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#35 {main}
"}

In PDOConnection.php line 50:

SQLSTATE[08006] [7] could not translate host name "firefly_iii_db" to address: Name or service not known

In PDOConnection.php line 46:

SQLSTATE[08006] [7] could not translate host name "firefly_iii_db" to address: Name or service not known

@bartmaniac
Copy link
Author

at this point I get no more error(s) when navigating to http://localhost:8081/login , Instead i get a white page with "Be right back."

@JC5
Copy link
Member

JC5 commented Oct 31, 2018

Is the DB image running at all?

The reason latest was changed to 10 is because postgres 11 just came out and this broke most people's database (there is no migration). I suggest you leave it at latest.

But I'm not a specialist on docker compose and the dns features (being able to connect to "firefly_iii_db"). I'll do some digging as well.

@bartmaniac
Copy link
Author

doing a "docker-compose -f docker-compose.yml up -d" did the trick and I could login 4.7.8 and all data is still there

@JC5
Copy link
Member

JC5 commented Nov 1, 2018

Mmm. Is the f for "force", perhaps? I was afraid to suggest something like that.

@stale
Copy link

stale bot commented Nov 15, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale No replies or comments. Will be auto-closed in 14 days. label Nov 15, 2018
@stale stale bot closed this as completed Nov 22, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stale No replies or comments. Will be auto-closed in 14 days.
Projects
None yet
Development

No branches or pull requests

2 participants