Giter Site home page Giter Site logo

cuigh / swirl Goto Github PK

View Code? Open in Web Editor NEW
588.0 24.0 78.0 9.29 MB

A web UI for Docker, focused on swarm cluster.

License: MIT License

TypeScript 12.37% Go 50.38% Dockerfile 0.07% HTML 0.05% Vue 37.06% CSS 0.07%
docker docker-swarm moby docker-compose swirl docker-image docker-container docker-ui docker-web-management

swirl's Introduction

SWIRL

Docker Pulls Swirl

Swirl is a web management tool for Docker, focused on swarm cluster.

Warning: v1.0+ is not fully compatible with previous versions, it is recommended to redeploy instead of upgrading directly.

Features

  • Swarm components management
  • Image and container management
  • Compose management with deployment support
  • Service monitoring based on Prometheus and cadvisor
  • Service auto scaling
  • LDAP authentication support
  • Full permission control based on RBAC model
  • Scale out as you want
  • Multiple language support
  • And more...

Snapshots

Home

Home

Service list

Service list

Service stats

Service stats

Stack list

Stack list

Settings

Setting

Configuration

With config file

All options can be set with config/app.yml.

name: swirl
banner: false

web:
  entries:
    - address: :8002
  authorize: '?'

swirl:
  db_type: mongo
  db_address: mongodb://localhost:27017/swirl
#  token_expiry: 30m
#  docker_api_version: '1.41'
#  docker_endpoint: tcp://docker-proxy:2375

log:
  loggers:
  - level: info
    writers: console
  writers:
  - name: console
    type: console
    layout: '[{L}]{T}: {M}{N}'

With environment variables

Only these options can be set by environment variables for now.

Name Value
DB_TYPE mongo(default),bolt
DB_ADDRESS mongodb://localhost:27017/swirl
TOKEN_EXPIRY 30m
DOCKER_ENDPOINT tcp://docker-proxy:2375
DOCKER_API_VERSION 1.41

With swarm config

Docker support mounting configuration file through swarm from v17.06, so you can store your config in swarm and mount it to your program.

Deployment

Swirl support two storage engines now: mongo and bolt. bolt is suitable for development environment, Swirl can only deploy one replica if you use bolt storage engine.

Standalone

Just copy the swirl binary and config directory to the host, and run it.

./swirl

Docker

  • Use bolt storage engine
docker run -d -p 8001:8001 \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v /data/swirl:/data/swirl \
    -e DB_TYPE=bolt \
    -e DB_ADDRESS=/data/swirl \
    --name=swirl \
    cuigh/swirl
  • Use MongoDB storage engine
docker run -d -p 8001:8001 \
    --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
    -e DB_TYPE=mongo \
    -e DB_ADDRESS=mongodb://localhost:27017/swirl \
    --name=swirl \
    cuigh/swirl

Docker swarm

  • Use bolt storage engine
docker service create \
  --name=swirl \
  --publish=8001:8001/tcp \
  --env DB_TYPE=bolt \
  --env DB_ADDRESS=/data/swirl \
  --constraint=node.hostname==manager1 \
  --mount=type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
  --mount=type=bind,src=/data/swirl,dst=/data/swirl \
  cuigh/swirl
  • Use MongoDB storage engine
docker service create \
  --name=swirl \
  --publish=8001:8001/tcp \
  --env DB_ADDRESS=mongodb://localhost:27017/swirl \
  --constraint=node.role==manager \
  --mount=type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
  cuigh/swirl

Docker compose

docker stack deploy -c compose.yml swirl

Advanced features

Swirl use service labels to support some features, the labels in the table below are currently supported.

Name Description Examples
swirl.scale Service auto scaling min=1,max=5,cpu=30:50

Build

To build Swirl from source, you need yarn and go(v1.16+) installed.

$ cd ui 
$ yarn
$ yarn build
$ cd ..
$ go build

License

This product is licensed to you under the MIT License. You may not use this product except in compliance with the License. See LICENSE and NOTICE for more information.

swirl's People

Contributors

cuigh avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swirl's Issues

在swirl中创建表格失败

