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

Rework fin share as part of project #1046

Open
sean-e-dietrich opened this issue May 2, 2019 · 2 comments · May be fixed by #1048
Open

Rework fin share as part of project #1046

sean-e-dietrich opened this issue May 2, 2019 · 2 comments · May be fixed by #1048
Assignees
Labels
🏷new feature size/small Effort in T-Shirt scale

Comments

@sean-e-dietrich
Copy link
Member

Docker is deprecating the --link argument and is recommended to create specific networks and add that container to the network.

Find out way to implement Ngrok on a project level

@sean-e-dietrich sean-e-dietrich added 🏷new feature size/small Effort in T-Shirt scale labels May 2, 2019
@sean-e-dietrich sean-e-dietrich linked a pull request May 2, 2019 that will close this issue
@sean-e-dietrich sean-e-dietrich self-assigned this May 2, 2019
@achekulaev
Copy link
Member

For reference

The --link flag is a legacy feature of Docker.
It may eventually be removed.
https://docs.docker.com/network/links/

@lmakarov lmakarov added this to To do in Docksal 1.13.0 via automation Oct 7, 2019
@lmakarov
Copy link
Member

lmakarov commented Oct 7, 2019

@sean-e-dietrich looking at the #1048 PR, I think it will be better to add ngrok as a real project service instead of mimicking a project service. The approach would be similar to the way IDE is turned on/off.

$ fin config set NGROK_ENABLED=1
$ fin up

# Alternatively, wrap the variable settings in a nice command, which could also output the resulting URL parsed from container logs
$ fin share on
$ fin share off

NGROK_ENABLED=1 would instruct fin to include ~/.docksal/stacks/overrides-share.yml:

# Adds ngrok to project stack
# ngrok Web UI can be accessed via ide-${VIRTUAL_HOST}

version: "2.1"

services:

  share:
    extends:
      file: ${HOME}/.docksal/stacks/services.yml
      service: ngrok

The new ngrok service in services.yml:

  share:
    image: wernight/ngrok
    hostname: ngrok
    labels:
      # ngrok Web UI
      - io.docksal.virtual-host=ngrok-${VIRTUAL_HOST},ngrok-${VIRTUAL_HOST}.*
    command: ["sh", "-c", "ngrok http -host-header=${VIRTUAL_HOST} -log stdout web:80"]
    dns:
      - ${DOCKSAL_DNS1}
      - ${DOCKSAL_DNS2}
$ fin ps
Key 'id_ecdsa' already loaded in the agent. Skipping.
Key 'id_rsa' already loaded in the agent. Skipping.
    Name                  Command                  State                 Ports           
-----------------------------------------------------------------------------------------
demo_cli_1     /opt/startup.sh supervisord      Up (healthy)   22/tcp, 3000/tcp, 9000/tcp
demo_db_1      docker-entrypoint.sh mysqld      Up (healthy)   0.0.0.0:32783->3306/tcp   
demo_share_1   sh -c ngrok http -host-hea ...   Up             4040/tcp                  
demo_web_1     httpd-foreground                 Up (healthy)   443/tcp, 80/tcp
$ fin logs share
Attaching to demo_share_1
share_1  | t=2019-10-07T22:40:02+0000 lvl=info msg="no configuration paths supplied"
share_1  | t=2019-10-07T22:40:02+0000 lvl=info msg="using configuration at default config path" path=/home/ngrok/.ngrok2/ngrok.yml
share_1  | t=2019-10-07T22:40:02+0000 lvl=info msg="open config file" path=/home/ngrok/.ngrok2/ngrok.yml err=nil
share_1  | t=2019-10-07T22:40:02+0000 lvl=info msg="starting web service" obj=web addr=0.0.0.0:4040
share_1  | t=2019-10-07T22:40:03+0000 lvl=info msg="tunnel session started" obj=tunnels.session
share_1  | t=2019-10-07T22:40:03+0000 lvl=info msg="client session established" obj=csess id=10f0c212385b
share_1  | t=2019-10-07T22:40:03+0000 lvl=info msg="started tunnel" obj=tunnels name="command_line (http)" addr=http://web:80 url=http://f7dc7778.ngrok.io
share_1  | t=2019-10-07T22:40:03+0000 lvl=info msg="started tunnel" obj=tunnels name=command_line addr=http://web:80 url=https://f7dc7778.ngrok.io
share_1  | t=2019-10-07T22:40:03+0000 lvl=info msg="update available" obj=updater
share_1  | t=2019-10-07T22:40:03+0000 lvl=info msg=start pg=/grpc/rpx.ClientWeb/State id=2021fe38ca474a12

Another benefit of this approach is that ngrok can now just run in the background as any other project service.

This is just a starting point and other settings would need to be ported over.

Looking at the ngrok image we are using, pretty much everything can be passed as an environment variable.

@lmakarov lmakarov added this to To do in 1.14.0 via automation Oct 22, 2019
@lmakarov lmakarov removed this from To do in Docksal 1.13.0 Oct 22, 2019
@lmakarov lmakarov removed this from To do in 1.14.0 Jul 2, 2020
@lmakarov lmakarov added this to To do in 1.15.0 via automation Jul 2, 2020
@lmakarov lmakarov removed this from To do in 1.15.0 Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷new feature size/small Effort in T-Shirt scale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants