Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Support for external web console #91

Merged

Conversation

kesonno
Copy link
Contributor

@kesonno kesonno commented Aug 2, 2017

Hi all!

I know that this topic was previously discussed several times ( #4 and #83 ).

This is my proposal for add the capability to start a shell inside the container. The basic idea is to decouple the console from the rest of UI, making it possible for the user to choose witch web console to use. This is based on our experience: so far we used docker-compose-ui together with our websocket-based console in a manual fashion, and want to integrate the two but without coupling them, mostly because the server part of our console is written in Go.

The only requirement for a web console is to support passing the container id (or name) and the command to exec as querystring parameters, for eg. with our web console you can call http://localhost:8888/?cid={containerName}&cmd={command}.

Then, you can pass the WEB_CONSOLE_PATTERN environment var to docker-compose-ui, that hold the pattern that will be used to build the url to load the console. Such pattern should include the {containerName} and {command} placeholders.

You can try the final result with this docker-compose.yml:

version: '3.0'
services:
    docker_compose_ui:
        restart: always
        image: bitbull/docker-compose-ui:latest
        environment:
            - WEB_CONSOLE_PATTERN=http://localhost:8888/?cid={containerName}&cmd={command}
        container_name: docker_compose_ui
        ports:
            - 5000:5000
        working_dir: /opt/docker-compose-projects/
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock

    docker-exec-web-console:
        restart: always
        image: bitbull/docker-exec-web-console
        container_name: docker_exec_web_console
        ports:
            - 8888:8888
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock

Let me know what you think about this solution! I mention even @MichaelMackus because I've seen he's interested in the topic and he already started experimenting other solution.

Regards
Gennaro

@kesonno
Copy link
Contributor Author

kesonno commented Aug 2, 2017

Oh, I forgot to mention that in this PR there are even a couple of small global improvement:

  • I've split the copy of files inside the image, so that the virtualenv creation and requirement installation are cached separately and not are run again if only the frontend app or main.py will change
  • I've added a Dockerfile-dev that mount the local folder as volume, so is possible to see changes on the frontend app w/out needs for rebuild every time the image

@francescou francescou merged commit e6c57d6 into francescou:master Aug 2, 2017
@francescou
Copy link
Owner

Excellent job.
I plan to apply some minor changes before the next release.

Thank you for your contribution!

@kesonno kesonno deleted the feature/support-for-web-console branch August 2, 2017 22:17
@MichaelMackus
Copy link
Contributor

Nice job @kesonno ! I like the ease of swapping out web console implementations, good idea.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants