I run consul server in a docker container using this command
docker -H 10.100.10.103:2375 run -d --name=consul3 --net=host gliderlabs/consul-server -bootstrap -advertise 10.100.10.103 -ui-dir /ui
Consul rest api works fine:
curl localhost:8500/v1/catalog/services -v
* About to connect() to localhost port 8500 (#0)
* Trying ::1...
* Connected to localhost (::1) port 8500 (#0)
> GET /v1/catalog/services HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:8500
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< X-Consul-Index: 282
< X-Consul-Knownleader: true
< X-Consul-Lastcontact: 0
< Date: Mon, 11 Apr 2016 10:06:08 GMT
< Content-Length: 1391
<....
Instead if I try a request at web UI respond with 404:
curl 127.0.0.1:8500/ui/ -v
* About to connect() to 127.0.0.1 port 8500 (#0)
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8500 (#0)
> GET /ui/ HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 127.0.0.1:8500
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
< Date: Mon, 11 Apr 2016 10:10:15 GMT
< Content-Length: 19
<
404 page not found
* Connection #0 to host 127.0.0.1 left intact
I get the exact same error but without using docker.
Here is my config file:
{
"bootstrap": false,
"server": false,
"datacenter": "dc1",
"data_dir": "/var/consul",
"ui_dir": "/home/vagrant/dist",
"encrypt": "Dt3P9SpKGAR/DIUN1cDirg==",
"log_level": "INFO",
"enable_syslog": true,
"ui": true,
"bind_addr": "172.20.20.40",
"client_addr": "172.20.20.40",
"addresses": {
"http": "0.0.0.0"
},
"start_join": ["172.20.20.10", "172.20.20.20", "172.20.20.30"]
}
here is the log of the only consul client I have ( I have 3 other consul server running )
I try to run the ui on the client
==> consulclient: Archive: consul_0.6.4_linux_amd64.zip
==> consulclient: inflating: consul
==> consulclient: ==> Starting Consul agent...
==> consulclient: ==> Starting Consul agent RPC...
==> consulclient: ==> Joining cluster...
==> consulclient: Join completed. Synced with 3 initial agents
==> consulclient: ==> Consul agent running!
==> consulclient: Node name: 'consulclient'
==> consulclient: Datacenter: 'dc1'
==> consulclient: Server: false (bootstrap: false) [9/4692]
==> consulclient: Client Addr: 172.20.20.40 (HTTP: 8500, HTTPS: -1, DNS: 8600, RPC: 8400)
==> consulclient: Cluster Addr: 172.20.20.40 (LAN: 8301, WAN: 8302)
==> consulclient: Gossip encrypt: true, RPC-TLS: false, TLS-Incoming: false
==> consulclient: Atlas: <disabled>
==> consulclient:
==> consulclient: ==> Log data will now stream in as it occurs:
==> consulclient:
==> consulclient: 2016/04/17 10:42:02 [INFO] serf: EventMemberJoin: consulclient 172.20.20.40
==> consulclient: 2016/04/17 10:42:02 [INFO] agent: (LAN) joining: [172.20.20.10 172.20.20.20 172.20.20.30]
==> consulclient: 2016/04/17 10:42:02 [INFO] serf: EventMemberJoin: consul1 172.20.20.10
==> consulclient: 2016/04/17 10:42:02 [INFO] serf: EventMemberJoin: consul2 172.20.20.20
==> consulclient: 2016/04/17 10:42:02 [INFO] consul: adding server consul1 (Addr: 172.20.20.10:8300) (DC: dc1)
==> consulclient: 2016/04/17 10:42:02 [INFO] serf: EventMemberJoin: consul3 172.20.20.30
==> consulclient: 2016/04/17 10:42:02 [INFO] consul: adding server consul2 (Addr: 172.20.20.20:8300) (DC: dc1)
==> consulclient: 2016/04/17 10:42:02 [INFO] consul: adding server consul3 (Addr: 172.20.20.30:8300) (DC: dc1)
==> consulclient: 2016/04/17 10:42:02 [INFO] agent: (LAN) joined: 3 Err: <nil>
==> consulclient: 2016/04/17 10:42:02 [INFO] agent: Synced node info
@matteoturra is the /ui directory available inside the container? That looks like it may be the issue there. Also, if this is running Consul after 0.6.1 you should just be able to use -ui and it will use the built-in web assets, so no -ui-dir should be required.
@casertap the same should work for you since you are running Consul 0.6.4. If you remove -ui_dir and just leave -ui it should fix the 404.
Hope that helps! I'll close for now but please let me know if this doesn't fix the issue.
@slackpad is there any docs around -ui-dir and -ui combo? I just ran into this with the latest version of consul and couldn't figure out the issue for the life of me.
Hi @chiefy we should make Consul error out (and update the docs) so it's super clear - https://github.com/hashicorp/consul/issues/2576.
Most helpful comment
@matteoturra is the /ui directory available inside the container? That looks like it may be the issue there. Also, if this is running Consul after 0.6.1 you should just be able to use
-uiand it will use the built-in web assets, so no-ui-dirshould be required.@casertap the same should work for you since you are running Consul 0.6.4. If you remove
-ui_dirand just leave-uiit should fix the 404.Hope that helps! I'll close for now but please let me know if this doesn't fix the issue.