cytopia / devilbox

A modern Docker LAMP stack and MEAN stack for local development
http://devilbox.org
MIT License
4.39k stars 655 forks source link

Public URLs for local projects #453

Closed cs16lover closed 5 years ago

cs16lover commented 5 years ago

ISSUE TYPE

SUMMARY

It would be nice to have public URLs for the projects that is accessible from internet and available on demand.

Goal

Sometimes we need to show the progress on the project. There are some commercial with free tier and open source tools that you can publish your localhost to internet. Here are some examples: https://ngrok.com/ (Most popular one) https://localtunnel.github.io/www/ https://pagekite.net/ https://serveo.net/ https://portmap.io/ https://github.com/fatedier/frp https://github.com/mmatczuk/go-http-tunnel

cytopia commented 5 years ago

It should actually be possible right away to expose your vhosts via ngrok to the internet.

  1. pick a specific subdomain for ngrok: https://ngrok.com/docs#subdomain
  2. add an additional server alias/server name to vhost-gen config: https://devilbox.readthedocs.io/en/latest/vhost-gen/example-add-subdomains.html with the subdomain you have picked for the ngrok configuration
  3. start ngrok

Example

  1. Start ngrok with subdomain myoutside

    ngrok http -subdomain=myoutside 80
  2. Alter vhost-gen server name for Nginx (https://devilbox.readthedocs.io/en/latest/vhost-gen/example-add-subdomains.html#nginx)

vhost: |
  server {
      listen       __PORT____DEFAULT_VHOST__;
      server_name  __VHOST_NAME__;
      server_name  myoutside.__VHOST_NAME__;    # <--- THIS IS THE LINE TO ADD

      access_log   "__ACCESS_LOG__" combined;
      error_log    "__ERROR_LOG__" warn;

  __VHOST_DOCROOT__
  __VHOST_RPROXY__
  __PHP_FPM__
  __ALIASES__
  __DENIES__
  __SERVER_STATUS__
      # Custom directives
  __CUSTOM__
  }
  1. Start the Devilbox
cytopia commented 5 years ago

@cs16lover did the above example work out for you?

cytopia commented 5 years ago

@cs16lover Ngrok and corresponding documentation will be available in a few hours. PR is here: https://github.com/cytopia/devilbox/pull/522

cytopia commented 5 years ago

Documentation

llaville commented 5 years ago

One again, i like the documentation you produces @cytopia. BTW, could you tell us, which software you used to make such nice architecture diagram, and perharps include picture in final doc ! Thanks in advance for your great work

cytopia commented 5 years ago

Thanks! I use http://draw.io to create the diagrams and logos. Everything I do is publicly available here: https://github.com/devilbox/artwork

Each logo/diagram has a .xcf file (in the raw/ directory) which can be loaded into draw.io to edit it.

and perharps include picture in final doc

what exactly should I include?

llaville commented 5 years ago

I'd like to see architecture diagrams you built with https://github.com/devilbox/artwork (thanks to share)

nathanbriggs commented 5 years ago

Could you add support for ngrok's hostname parameter, please? https://ngrok.com/docs#custom-domains

I believe an optional 4th parameter for a tunnel in HTTP_TUNNELS could work

ghost commented 5 years ago

Is there a way to use ngrok with -host-header=rewrite?

ptmrio commented 2 years ago

Hey sorry, did I miss something? I followed the setup from the docs but i can't access localhost:4040, nothing comes up. Just to be clear, I do have to install ngrok separately?

Simply edit docker-compose.override.yml, add a few constants to .env, then docker-compose up bind httpd ngrok mysql php and there SHOULD be an interface at port 4040?

Note: sudo lsof -i -P -n | grep LISTEN also does not imply that 4040 is somehow active

Also: is really great to see the devilbox evolve, great work @cytopia

hmontes commented 4 months ago

I have this error on docker

{"err":"Your ngrok-agent version \"2.3.29\" is too old. The minimum supported agent version for your account is \"3.2.0\". Please update to a newer version with ngrok update, by downloading from https://ngrok.com/download, or by updating your SDK version. Paid accounts are currently excluded from minimum agent version requirements. To begin handling traffic immediately without updating your agent, upgrade to a paid plan: https://dashboard.ngrok.com/billing/subscription.\r\n\r\nERR_NGROK_121\r\n","lvl":"eror","msg":"terminating with error","obj":"app","t":"2024-06-29T19:54:12.615341Z"}

Ngrok is outdated