francescou / docker-compose-ui

web interface for Docker Compose
http://francescou.github.io/docker-compose-ui
MIT License
1.54k stars 228 forks source link

Updated README about the use of web console #92

Closed kesonno closed 7 years ago

kesonno commented 7 years ago

Please note: in the example I refer to 1.7 version of francescou/docker-compose-ui image that of course don't support yet this feature.

francescou commented 7 years ago

I think it would be nice to add the bitbull/docker-exec-web-console service to the docker-compose.yml. To do so, it should be possible to define a CONTEXT_PATH environment to the bitbull/docker-exec-web-console container.

version: "2"

services:
    docker_compose_ui:
        image: francescou/docker-compose-ui:latest
        restart: always
        container_name: docker_compose_ui
        hostname: docker_compose_ui
        ports:
            - 5000:5000
        working_dir: /opt/docker-compose-projects/
        environment:
        - 'WEB_CONSOLE_PATTERN=/web-console/?cid={containerName}&cmd={command}'
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock
    web_console:
        image: bitbull/docker-exec-web-console:context
        read_only: true
        restart: always
        environment:
        - 'CONTEXT_PATH=/web-console/'
        volumes:
        - /var/run/docker.sock:/var/run/docker.sock
    nginx:
        image: nginx:alpine
        read_only: true
        restart: always
        ports:
        - 8080:80
        volumes:
        - ./default.conf:/etc/nginx/conf.d/default.conf:ro
        - /var/cache/nginx/
        - /var/run/
        - /logs/
server {
    listen       80;
    server_name  localhost;

    access_log  /logs/host.access.log  main;

    location / {
      proxy_pass http://docker_compose_ui:5000;
    }

    location /web-console/ {
      proxy_pass http://web_console:8888;
    }

    location /web-console/exec {
        proxy_pass http://web_console:8888;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

}
kesonno commented 7 years ago

Good suggestion! I've updated the bitbull/docker-exec-web-console to support the CONTEXT_PATH env var, and your above example just works :) (need only to be changed the tag for the web_console service image from "context" to "latest").

If it's ok for you, I'll update the PR including the change to docker-compose.yml.