boschkundendienst / guacamole-docker-compose

Guacamole with docker-compose using PostgreSQL, nginx with SSL (self-signed)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

about how to configuration for WOL docker-compose.yml

zukkie777 opened this issue · comments

WakeOnLAN function was released in version 1.2.0.
http://guacamole.apache.org/releases/1.2.0/

But I couldn't get WOL to connect to my computer, with settings using docker-compose.yml.

I created some yml files and tested the connection,
Error was output and the WOL connection could not be established.

Please help me.

Thank you.

about log

my-guacd3 | guacd[56]: ERROR: Error connecting to RDP server
my-guacd3 | guacd[56]: INFO: User "@081184c0-81c8-46c8-9526-95ea69a32785" disconnected (0 users remain)
my-guacd3 | guacd[56]: INFO: Last user of connection "$c7540f4e-4f02-4424-aad2-961cb9ae508d" disconnected
my-guacd3 | guacd[6]: INFO: Connection "$c7540f4e-4f02-4424-aad2-961cb9ae508d" removed.
my-guacamole3 | Exception in thread "Thread-14" java.lang.IllegalStateException: Message will not be sent because the WebSocket session has been closed
my-guacamole3 | at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.writeMessagePart(WsRemoteEndpointImplBase.java:424)
my-guacamole3 | at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendMessageBlock(WsRemoteEndpointImplBase.java:309)
my-guacamole3 | 23:00:42.537 [http-nio-8080-exec-7] INFO o.a.g.tunnel.TunnelRequestService - User "guacadmin" disconnected from connection "3". Duration: 15070 milliseconds
my-guacamole3 | at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendMessageBlock(WsRemoteEndpointImplBase.java:250)
my-guacamole3 | at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendString(WsRemoteEndpointImplBase.java:191)
my-guacamole3 | at org.apache.tomcat.websocket.WsRemoteEndpointBasic.sendText(WsRemoteEndpointBasic.java:37)
my-guacamole3 | at org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint.sendInstruction(GuacamoleWebSocketTunnelEndpoint.java:152)
my-guacamole3 | at org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint.access$200(GuacamoleWebSocketTunnelEndpoint.java:53)
my-guacamole3 | at org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint$2.run(GuacamoleWebSocketTunnelEndpoint.java:253)

If it works with the regular docker file you can get it working with docker-compose. - But, WOL is not something you should expect from my docker-compose setup. You might have to do some additional setup yourself. WOL is not part of my tiny project.

added WOL section to README.MD and linked to the mailinglist entry.

Thanks for comment.
I had updated yml file.

