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

Improve bin/start and remove backslashes #331

Closed
wants to merge 4 commits into from

Conversation

rangerz
Copy link
Contributor

@rangerz rangerz commented Oct 19, 2020

Description

  1. Use $(...) (new style) to replace` backslashes (old style) because this link

  2. Improve bin/start to wait for all services of containers to be ready.

No need the sleep any more sleep 5 #Ensure containers are started...

The concept is the same with #326 (Check Elasticsearch connection before setup:install)

I think the checker put to bin/start will be more fit, and also extend more services, such as nginx, mysql, redis, and rabbitmq

The checker also scans service ports to be available before docker start, and scan allocated ports by services after docker start.

If service ports are already allocated, bin/start will appear below error message.

bin/start error for allocated port
bin/start
Starting a4f172b22c65_magento2test_rabbitmq_1 ...
Starting magento2test_elasticsearch_1         ...
Starting a4f172b22c65_magento2test_rabbitmq_1 ... error
Starting magento2test_redis_1                 ...
Starting magento2test_db_1                    ...
WARNING: Host is already in use by another container
WARNING: Host is already in use by another container

ERROR: for a4f172b22c65_magento2test_rabbitmq_1  Cannot start service rabbitmq: driver failed programming external connectivity on endpoint a4f172b22c65_magento2test_rabbitmq_1 (4a68cb572cc5641cea47c9292b1d0ce2edff8816f71f3a71e01e03884ad3a86c): Bind for 0.0.0.0:15672 failed: port is alStarting magento2test_db_1                    ... error

ERROR: for magento2test_db_1  Cannot start service db: driver failed programming external connectivity on endpoint magento2test_db_Starting magento2test_mailhog_1               ... error
WARNING: Host is already in use by another container
Starting magento2test_elasticsearch_1         ... error
ERROR: for magento2test_mailhog_1  Cannot start service mailhog: driver failed programming external connectivity on endpoint magento2test_mailhog_1 (71980bcf3e48e9b9fd8e21c433dfe0e70ae5418ff7bbc1eae54d386f555f0afb): Bind for 0.0.0.0:8025 failed: port is already allocated
WARNING: Host is already in use by another container

Starting magento2test_redis_1                 ... done
magento2test_elasticsearch_1 (81a677c15165102fcfdb505725ee695f8cb1eca3e3a52b5eacb88d5910eaacaa): Bind for 0.0.0.0:9300 failed: port is already allocated

ERROR: for rabbitmq  Cannot start service rabbitmq: driver failed programming external connectivity on endpoint a4f172b22c65_magento2test_rabbitmq_1 (4a68cb572cc5641cea47c9292b1d0ce2edff8816f71f3a71e01e03884ad3a86c): Bind for 0.0.0.0:15672 failed: port is already allocated

ERROR: for db  Cannot start service db: driver failed programming external connectivity on endpoint magento2test_db_1 (18268530f6de3196d087dfd681b1416916c23faa66414febdca298f437597837): Bind for 0.0.0.0:3306 failed: port is already allocated

ERROR: for mailhog  Cannot start service mailhog: driver failed programming external connectivity on endpoint magento2test_mailhog_1 (71980bcf3e48e9b9fd8e21c433dfe0e70ae5418ff7bbc1eae54d386f555f0afb): Bind for 0.0.0.0:8025 failed: port is already allocated

ERROR: for elasticsearch  Cannot start service elasticsearch: driver failed programming external connectivity on endpoint magento2test_elasticsearch_1 (81a677c15165102fcfdb505725ee695f8cb1eca3e3a52b5eacb88d5910eaacaa): Bind for 0.0.0.0:9300 failed: port is already allocated
ERROR: Encountered errors while bringing up the project.

How to verify:

  1. check onelinesetup and manual setup.
  2. check bin/start and bin/restart
  3. check bin/xdebug enable and bin/xdebug disable

Any concern please let me know, I will revise them.

@rangerz rangerz closed this Oct 30, 2020
@markshust
Copy link
Owner

Hi @rangerz - going to reopen this to keep visibility. Should I implement the healthcheck script above?

@markshust markshust reopened this Nov 10, 2020
@markshust
Copy link
Owner

Also, I can still bring in the backticks to $() change.

@markshust
Copy link
Owner

Hi @rangerz -- circling back around to this ticket. I won't merge this in yet, as you mentioned another solution could be more elegant. Let me know your thoughts, I did update this PR with latest from upstream just so we can easily re-test this if needed.

@rangerz
Copy link
Contributor Author

rangerz commented Jan 29, 2021

Hi @markshust, It may use HEALTHCHECK for Dockerfile.

And then we can remove the sleep 5 after docker start.

I will work on it.

Ref: HEALTHCHECK - Dockerfile reference

@markshust
Copy link
Owner

Thanks @rangerz. FYI noticed some conflicts on the open PR after merged a bunch of stuff the last couple days.

@rangerz
Copy link
Contributor Author

rangerz commented Feb 5, 2021

@markshust I think we can close this pull request. If anything need to keep any change, just create another one for it.

@markshust markshust closed this Feb 5, 2021
@rangerz rangerz deleted the improve-start branch December 10, 2022 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants