Closed oskarbarcz closed 4 years ago
Hey,
Looks like table for events not exists, try run migrations once again.
Please also connect to database and verify your structure by eg. Tableplus or phpstorm
I did that, and I know that this table does not exists, deleting all migration classes, dropping database, creating new one, however creating migration with bin/console m:migr
recreates all tables (messenger_messsages /temporarily/), refresh_tokens, users - but event table does not exist, it behaves like Doctrine does not see Event entity / mapping, and I can't find any working solution for that.
You can use make db
instead.
Table events is created in this migration - https://github.com/jorge07/symfony-5-es-cqrs-boilerplate/blob/84d822de3c13f0fa1bf823f9105de1c711f803f1/src/Infrastructure/Share/Migrations/Version20180102233829.php#L43
My structure:
I am little confused about messenger_messsages
and refresh_tokens
.
What I think has happened here is that you've run migration:generate
and in this new migration file Doctrine is deleting this events table. Please have a look. Broadway doesn't use Doctrine mapping but schema so you're to review created migrations to not delete the Broadway bundle table.
I'll see if I can fix this in Broadway bundle side. It's the best DX actually
Hmm, I've had lots of problems during moving my project from simple Symfony architecture into CQRS & ES one, so I decided to clone this repo and use it as a boilerplate. Anyway, now I'm getting an error like this:
docker-compose -f docker-compose.yml -f etc/dev/docker-compose.yml stop
Stopping cloud-sso_elasticsearch_1 ... done
Stopping cloud-sso_mysql_1 ... done
Stopping cloud-sso_rmq_1 ... done
docker-compose rm -v -f
Going to remove cloud-sso_elasticsearch_1, cloud-sso_mysql_1, cloud-sso_rmq_1
Removing cloud-sso_elasticsearch_1 ... done
Removing cloud-sso_mysql_1 ... done
Removing cloud-sso_rmq_1 ... done
docker-compose -f docker-compose.yml -f etc/dev/docker-compose.yml build
mysql uses an image, skipping
elasticsearch uses an image, skipping
rmq uses an image, skipping
php uses an image, skipping
nginx uses an image, skipping
workers uses an image, skipping
kibana uses an image, skipping
docker-compose -f docker-compose.yml -f etc/dev/docker-compose.yml run --rm php sh -lc 'xoff;COMPOSER_MEMORY_LIMIT=-1 composer install'
Creating cloud-sso_elasticsearch_1 ...
Creating cloud-sso_rmq_1 ...
Creating cloud-sso_mysql_1 ...
Creating cloud-sso_mysql_1 ... error
Creating cloud-sso_elasticsearch_1 ... doneCreating cloud-sso_rmq_1 ... doneted
ERROR: for mysql Cannot start service mysql: driver failed programming external connectivity on endpoint cloud-sso_mysql_1 (cc8f6155dd0f88a8439dd7039d7f3c86fdd8d202949226a4cde3291b0a9c6f3d): Bind for 0.0.0.0:3306 failed: port is already allocated
ERROR: Encountered errors while bringing up the project.
make: *** [makefile:31: build] Error 1
I know it's mysql-related, but I have no idea what's going on.
OK, I fixed this problem using different MySQL entry port in dev environment. However, I'm getting now an error:
Cannot autowire service "App\Application\Command\User\SignIn\SignInHandler"
!! : argument "$userCollection" of method "__construct()" references interface
!! "App\Domain\User\Repository\CheckUserByEmailInterface" but no such service
!! exists. Did you create a class that implements this interface?
Seems you got another mysql instance running locally. Is this happening in a clean clone? What where the steps you did?
Currently this should work:
What OS are you using?
Hi, I'm back. I've recloned your repo, now I'm getting an error: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Name does not resolve. The only thing I've changed is MySQL port from 3306 to 8306 (both in docker-compose.yml and .env's files.
Whole console output:
archi_tektur@Oskar-PC:~/Projects/Cloud/cloud-core$ make start
docker-compose -f docker-compose.yml -f etc/dev/docker-compose.yml stop
Stopping cloud-core_nginx_1 ... done
Stopping cloud-core_workers_1 ... done
Stopping cloud-core_php_1 ... done
Stopping cloud-core_kibana_1 ... done
Stopping cloud-core_rmq_1 ... done
Stopping cloud-core_elasticsearch_1 ... done
docker-compose rm -v -f
Going to remove cloud-core_nginx_1, cloud-core_workers_1, cloud-core_php_1, cloud-core_mysql_1, cloud-core_rmq_1, cloud-core_elasticsearch_1
Removing cloud-core_nginx_1 ... done
Removing cloud-core_workers_1 ... done
Removing cloud-core_php_1 ... done
Removing cloud-core_mysql_1 ... done
Removing cloud-core_rmq_1 ... done
Removing cloud-core_elasticsearch_1 ... done
docker-compose -f docker-compose.yml -f etc/dev/docker-compose.yml build
rmq uses an image, skipping
mysql uses an image, skipping
kibana uses an image, skipping
elasticsearch uses an image, skipping
workers uses an image, skipping
php uses an image, skipping
nginx uses an image, skipping
docker-compose -f docker-compose.yml -f etc/dev/docker-compose.yml run --rm php sh -lc 'xoff;COMPOSER_MEMORY_LIMIT=-1 composer install'
Creating cloud-core_elasticsearch_1 ... done
Creating cloud-core_rmq_1 ... done
Creating cloud-core_mysql_1 ... done
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
81 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Executing script cache:clear [OK]
Executing script assets:install public [OK]
docker-compose -f docker-compose.yml -f etc/dev/docker-compose.yml up -d
Starting cloud-core_mysql_1 ...
cloud-core_rmq_1 is up-to-date
Starting cloud-core_mysql_1 ... done
Starting cloud-core_kibana_1 ... done
Creating cloud-core_workers_1 ... done
Creating cloud-core_php_1 ... done
Creating cloud-core_nginx_1 ... done
docker-compose -f docker-compose.yml -f etc/dev/docker-compose.yml exec -T php sh -lc './bin/console d:d:d --force --if-exists'
In AbstractMySQLDriver.php line 93:
An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddr
esses: getaddrinfo failed: Name does not resolve
In PDOConnection.php line 31:
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name d
oes not resolve
In PDOConnection.php line 27:
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name d
oes not resolve
In PDOConnection.php line 27:
PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Name does
not resolve
doctrine:database:drop [-s|--shard SHARD] [-c|--connection [CONNECTION]] [--if-exists] [-f|--force] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>
make: *** [makefile:81: db] Error 1
Can you paste here the changes you've made in docker compose and env file please?
Of course, here it goes (only showing lines that were changed): etc/.../docker-compose.yml:
mysql:
ports:
- "8306:3306"
.env:
###> doctrine/doctrine-bundle###
DATABASE_URL=mysql://root:api@mysql:8306/api?serverVersion=8.0
###< doctrine/doctrine-bundle ###
It seems to be docker networking problem, I cannot reach mysql container from the nginx one. I'm running on Ubuntu 20.04 LTS, if that's helpful.
If you've not modified mysql.conf to run in this port, then in the docker network will still running in 3306 and your Host port now maps to a empty port.
My suggestion is to NOT modify mysql config at all. Keep everything as it is when you clone and just map you Host port to the mysql port in docker internal network. This will allow you to access mysql from the outside docker network in the port 8306 while PHP containers will be able to access mysql at port 3306.
mysql:
ports:
- "8306:3306
Have a try and let's see if this solves your problem
Hi again!
I haven't modified any of mysql config files (except the docker ones). I had conflict on port 3306, so I mapped it to free 8306 on external. Even if I changed it back I'm still getting this error. I cannot reach MySQL container within NGINX one.
I've restored .env to original and it's still not working at all.
@archi-tektur have a try to #174 please and tell me if solves your issue. I was able to reproduce your issue locally and this worked for me
Closed my mistake. Sry!
This should be solved in #174 feel free to reopen if still having issues
Hey, I'm new into CQRS and Broadway, but I'm issuing with error I cannot solve myself. I've added some fixtures to this app, while loading data to database I'm getting an error:
I've done new migration, I've run it successfully, but it didn't created events table required by DBALEventStore.
Thanks in advance for your support!