1. 程式人生 > >生產環境的開源容器管理平臺--Rancher入門教程 5 自定義Catalog工具

生產環境的開源容器管理平臺--Rancher入門教程 5 自定義Catalog工具

這裡寫圖片描述

Rancher是一個用於部署和管理生產環境的容器的開源平臺,它與Kubernetes/Mesos/Docker Swarm進行整合。使得在任何硬體環境上容器化應用變得觸手可及。在這個系列的教程中我們將會學習如何使用rancher, 上篇文章介紹瞭如何在rancher中新增自定義的catalog,由於較為繁瑣,本文介紹一下相關自動化工具。

yo rancher-catalog

在上篇文章中介紹了自定義catalog的方法,但是檔案較多,限制很多,從檔名到內容很小的地方都可能造成不能正常顯示,使用npm的rancher-catalog這個小工具可以繞開一部分問題。

安裝

npm install -g yo
npm install -g generator-rancher-catalog
  • 1
  • 2

執行方法

yo rancher-catalog
  • 1

demo

生成

這裡寫圖片描述

設定

這裡寫圖片描述

確認

這裡寫圖片描述

這裡寫圖片描述

rancher-cattle-autocatalog

使用npm的yo,前提是還必須要安裝npm,所以也可以使用rancher-cattle-autocatalog進行處理。

使用例

[root@liumiaocn rancher]# pwd
/tmp/rancher
[root@liumiaocn
rancher]# ll total 0 [root@liumiaocn rancher]# git clone https://github.com/liumiaocn/rancher-cattle-autocatalog Cloning into 'rancher-cattle-autocatalog'... remote: Counting objects: 18, done. remote: Compressing objects: 100% (14/14), done. remote: Total 18 (delta 1), reused 14 (delta 0), pack-reused 0 Unpacking objects
: 100% (18/18), done. [root@liumiaocn rancher]# cd rancher-cattle-autocatalog/scripts/ [root@liumiaocn scripts]# ll total 8 -rw-r--r--. 1 root root 2525 Sep 28 20:39 create_rancher_cattle_catalog.sh drwxr-xr-x. 3 root root 22 Sep 28 20:39 DEMO -rw-r--r--. 1 root root 401 Sep 28 20:39 init.conf [root@liumiaocn scripts]# cat init.conf DEMO @ nginx DEMONAME @ nginx DEMODESCRIPTION @ nginx image DEMOVERSION @ 1.0.0 DEMOCATAGORY @ WEB DEMOMAINTAINER @ liumiaocn@outlook.com DEMOLICENSE @ Apache 2 DEMOURL @ liumiaocn\/rancher-cattle-autocatalog DEMOIMAGE @ nginx DEMOPORTMAPPING @ 80:80 DEMOUUID @ DEMOMINIMUM_VERSION @ DEMOQUESTIONS @ [root@liumiaocn scripts]# [root@liumiaocn scripts]# sh create_rancher_cattle_catalog.sh init.conf [root@liumiaocn scripts]# ll total 8 -rw-r--r--. 1 root root 2525 Sep 28 20:39 create_rancher_cattle_catalog.sh drwxr-xr-x. 3 root root 22 Sep 28 20:39 DEMO -rw-r--r--. 1 root root 401 Sep 28 20:39 init.conf drwxr-xr-x. 3 root root 22 Sep 28 20:39 nginx [root@liumiaocn scripts]# mv nginx/templates/ .. [root@liumiaocn scripts]# rm -rf nginx/ [root@liumiaocn scripts]# cd .. [root@liumiaocn rancher-cattle-autocatalog]# ll total 16 -rw-r--r--. 1 root root 11357 Sep 28 20:39 LICENSE -rw-r--r--. 1 root root 64 Sep 28 20:39 README.md drwxr-xr-x. 3 root root 72 Sep 28 20:44 scripts drwxr-xr-x. 3 root root 18 Sep 28 20:44 templates [root@liumiaocn rancher-cattle-autocatalog]# git add * [root@liumiaocn rancher-cattle-autocatalog]# git commit -m "add nginx rancher catalog" [master e64daec] add nginx rancher catalog 5 files changed, 1701 insertions(+) create mode 100644 templates/nginx/0/docker-compose.yml create mode 100644 templates/nginx/0/rancher-compose.yml create mode 100644 templates/nginx/README.md create mode 100644 templates/nginx/catalogIcon-nginx.svg create mode 100644 templates/nginx/config.yml [root@liumiaocn rancher-cattle-autocatalog]# git push warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Username for 'https://github.com': liumiaocn Password for 'https://[email protected]': remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/liumiaocn/rancher-cattle-autocatalog/' [root@liumiaocn rancher-cattle-autocatalog]#
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76

上篇文章的例子即為使用這種方法自動生成。熟悉格式之後不用任何工具也是一樣。

再分享一下我老師大神的人工智慧教程吧。零基礎!通俗易懂!風趣幽默!還帶黃段子!希望你也加入到我們人工智慧的隊伍中來!https://www.cnblogs.com/captainbed