diff --git a/.env.docker b/.env.docker new file mode 100644 index 0000000..fa095ae --- /dev/null +++ b/.env.docker @@ -0,0 +1,10 @@ +UI_USER=admin +UI_PASSWORD=admin +ETCD_NODES="http://etcd:2379" +ETCD_ADMIN_USER= +ETCD_ADMIN_PASSWORD= +# SSL_KEY=./ssl/key.pem +# SSL_CA=./ssl/ca.pem +# SSL_CERT=./ssl/cert.pem +# LOG_DIR_PATH=logs +ETCD_TIMEOUT=1 \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..7e30593 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,26 @@ +version: '2' + +networks: + app-tier: + driver: bridge + +services: + Etcd: + image: 'bitnami/etcd:latest' + environment: + - ALLOW_NONE_AUTHENTICATION=yes + - ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379 + ports: + - 2379:2379 + - 2380:2380 + networks: + - app-tier + myapp: + image: 'etcd-ui:local' + volumes: + - ./ssl:/app/ssl:ro + - ./.env.docker:/app/.env:ro + ports: + - 8080:8080 + networks: + - app-tier diff --git a/internal/controllers/cluster/stats.go b/internal/controllers/cluster/stats.go index b667001..e6cddfd 100644 --- a/internal/controllers/cluster/stats.go +++ b/internal/controllers/cluster/stats.go @@ -57,11 +57,12 @@ func clusterIndex(c echo.Context) error { code, "cluster/stats.html", map[string]interface{}{ - "Title": "Cluster Stats", - "Error": utils.ErrorMessage(err), - "Items": members, - "Alarms": alarms, - "Header": stats, + "Title": "Cluster Stats", + "Error": utils.ErrorMessage(err), + "Items": members, + "SingleNode": len(members) == 1, + "Alarms": alarms, + "Header": stats, }, ) } diff --git a/templates/cluster/stats.html b/templates/cluster/stats.html index d919c3c..a443a80 100644 --- a/templates/cluster/stats.html +++ b/templates/cluster/stats.html @@ -55,6 +55,7 @@

Cluster Members

+ {{$singleNode := .data.SingleNode}} {{range $item := .data.Items}} {{ $item.Name }} @@ -64,7 +65,11 @@

Cluster Members

{{ $item.Health.Version }} {{ $item.Health.DBSize }} + {{if $singleNode}} + {{ hex $item.ID }} + {{else}} {{ hex $item.ID }} (elect as leader) + {{end}} {{ end }} diff --git a/templates/users/add-roles.html b/templates/users/add-roles.html index 0721dde..e596ea1 100644 --- a/templates/users/add-roles.html +++ b/templates/users/add-roles.html @@ -47,7 +47,7 @@

{{.data.Title}} for {{.data.Item.Name}}

- {{$item}} + {{$item}} {{ end }} diff --git a/templates/users/create.html b/templates/users/create.html index b787e9d..5937db8 100644 --- a/templates/users/create.html +++ b/templates/users/create.html @@ -30,7 +30,7 @@

{{.data.Title}}

placeholder="Username" autofocus minlength="2" - name="key" + name="name" maxlength="256"> diff --git a/templates/users/info.html b/templates/users/info.html index 31d2fb2..4b6150f 100644 --- a/templates/users/info.html +++ b/templates/users/info.html @@ -47,7 +47,7 @@

{{.data.Title}}

- {{$item}} + {{$item}} {{ end }}