Vagrant share can't work in Homestead?

vagrant share can't work in homestead?

  • When I run vagrant share in the ~/Homestead directory where the Vagrantfile exists, a error occur as below saying that only paid plans can share TLS tunnels.
Vagrant Share now defaults to using the `ngrok` driver.
The `classic` driver has been deprecated.

For more information about the `ngrok` driver, please
refer to the documentation:

  https://www.vagrantup.com/docs/share/

==> ohomestead-7: Detecting network information for machine...
    ohomestead-7: Local machine address: 127.0.0.1
    ohomestead-7:
    ohomestead-7: Note: With the local address (127.0.0.1), Vagrant Share can only
    ohomestead-7: share any ports you have forwarded. Assign an IP or address to your
    ohomestead-7: machine to expose all TCP ports. Consult the documentation
    ohomestead-7: for your provider ('virtualbox') for more information.
    ohomestead-7:
    ohomestead-7: Local HTTP port: 44300
    ohomestead-7: Local HTTPS port: 44300
    ohomestead-7: Port: 2209
    ohomestead-7: Port: 27017
    ohomestead-7: Port: 2200
    ohomestead-7: Port: 4040
    ohomestead-7: Port: 44300
    ohomestead-7: Port: 54320
    ohomestead-7: Port: 8000
    ohomestead-7: Port: 8025
==> ohomestead-7: Creating Vagrant Share session...
==> ohomestead-7: Halting Vagrant share!
==> ohomestead-7: TLS tunnels are only available for Pro and Business paid plans.
==> ohomestead-7: Sign up at: https://ngrok.com/signup
==> ohomestead-7:
==> ohomestead-7: If you have already signed up, make sure your authtoken is installed.
==> ohomestead-7: Your authtoken is available on your dashboard: https://dashboard.ngrok.com
==> ohomestead-7:
==> ohomestead-7: ERR_NGROK_303
==> ohomestead-7: session closed
Exiting due to interrupt.
  • But when I run the same command in the directory where the Vagrantfile which based on a non-homestead box, vagrant share can work as before.
Vagrant Share now defaults to using the `ngrok` driver.
The `classic` driver has been deprecated.

For more information about the `ngrok` driver, please
refer to the documentation:

  https://www.vagrantup.com/docs/share/

==> default: Detecting network information for machine...
    default: Local machine address: 127.0.0.1
    default:
    default: Note: With the local address (127.0.0.1), Vagrant Share can only
    default: share any ports you have forwarded. Assign an IP or address to your
    default: machine to expose all TCP ports. Consult the documentation
    default: for your provider ('virtualbox') for more information.
    default:
    default: Local HTTP port: 8888
    default: Local HTTPS port: disabled
    default: Port: 2222
    default: Port: 8888
==> default: Creating Vagrant Share session...
==> default: HTTP URL: http://03bc4468.ngrok.io
==> default:
^C==> default: Halting Vagrant share!


So how to disable the default TLS tunnels in homestead?

  • My intuition was telling me that something was wrong.
  • Try to comment the HTTPS & TLS lines in the nginx.conf and other sites.conf. But it seems to be useless.
  • Reading althrough all the scripts is a time-consuming task and may be unrealistic.


Is there any inspiration from vagrant share?

  • After reading the help of vagrant share, I try like this:
$ vagrant share --disable-https
Vagrant Share now defaults to using the `ngrok` driver.
The `classic` driver has been deprecated.

For more information about the `ngrok` driver, please
refer to the documentation:

  https://www.vagrantup.com/docs/share/

==> my_homestead-7: Detecting network information for machine...
    my_homestead-7: Local machine address: 127.0.0.1
    my_homestead-7:
    my_homestead-7: Note: With the local address (127.0.0.1), Vagrant Share can only
    my_homestead-7: share any ports you have forwarded. Assign an IP or address to your
    my_homestead-7: machine to expose all TCP ports. Consult the documentation
    my_homestead-7: for your provider ('virtualbox') for more information.
    my_homestead-7:
    my_homestead-7: Local HTTP port: 8000
    my_homestead-7: Local HTTPS port: disabled
    my_homestead-7: Port: 2222
    my_homestead-7: Port: 27017
    my_homestead-7: Port: 2200
    my_homestead-7: Port: 4040
    my_homestead-7: Port: 44300
    my_homestead-7: Port: 54320
    my_homestead-7: Port: 8000
    my_homestead-7: Port: 8025
==> my_homestead-7: Creating Vagrant Share session...
==> my_homestead-7: HTTP URL: http://db226f4d.ngrok.io
==> my_homestead-7:

Something strange

  • If you didn't specify the http port, the port will be asigned randomly. So there are something strange happened:
    • port is 44300, you will see the nginx complain plain http request send to HTTPS port.
    • port is 4040, you will meet the jim which is a chaos monkey meaning that something got wrong.

So you'd better to make the port unchangeable as below:

    vagrant share --disable-https --http 8000

How to share my specific site from Multiple sites?

  • I have set up several sites, but the vagrant share plugin always select the site comes first on the list by alphabetical order.
  • I figure out two ways to share my specific site, in the homestead.yaml file:
    • Comment other sites needn't to share, then vagrant reload --provision
    • Name the site need to share to be ordered on the top alphabetically.
本作品采用《CC 协议》,转载必须注明作者和本文链接
日拱一卒
《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!
未填写
文章
92
粉丝
87
喜欢
152
收藏
121
排名:72
访问:11.3 万
私信
所有博文
社区赞助商