Hi, today I tested to start all containers in network mode host according above post, but did not make it. Actually guacd container sends WOL packets and only his network should be outside the bridge. I think the resolution is more easy. Only guacd container "move" to host network, others containers (guacamole and postgres works in bridge mode). Just tell guacamole to connect guacd by IP -(GUACD_HOSTNAME: {host`s ipaddress}; GUACD_PORT: 4822) and of corse remove links to guacd.

Hi Tonytvbg,
please, can you be more specific. How did you edit your docker-compose.yml?

Here is my compose file. Of course the password and guacd IP must be set properly:
version: '2.0'

networks

create a network 'net' in mode 'bridged'

networks:
net:

services

services:

guacd - this is the container with host network

guacd:
container_name: guacd
image: guacamole/guacd
network_mode: host
restart: always
volumes:
- /opt/guacamole/guacd/drive:/drive:rw
- /opt/guacamole/guacd/record:/record:rw

postgres

postgres:
container_name: postgres
environment:
PGDATA: /var/lib/postgresql/data/guacamole
POSTGRES_DB: guacamole_db
POSTGRES_PASSWORD: 'xxxxxxxxxx'
POSTGRES_USER: guacamole_user
image: postgres:13.4
networks:
net:
restart: always
volumes:
- /opt/guacamole/postgres/init:/docker-entrypoint-initdb.d:ro
- /opt/guacamole/postgres/data:/var/lib/postgresql/data:rw

guacamole

guacamole:
container_name: guacamole
depends_on:
- guacd
- postgres
environment:
GUACD_HOSTNAME: 172.17.0.1 # this is the guacd assigned ip from host. May be the name guacd should works.
GUACD_PORT: 4822
POSTGRES_DATABASE: guacamole_db
POSTGRES_HOSTNAME: postgres
POSTGRES_PASSWORD: 'xxxxxxxxx'
POSTGRES_USER: guacamole_user
GUACAMOLE_HOME: /home/guacamole/home_guac
image: guacamole/guacamole
volumes:
- /opt/guacamole/guacamole/home:/home/guacamole/home_guac
networks:
net:
ports:

enable next line if not using nginx

- 8080:8080/tcp # Guacamole is on :8080/guacamole, not /.

enable next line when using nginx

- 8080/tcp
restart: always

########### optional ##############

nginx

nginx:
container_name: nginx
restart: always
image: nginx
volumes:
- /opt/guacamole/nginx/ssl/self.cert:/etc/nginx/ssl/self.cert:ro
- /opt/guacamole/nginx/ssl/self-ssl.key:/etc/nginx/ssl/self-ssl.key:ro
- /opt/guacamole/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- /opt/guacamole/nginx/mysite.template:/etc/nginx/conf.d/default.conf:ro
ports:
- 8443:443
links:
- guacamole
networks:
net:

run nginx

command: /bin/bash -c "nginx -g 'daemon off;'"

nginx-debug-mode

command: /bin/bash -c "nginx-debug -g 'daemon off;'"

Hi all,

after a lot of tinkering and the help of several ressources on the web, I managed to get a docker setup with usable Wake On LAN.

My biggest help was the info posted by tonytvbg, so thank you mate !

As it took me quite some time to aget everything working, I thought I too would share my compose file here.
It has been working ok on my Synology NAS with the Sync Reverse Proxy (no nginx used in Docker).
I use Portainer and its "Stack" functionality for deployment.

In this first part, I have adapted some steps taken from the prepare.sh script (maybe some commands are not really necessary).

TODO before deploying the stack !!!!!!!! use SSH and root on the NAS !!!!!!

# mkdir /volume1/docker/guacamole/postgres/init >/dev/null 2>&1
# chmod -R +x /volume1/docker/guacamole/postgres/init
# docker run --rm guacamole/guacamole /opt/guacamole/bin/initdb.sh --postgresql > /volume1/docker/guacamole/postgres/init/initdb.sql
# chmod 777 /volume1/docker/guacamole/postgres/init/initdb.sql
# chmod +x /volume1/docker/guacamole/postgres/init/initdb.sql
# mkdir /volume1/docker/guacamole/postgres/data
# mkdir /volume1/docker/guacamole/guacamole/etc
# chmod -R 777 /volume1/docker/guacamole/guacamole/etc
# mkdir /volume1/docker/guacamole/guacamole/home
# chmod -R 777 /volume1/docker/guacamole/guacamole/etc

And here is the compose file with a bit cleaner look compared to the one tonytvbg posted ;-)

version: '2.0'

networks:
  guacnetwork_compose:
    driver: bridge
      
services:

  guacd:
    container_name: guacd_guacamole
    image: guacamole/guacd
    network_mode: "host"
    environment:
      TZ: Europe/Paris
      POSTGRESQL_HOSTNAME: postgres
    restart: always
    ports:
    - 4822:4822/tcp
    volumes:
    - /volume1/docker/guacamole/guacd/drive:/drive:rw
    - /volume1/docker/guacamole/guacd/record:/record:rw
    
  postgres:
    container_name: postgres_guacamole
    environment:
      TZ: Europe/Paris
      PGDATA: /var/lib/postgresql/data/guacamole
      POSTGRESQL_DB: guacamole_db
      POSTGRESQL_HOSTNAME: postgres
      POSTGRESQL_PASSWORD: 'ChooseYourOwnPasswordHere1234'
      POSTGRESQL_USER: guacamole_user
    image: postgres:15.2-alpine
    networks:
      guacnetwork_compose:
    restart: always
    volumes:
    - /volume1/docker/guacamole/postgres/init:/docker-entrypoint-initdb.d:z
    - /volume1/docker/guacamole/postgres/data:/var/lib/postgresql/data:Z

  guacamole:
    container_name: guacamole_guacamole
    depends_on:
    - guacd
    - postgres
    environment:
      TZ: Europe/Paris
      GUACD_HOSTNAME: 172.17.0.1
      GUACD_PORT: 4822
      POSTGRESQL_DATABASE: guacamole_db
      POSTGRESQL_HOSTNAME: postgres
      POSTGRESQL_PASSWORD: 'ChooseYourOwnPasswordHere1234'
      POSTGRESQL_USER: guacamole_user
    image: guacamole/guacamole
    networks:
      guacnetwork_compose:
    ports:
    - 18080:8080/tcp # Guacamole is on :8080/guacamole, not /.
    restart: always
    volumes:
     - /volume1/docker/guacamole/guacamole/etc:/etc/guacamole:rw
     - /volume1/docker/guacamole/guacamole/home:/home/guacamole:rw

I'm really happy now with my setup, I can access different machines remotely without having to keep them on all the time. 👍