jaymeh / cdev-environment-local

Local Environment Plugin for CDev
MIT License
0 stars 1 forks source link

Address already in use when calling `env:start` #15

Open garethmidwood opened 4 years ago

garethmidwood commented 4 years ago

I'm not 100% sure yet exactly how to recreate this, but sometimes when I start an environment I get this:

$ cdev env:start

>>>>>>>>>> STARTING DEV ENVIRONMENT...
>>> Adding a new configuration for `backups.dev.com` inside `/usr/local/etc/httpd/extra/httpd-vhosts.conf`.
>>> Ensuring that the configuration has been applied for `backups.dev.com`
>>> Running `sudo apachectl -k stop`
>>> Running `sudo apachectl -k start`
(48)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
>>> Checking if database already exists. Please enter mysql root password.
Enter password:
>>> Running `mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS backups" `
Enter password:
>>> Running `brew services start mariadb`
Service `mariadb` already started, use `brew services restart mariadb` to restart.
garethmidwood commented 4 years ago

The result is that I can't access the site. If I then try to restart apache:

$ sudo apachectl -k restart
httpd not running, trying to start

Turns out it's not running!

The site does work once I've done this.

I wonder if it's still trying to do sudo apachectl -k stop when sudo apachectl -k start is run. Maybe just a sudo apachectl -k restart would be better?

jamiesykescreode commented 4 years ago

Annoyingly there isn't a status command which I would rely on heavily here. Instead I just have to run silly stop / start commands and hope everything is fine. 👎

I had mixed luck with restart which is why I am doing stop/start separately but can give it a shot.

garethmidwood commented 4 years ago

Could be worth a brew services list and grep in the result?

jamiesykescreode commented 4 years ago

This is worth trying for now but it's not always reliable as the started could be yellow signifying there is an issue.