Swirl:Docker Swarm 集群管理的新选择

cuigh · 2018-03-14 12:15:59 · 7709 次点击 · 大约8小时之前 开始浏览    置顶
这是一个创建于 2018-03-14 12:15:59 的主题,其中的信息可能已经有所发展或是发生改变。

SWIRL

GitHub 地址:https://github.com/cuigh/swirl

Swirl 是一个 Docker 管理工具,专注于 Swarm 集群。

主要功能

  • Swarm 各组件管理,包括服务、网络、任务等
  • 镜像与容器管理
  • Compose 管理与部署
  • 服务状态监控(基于 Prometheus)
  • 服务自动伸缩
  • 支持 LDAP 认证
  • 基于 RBAC 完整的权限控制模型
  • 支持横向扩展部署
  • 多语言支持
  • 更多功能...

Snapshots

首页

Dashboard

服务列表

Service list

服务编排管理

Compose list

角色编辑

Role editing

系统设置

Setting

配置

使用配置文件

所有选项都可以通过 config/app.yml 配置文件来设置。

name: swirl
banner: false

web:
  address: ':8001'
  authorize: '?'

swirl:
  db_type: mongo
  db_address: localhost:27017/swirl
#  docker_endpoint: tcp://docker-proxy:2375

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

使用环境变量

3 个主要的设置支持通过环境变量来设置,便于以 Docker 方式部署。

Name Value
DB_TYPE mongo
DB_ADDRESS localhost:27017/swirl
DOCKER_ENDPOINT tcp://docker-proxy:2375

使用 Swarm 的 Config 功能

Docker 从 v17.06 版本起,内置了配置管理模块,服务可以直接挂载存储在集群中的配置文件,因此你也可以通过这种方式来挂载 Swirl 的配置文件。

部署

独立部署

编译后把 swirl 执行文件和 config/assets/views 这 3 个目录复制到服务器任意目录中,直接运行即可。

./swirl

Docker 方式

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=localhost:27017/swirl \
    --name=swirl \
    cuigh/swirl

Docker Swarm 方式

docker service create \
  --name=swirl \
  --publish=8001:8001/tcp \
  --env DB_ADDRESS=localhost:27017/swirl \
  --constraint=node.role==manager \
  --mount=type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
  cuigh/swirl

Docker Compose 方式

Swirl 项目中已经包含了一个简单的 Compose 部署文件,你可以使用 Docker 的 stack 命令直接部署

docker stack deploy -c compose.yml swirl

高级特征

Swirl 使用服务标签来实现一些高级的管理功能,下表中的标签是目前已经支持的。

名称 描述 示例
swirl.scale 用于控制服务自动伸缩 swirl.scale=min=1,max=5,cpu=30:50
swirl.metrics 用于添加额外的指标到服务状态监控页 swirl.metrics=java, swirl.metrics=go

从源码构建

Swirl 使用 dep 作为依赖管理工具,下载源代码后,你可以使用如下两行简单的命令来构建。

$ dep ensure
$ go build

许可证

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.


有疑问加站长微信联系(非本文作者)

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

7709 次点击  
加入收藏 微博
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传