SWIRL
GitHub 地址:https://github.com/cuigh/swirl
Swirl 是一个 Docker 管理工具,专注于 Swarm 集群。
主要功能
- Swarm 各组件管理,包括服务、网络、任务等
- 镜像与容器管理
- Compose 管理与部署
- 服务状态监控(基于 Prometheus)
- 服务自动伸缩
- 支持 LDAP 认证
- 基于 RBAC 完整的权限控制模型
- 支持横向扩展部署
- 多语言支持
- 更多功能...
Snapshots
首页
服务列表
服务编排管理
角色编辑
系统设置
配置
使用配置文件
所有选项都可以通过 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.
有疑问加站长微信联系(非本文作者)