您好,想向你请教关于在swirl中 创建表格问题。

我创建的表格显示是空白,如下:

KX%{`P N%0Z7UD9X4 OTIHY

这两个空格的仪表盘表达式参考的是您的这个配置:

VF68JRQXXRO6I{~GNAX_7
C)YDM6SV 8O6@E}DET@TR N

我的设置如下(启动普罗米修斯后有重启整个服务):
image

普罗米修斯的页面如下:
image

感谢您耐心的阅读,麻烦您看下这个问题该如何解决

Issue: Cannot connect to the Docker daemon at unix:///var/run/docker.sock.

Hi,

I am getting the following message in my browser after I login to Swirl: "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"

Could provide my with advise or direction what I am missing or doing wrong?

Below is my docker-compose file section for starting Swirl and MongoDB:

` swirl:
image: cuigh/swirl
container_name: swirl
depends_on:
- mongo
ports:
- 8001:8001
environment:
# - DB_TYPE=bolt
- PGID=998
- DB_ADDRESS=/data/swirl
- DB_ADDRESS=mongo:27017/swirl # - DB_ADDRESS=/data/swirl
# - RESCRAMBLE=true
security_opt:
- apparmor:unconfined
- seccomp:unconfined
volumes:
- /var/run/docker.sock,dst=/var/run/docker.sock
- /var/lib/docker/:/var/lib/docker:ro
- /path/swirl/data=/data/swirl
networks:
- web
- net
deploy:
# privileged: true
mode: replicated
replicas: 1
update_config:
order: start-first # get new container running first before removing old, for less downtime
rollback_config:
order: start-first # get new container running first before removing old, for less downtime
placement:
constraints:
- node.role==manager

mongo:
image: mongo
volumes:
- /path/mongo/data:/data/db
networks:
- net
deploy:
mode: replicated
replicas: 1
update_config:
order: start-first # get new container running first before removing old, for less downtime
rollback_config:
order: start-first # get new container running first before removing old, for less downtime

placement:

constraints: [node.hostname == mongo]`

Thank you in advance.
Regards,
Angelo

Can't edit stack file

Whenever I want to edit the stack file (type input) this error pops up.
I'm using version v1.0.0rc2.

image

swirl behind traefik?

I was wondering if anyone ever tried using swirl behind traefik, as I have not found a way to make it work with a base path other than / as the ui has all the references pointing to that.

This is the traefik config I'm trying to use:

    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.http.routers.swirl.entrypoints=https"
        - "traefik.http.routers.swirl.tls=true"
        - "traefik.http.services.swirl.loadbalancer.server.port=8001"
        - "traefik.http.routers.swirl.rule=PathPrefix(`/swirl`)"
        - "traefik.http.routers.swirl.middlewares=swirl-stripprefix"
        - "traefik.http.middlewares.swirl-stripprefix.stripprefix.prefixes=/swirl"
        - "traefik.http.middlewares.swirl-stripprefix.stripprefix.forceslash=true"

部分任务无法移除

image
服务已经移除了 但是任务还在 处于pending状态 而且点击服务是不存在的
image

[Bug] Creating a username does not work properly for non-admin

When creating a new user without admin role, information about the password is lost, making it impossible to login.

scanario:
Create a new user by api without admin role.

/api/user/save
{
    "type": "internal",
    "admin": false,
    "name": "Jon Doe",
    "loginName": "test",
    "password": "xxx",
    "passwordConfirm": "xxx",
    "email": "[email protected]",
    "roles": [
        "rolaxxx"
    ]
}

try logging in with your new credentials

api/user/sign-in
{"name":"test","password":"xxx"}

the response will be:

security: invalid principal or credential(1001)

[FIX] This is a fix for this case. The principle is the same as for creating a new admin account.
api/user.go:73

return func(c web.Context) error {
		args := &struct {
			Password string `json:"password"`
			*dao.User
		}{}
		err := c.Bind(args, true)
		if err == nil {
			ctx, cancel := misc.Context(defaultTimeout)
			defer cancel()

			user := args.User
			if user.ID == "" {
				user.Password = args.Password
				_, err = b.Create(ctx, user, c.User())
			} else {
				err = b.Update(ctx, user, c.User())
			}
		}
		return ajax(c, err)
}

arm image?

I would love to run swirl on my raspberry pi's

invalid mount config for type "bind": bind source path does not exist: /data/swirl

Hello,

I am doing a swarm deployment of Swirl. My swirl tasks get rejected with this message: invalid mount config for type "bind": bind source path does not exist: /data/swirl using the following compose.yml.

version: '3.3'
services:
  manager_agent:
    image: cuigh/socat:latest
    volumes:
     - /var/run/docker.sock:/var/run/docker.sock
    networks:
     - default
    logging:
      driver: json-file
    deploy:
      mode: global
      placement:
        constraints:
         - node.role == manager
  mongo-express:
    image: mongo-express:latest
    environment:
      ME_CONFIG_MONGODB_URL: mongodb://mongodb:27017/
    ports:
     - 7081:8081
    networks:
     - default
    logging:
      driver: json-file
  mongodb:
    image: mongo:latest
    networks:
     - default
    logging:
      driver: json-file
  swirl:
    image: cuigh/swirl:latest
    environment:
      AGENTS: swirl_manager_agent,swirl_worker_agent
      DB_ADDRESS: mongodb://mongodb:27017/swirl
      DB_TYPE: mongo
      DOCKER_ENDPOINT: tcp://swirl_manager_agent:2375
    ports:
     - 8001:8001
    networks:
     - default
    logging:
      driver: json-file
    deploy:
      placement:
        constraints:
         - node.role == worker
  worker_agent:
    image: cuigh/socat:latest
    volumes:
     - /var/run/docker.sock:/var/run/docker.sock
    networks:
     - default
    logging:
      driver: json-file
    deploy:
      mode: global
      placement:
        constraints:
         - node.role == worker
networks:
  default:
    driver: overlay

I also noticed there are no clear instructions on how to supply database credentials, am I going to be prompted for those in the UI once I get it running?

Thank you very much.

请问auto scale的配置问题

你好,不好意思还要麻烦一下,我按照readme中的所说的service label的方式配置了一个测试nginx,stack是这样的:

`version: '3.6'
services:

nginx:
image: nginx:latest
environment:
- TZ=Asia/Shanghai
deploy:
labels:
swirl.scale: swirl.scale=min=1,max=5,cpu=20:50
restart_policy:
condition: on-failure
resources:
limits:
cpus: "0.01"
memory: 200M
update_config:
parallelism: 1 # 每次更新1个副本
delay: 5s # 每次更新间隔
monitor: 10s # 单次更新多长时间后没有结束则判定更新失败
max_failure_ratio: 0.1 # 更新时能容忍的最大失败率
order: start-first # 更新顺序为新任务启动优先

ports:
- 18081:80`

但是在后面的压测中,一直没有看到这个service进行scale的动作,请问是哪里配置有问题吗?谢谢!

Sample Dashbords?

I notice there is a way to import dashboards. Can we provide/supply some samples or defaults baked in?

请问如何成功指定 --constraint 'node.role == worker'

您好,我的swarm测试集群是1manager+2worker,
因为有--mount="type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock" ,我理解的是创建swirl服务必须在manager上执行。
想请教您一下 --constraint 'node.role == worker' 是怎么实现的?

Add option/environment var to disable auth

Some of us run reverse proxies with middleware that take care of authentication.
It would be nice if we could disable authentication or have a way to bypass the login.
I think LDAP would be kind of overkill for my setup to provide a somewhat unified login experience so it would be nice if I could disable the login functionality.

(maybe an option to disable the expiration of the session cookie so I can just pass it along as a request header to the host?)

Question: Autonomous scaler

Hello,

Did you think it's possible to extract the Scaler part as an autonomous application ??
The idea is brilliant.

Best regards

runtime error: index out of range

[E]2019-03-01 08:31:07.741: PANIC: runtime error: index out of range, stack: goroutine 2802 [running]:
github.com/cuigh/auxo/net/web/filter.(*Recover).Apply.func2.1(0xc0000255d0, 0xc000396d00, 0xc7eca0, 0xc000360480)
	/go/pkg/mod/github.com/cuigh/[email protected]/net/web/filter/recover.go:46 +0x117
panic(0xad7ee0, 0x10e7750)
	/usr/local/go/src/runtime/panic.go:513 +0x1b9
github.com/cuigh/swirl/model.NewServiceInfo(0xc0003ba980, 0x19, 0x1ee24, 0x32cc0638, 0xed40ae4ae, 0x0, 0x33b59f6d, 0xed40ae4ae, 0x0, 0xc000417240, ...)
	/go/src/github.com/cuigh/swirl/model/docker.go:279 +0x1b82
github.com/cuigh/swirl/biz/docker.ServiceCommand(0xc000312ded, 0xb, 0x1, 0x1, 0x1, 0x0)
	/go/src/github.com/cuigh/swirl/biz/docker/service.go:604 +0x213
github.com/cuigh/swirl/controller.serviceDetail(0xc7eca0, 0xc000360480, 0xc0003cb560, 0xad2f84)
	/go/src/github.com/cuigh/swirl/controller/service.go:100 +0x578
github.com/cuigh/swirl/security.Permiter.func1(0xc7eca0, 0xc000360480, 0xc702a0, 0xc0000569c0)
	/go/src/github.com/cuigh/swirl/security/perm.go:30 +0xb0
github.com/cuigh/auxo/net/web/filter.(*Authorizer).Apply.func1(0xc7eca0, 0xc000360480, 0xc000360480, 0xc000312e27)
	/go/pkg/mod/github.com/cuigh/[email protected]/net/web/filter/authorizer.go:74 +0x733
github.com/cuigh/auxo/net/web/filter/auth.(*Form).Apply.func1(0xc7eca0, 0xc000360480, 0xc0000255d0, 0xc000396d00)
	/go/pkg/mod/github.com/cuigh/[email protected]/net/web/filter/auth/form.go:138 +0x7f
github.com/cuigh/auxo/net/web/filter.(*Recover).Apply.func2(0xc7eca0, 0xc000360480, 0x0, 0x0)
	/go/pkg/mod/github.com/cuigh/[email protected]/net/web/filter/recover.go:54 +0x91
github.com/cuigh/auxo/net/web.(*Server).execute(0xc000364000, 0xc000360480, 0xc702e0, 0xc0003a6740)
	/go/pkg/mod/github.com/cuigh/[email protected]/net/web/server.go:356 +0xc7
github.com/cuigh/auxo/net/web.(*Server).ServeHTTP(0xc000364000, 0xc6f320, 0xc0002ff500, 0xc00029cc00)
	/go/pkg/mod/github.com/cuigh/[email protected]/net/web/server.go:317 +0x13a
net/http.serverHandler.ServeHTTP(0xc00033c8f0, 0xc6f320, 0xc0002ff500, 0xc00029cc00)
	/usr/local/go/src/net/http/server.go:2741 +0xab
net/http.(*conn).serve(0xc000286d20, 0xc6ffe0, 0xc0002fbfc0)
	/usr/local/go/src/net/http/server.go:1847 +0x646
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:2851 +0x2f5

提几个功能上的需求

  1. 日志的实时展示
  2. 多服务日志展示
  3. 服务内部命令执行

最近正好在学习Go相关的内容 有时间的话我自己也会试着写写看 提交PR

请问什么时候推出release版?

作者你好
我们的企业用户需要自己运维docker,k8s有翻墙问题,对这个工具很感兴趣。
这是你们在生产上使用了吗?

I am utterly confused by the compose instructions.

I am a little confused by the instructions and have been unable to get this working. I am unclear if i have hit an issue, didn't read something i should have (like manually creating databases and users)?

I am trying to deploy in a swarm using mongodb, i am unclear if mongodb is in the docker image or not?
I have tried both of the following:

  • assuming mongodb is in the image
  • assuming i need separate mongodb

(note i have never used mongodb before)
for approach #1 above

panic: failed to load storage engine: no reachable servers

as such i believe there to be no mondodb server running in the container

for approach #2 above mycompose is further below, when swirl tries to connect to the mongodb it results in this if the db path ends in /swirl

panic: failed to load storage engine: server returned error on SASL authentication step: Authentication failed.

if it doesn't end in /swirl i get

panic: failed to load storage engine: server returned error on SASL authentication step: BSON field 'saslContinue.mechanism' is an unknown field.

compose file:

version: '3.8'

services:
  swirl:
    image: cuigh/swirl
    environment:
      DB_TYPE: mongo
      DB_ADDRESS: mongodb://mongoroot:password@mongodb:27017/swirl
      DOCKER_ENDPOINT: tcp://swirl_manager_agent:2375
      AGENTS: swirl_manager_agent,swirl_worker_agent
    ports:
      - 8001:8001
    deploy:
      replicas: 1
      placement:
        constraints: [ node.role == worker ]

  manager_agent:
    image: cuigh/socat
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    deploy:
      mode: global
      placement:
        constraints: [ node.role == manager ]

  worker_agent:
    image: cuigh/socat
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    deploy:
      mode: global
      placement:
        constraints: [ node.role == worker ]
        
  mongodb:
    image: mongo
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME: mongoroot
      MONGO_INITDB_ROOT_PASSWORD: password

  mongo-express:
    image: mongo-express
    restart: always
    ports:
      - 7081:8081
    environment:
      ME_CONFIG_MONGODB_ADMINUSERNAME: mongoroot
      ME_CONFIG_MONGODB_ADMINPASSWORD: password
      ME_CONFIG_MONGODB_URL: mongodb://mongoroot:password@mongodb:27017/      

note my mongo-express service connects with no issues to the database.

最新代码登录失败

昨天克隆仓库后直接docker build,首先是用bolt类型的数据库,然后容器启动失败,日志报
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xa75e18]

goroutine 1 [running]:
github.com/boltdb/bolt.(*Bucket).ForEach(0xc00032a2b8, 0xc00025f038)
/go/pkg/mod/github.com/boltdb/[email protected]/bucket.go:385 +0x18

然后换mongodb,这是我两个容器的启动参数

docker run --name mongo -d -p 27017:27017 mongo
docker run -d -p 80:8001
-v /var/run/docker.sock:/var/run/docker.sock
-e DB_TYPE=mongo
-e DB_ADDRESS=mongodb://192.168.3.70:27017/swirl
--name=swirl
swirl:test-v1

换mongo之后启动成功了,并且Web页面能进入,但是在设置登录名跟密码之后登录失败。
Q6RJUY } JHE(~A)WZKIH
Q}3%PY5I50O 11~O_5__J R
密码设置的123456,登录失败,swirl容器也查不到详细的日志。

deploy stack can't auto create network

image

version: "3"

services:
  theia:
    image: miaowoo/theia:next
    ports:
      - 8008:3000
    environment:
      GOPROXY: https://goproxy.io
    volumes:
      - theia:/home/project
volumes:
  theia:
    driver_opts:
      type: nfs4
      o: addr=192.168.2.219,rw
      device: ":/home/app/nfs/docker/theia"

查看日志提示错误

error from daemon in stream: Error grabbing logs: rpc error: code = Unknown desc = warning: incomplete log stream. some logs could not be retrieved for the following reasons: rpc error: code = Internal desc = grpc: received message length 1948282738 exceeding the max size 4194304

go.sum checksum error

Hi! I'm trying to build this locally to hack on / contribute to but I think there's a checksum error with the docker client dependency:

prologic@Jamess-MacBook
Sat Apr 13 14:06:42
~/Contributions/swirl
 (master) 0
$ go build
go: downloading github.com/docker/docker v0.0.0-20180415161252-ea579a619452
go: verifying github.com/docker/[email protected]: checksum mismatch
	downloaded: h1:KXTxrc9Q8FwG8x/lbSBYzBMKn3xWpwx9MBfP1Ko7FYg=
	go.sum:     h1:3DHHYhTKAP1ZgL0g+msknSuFuZBA0UW6BqcAA5qsWWc=

Can you look in to this? Perhaps consider upgrading this dependency (not trivial as the library has changed some API)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.