Created
February 2, 2019 21:20
-
-
Save s3w47m88/e56431d58808180c9ff7e4ee962e03a6 to your computer and use it in GitHub Desktop.
Docker Composer with Laravel deploying Firefly Failing on DB Connection
This file contains hidden or 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
root@firefly:~# docker-compose -f docker-compose.yml up -d | |
Creating network "root_firefly_iii_net" with driver "bridge" | |
Creating volume "root_firefly_iii_db" with default driver | |
Creating volume "root_firefly_iii_export" with default driver | |
Creating volume "root_firefly_iii_upload" with default driver | |
Pulling firefly_iii_db (postgres:10)... | |
10: Pulling from library/postgres | |
5e6ec7f28fb7: Pull complete | |
5e2aec55a5ab: Pull complete | |
966624e73f54: Pull complete | |
3c5197efa683: Pull complete | |
bb4834c5b0ba: Pull complete | |
32e88c2d07b1: Pull complete | |
6a7e663589c9: Pull complete | |
16acf43c5b2b: Pull complete | |
f0b4a8223658: Pull complete | |
c900d65a932b: Pull complete | |
c2bcdb7b93c0: Pull complete | |
864ece1e6b41: Pull complete | |
f3a2aa127cdb: Pull complete | |
b99c92b6c1b2: Pull complete | |
Digest: sha256:2c880821aef9fb22c44ed0dbd6bcb75bdbf283b96171fbddb44dd7304e2a094b | |
Status: Downloaded newer image for postgres:10 | |
Creating root_firefly_iii_db_1 ... done | |
Creating root_firefly_iii_app_1 ... error | |
ERROR: for root_firefly_iii_app_1 Cannot start service firefly_iii_app: driver failed programming external connectivity on endpoint root_firefly_iii_app_1 (9fb977fcf45622b9aa37ea472dede0d1012db3c6b2db27ca2c7a87567ede314f): Bind for 0.0.0.0:80 failed: port is already allocated | |
ERROR: for firefly_iii_app Cannot start service firefly_iii_app: driver failed programming external connectivity on endpoint root_firefly_iii_app_1 (9fb977fcf45622b9aa37ea472dede0d1012db3c6b2db27ca2c7a87567ede314f): Bind for 0.0.0.0:80 failed: port is already allocated | |
ERROR: Encountered errors while bringing up the project. | |
root@firefly:~# sudo service docker restart | |
root@firefly:~# | |
root@firefly:~# | |
root@firefly:~# docker-compose -f docker-compose.yml up -d | |
Starting root_firefly_iii_db_1 ... done | |
Starting root_firefly_iii_app_1 ... done | |
root@firefly:~# docker-compose exec firefly_iii_app php artisan migrate --seed | |
[2019-02-02 13:12:03] local.ERROR: SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = firefly and table_name = migrations) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 2002): SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = firefly and table_name = migrations) at /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664, Doctrine\\DBAL\\Driver\\PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection refused at /var/www/firefly-iii/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31, PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection refused at /var/www/firefly-iii/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27) | |
[stacktrace] | |
#0 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connection.php(624): Illuminate\\Database\\Connection->runQueryCallback('select * from i...', Array, Object(Closure)) | |
#1 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connection.php(333): Illuminate\\Database\\Connection->run('select * from i...', Array, Object(Closure)) | |
#2 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php(18): Illuminate\\Database\\Connection->select('select * from i...', Array) | |
#3 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php(169): Illuminate\\Database\\Schema\\MySqlBuilder->hasTable('migrations') | |
#4 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(556): Illuminate\\Database\\Migrations\\DatabaseMigrationRepository->repositoryExists() | |
#5 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(91): Illuminate\\Database\\Migrations\\Migrator->repositoryExists() | |
#6 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(63): Illuminate\\Database\\Console\\Migrations\\MigrateCommand->prepareDatabase() | |
#7 [internal function]: Illuminate\\Database\\Console\\Migrations\\MigrateCommand->handle() | |
#8 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array) | |
#9 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}() | |
#10 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure)) | |
#11 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/Container.php(572): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL) | |
#12 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\\Container\\Container->call(Array) | |
#13 /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)) | |
#14 /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)) | |
#15 /var/www/firefly-iii/vendor/symfony/console/Application.php(901): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) | |
#16 /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)) | |
#17 /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)) | |
#18 /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)) | |
#19 /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)) | |
#20 /var/www/firefly-iii/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) | |
#21 {main} | |
"} | |
In Connection.php line 664: | |
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = firefly and table_name = migrations) | |
In PDOConnection.php line 31: | |
SQLSTATE[HY000] [2002] Connection refused | |
In PDOConnection.php line 27: | |
SQLSTATE[HY000] [2002] Connection refused | |
root@firefly:~# docker-compose -f docker-compose.yml up -d | |
root_firefly_iii_db_1 is up-to-date | |
root_firefly_iii_app_1 is up-to-date | |
root@firefly:~# | |
root@firefly:~# docker-compose -f docker-compose.yml down -d | |
Stops containers and removes containers, networks, volumes, and images | |
created by `up`. | |
By default, the only things removed are: | |
- Containers for services defined in the Compose file | |
- Networks defined in the `networks` section of the Compose file | |
- The default network, if one is used | |
Networks and volumes defined as `external` are never removed. | |
Usage: down [options] | |
Options: | |
--rmi type Remove images. Type must be one of: | |
'all': Remove all images used by any service. | |
'local': Remove only images that don't have a | |
custom tag set by the `image` field. | |
-v, --volumes Remove named volumes declared in the `volumes` | |
section of the Compose file and anonymous volumes | |
attached to containers. | |
--remove-orphans Remove containers for services not defined in the | |
Compose file | |
-t, --timeout TIMEOUT Specify a shutdown timeout in seconds. | |
(default: 10) | |
root@firefly:~# docker-compose -f docker-compose.yml down | |
Stopping root_firefly_iii_app_1 ... done | |
Stopping root_firefly_iii_db_1 ... done | |
Removing root_firefly_iii_app_1 ... done | |
Removing root_firefly_iii_db_1 ... done | |
Removing network root_firefly_iii_net | |
root@firefly:~# docker-compose -f docker-compose.yml up -d | |
Creating network "root_firefly_iii_net" with driver "bridge" | |
Creating root_firefly_iii_db_1 ... done | |
Creating root_firefly_iii_app_1 ... done | |
root@firefly:~# docker-compose exec firefly_iii_app php artisan migrate --seed | |
[2019-02-02 13:13:14] local.ERROR: SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = firefly and table_name = migrations) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 2002): SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = firefly and table_name = migrations) at /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664, Doctrine\\DBAL\\Driver\\PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection refused at /var/www/firefly-iii/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31, PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection refused at /var/www/firefly-iii/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27) | |
[stacktrace] | |
#0 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connection.php(624): Illuminate\\Database\\Connection->runQueryCallback('select * from i...', Array, Object(Closure)) | |
#1 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connection.php(333): Illuminate\\Database\\Connection->run('select * from i...', Array, Object(Closure)) | |
#2 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php(18): Illuminate\\Database\\Connection->select('select * from i...', Array) | |
#3 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php(169): Illuminate\\Database\\Schema\\MySqlBuilder->hasTable('migrations') | |
#4 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(556): Illuminate\\Database\\Migrations\\DatabaseMigrationRepository->repositoryExists() | |
#5 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(91): Illuminate\\Database\\Migrations\\Migrator->repositoryExists() | |
#6 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(63): Illuminate\\Database\\Console\\Migrations\\MigrateCommand->prepareDatabase() | |
#7 [internal function]: Illuminate\\Database\\Console\\Migrations\\MigrateCommand->handle() | |
#8 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array) | |
#9 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}() | |
#10 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure)) | |
#11 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/Container.php(572): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL) | |
#12 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\\Container\\Container->call(Array) | |
#13 /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)) | |
#14 /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)) | |
#15 /var/www/firefly-iii/vendor/symfony/console/Application.php(901): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) | |
#16 /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)) | |
#17 /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)) | |
#18 /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)) | |
#19 /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)) | |
#20 /var/www/firefly-iii/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) | |
#21 {main} | |
"} | |
In Connection.php line 664: | |
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = firefly and table_name = migrations) | |
In PDOConnection.php line 31: | |
SQLSTATE[HY000] [2002] Connection refused | |
In PDOConnection.php line 27: | |
SQLSTATE[HY000] [2002] Connection refused | |
root@firefly:~# ufw allow 3306 | |
Rule added | |
Rule added (v6) | |
root@firefly:~# docker-compose exec firefly_iii_app php artisan migrate --seed | |
[2019-02-02 13:13:43] local.ERROR: SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = firefly and table_name = migrations) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 2002): SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = firefly and table_name = migrations) at /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664, Doctrine\\DBAL\\Driver\\PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection refused at /var/www/firefly-iii/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31, PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection refused at /var/www/firefly-iii/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27) | |
[stacktrace] | |
#0 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connection.php(624): Illuminate\\Database\\Connection->runQueryCallback('select * from i...', Array, Object(Closure)) | |
#1 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Connection.php(333): Illuminate\\Database\\Connection->run('select * from i...', Array, Object(Closure)) | |
#2 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php(18): Illuminate\\Database\\Connection->select('select * from i...', Array) | |
#3 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php(169): Illuminate\\Database\\Schema\\MySqlBuilder->hasTable('migrations') | |
#4 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(556): Illuminate\\Database\\Migrations\\DatabaseMigrationRepository->repositoryExists() | |
#5 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(91): Illuminate\\Database\\Migrations\\Migrator->repositoryExists() | |
#6 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(63): Illuminate\\Database\\Console\\Migrations\\MigrateCommand->prepareDatabase() | |
#7 [internal function]: Illuminate\\Database\\Console\\Migrations\\MigrateCommand->handle() | |
#8 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array) | |
#9 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}() | |
#10 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure)) | |
#11 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/Container.php(572): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL) | |
#12 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\\Container\\Container->call(Array) | |
#13 /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)) | |
#14 /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)) | |
#15 /var/www/firefly-iii/vendor/symfony/console/Application.php(901): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) | |
#16 /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)) | |
#17 /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)) | |
#18 /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)) | |
#19 /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)) | |
#20 /var/www/firefly-iii/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) | |
#21 {main} | |
"} | |
In Connection.php line 664: | |
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = firefly and table_name = migrations) | |
In PDOConnection.php line 31: | |
SQLSTATE[HY000] [2002] Connection refused | |
In PDOConnection.php line 27: | |
SQLSTATE[HY000] [2002] Connection refused | |
root@firefly:~# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment