Search code examples
ngrokddev

How do I use "ddev share" to share BOTH my drupal website AND mailhog?


Is it possible to easily share both my drupal site and mailhog via ngrok using ddev share? (ddev share is working great to share my site currently.)

I am not networking savvy, and have tried variations on specifying port, etc but with no luck.

In case it matters, this is a windows machine running ddev on ubuntu.


Solution

  • I would just run a separate ngrok command that shares the mailhog port. If you look at what ddev share does, it just does ngrok http http://127.0.0.1:49156, so we'll do the same with your mailhog port.

    1. Expose a known specific port for mailhog directly at the host level (not going through ddev-router), so set host_mailhog_port: 9999 in .ddev/config.yaml - this would need to be different for each project that's running at a given time.
    2. Now run ngrok with ngrok http http://127.0.0.1:9999 in a different window and you'll find the shared mailhog window.

    It would be easy to create a custom command that would do this for you, or even a custom command that would launch both share and ngrok-mailhog share.