swoft-cloud / swoft

🚀 PHP Microservice Full Coroutine Framework
https://swoft.org
Apache License 2.0
5.58k stars 786 forks source link

Cannot run with Docker #837

Closed MassiAtHG closed 5 years ago

MassiAtHG commented 5 years ago
Q A
Bug report? yes
Feature request? no
Swoft version latest from git clone
Swoole version the one installed in docker image swoft/swoft
PHP version the one installed in docker image swoft/swoft
Runtime environment Docker

Details

Describe what you are trying to achieve and what goes wrong.

After GIT cloning of the project I ran 'composer install'. All dependencies are installed properly. I then run 'docker-compose up'; images are properly dowloaded and containers start running. SWOFT container bails out a first time on following error:

Fatal error: Uncaught Doctrine\Common\Annotations\AnnotationException: [Semantical Error] Couldn't find constant Swoft\Server\SwooleEvent::SHUTDOWN, class App\Listener\DeregisterServiceListener. in /var/www/swoft/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php:54

This first problem is easily solvable by finding instances of 'Swoft\Server\SwooleEvent' replacing them with 'Swoft\Server\Swoole\SwooleEvent'.

When I start the container again, the following error occurs:

Fatal error: Interface 'Swoft\Process\Contract\ProcessInterface' not found in /var/www/swoft/app/Process/Worker2Process.php on line 23

The component 'swoft-process' seems not to be installed, and trying to installing it manually with composer does not resolve correctly.

inhere commented 5 years ago

oo, sorry. We are ready to release the new version. so, master contains some new feature codes.

you can:

git checkout v2.0.3
docker-composer up
MassiAtHG commented 5 years ago

With v2.0.3 all seems fine. I needed though to amend docker-compose.yml as the container command references '/var/www/swoft/bin/swoft' while docker-compose.yml volume is './:/var/www' (it should be './:/var/www/swoft')

inhere commented 5 years ago

@MassiAtHG yes, we have fixed. will release on today.

MassiAtHG commented 5 years ago

Since this issue has been tagged a question, I would like to ask a couple.

Apart from the introduction of a very comprehensive events system, what are the biggest advantages of version 2 in comparison to version 1 of SWOFT?

What are good use cases for the 'breaker' module?

Thanks in advance for any reply.

inhere commented 5 years ago

@MassiAtHG the latest version 2.0.4 has been released. you can pull latest docker image.

about 'breaker'

We have re-translated the English document, you can directly view the latest document.

If you have a document that you don't understand, you can issue a question on github issues or gitter.im. We will help answer.

diff with swoft 1:

MassiAtHG commented 5 years ago

Thanks for your professionalism and the great work you are doing.