Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: v1.0.0 #28

Merged
merged 1 commit into from
Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 32 additions & 8 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions api/restful/install.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package restful

import (
"fmt"
"github.com/gin-gonic/gin"
"net/http"
"quanxiang/pkg"
)

type Install struct {
Kubeconfig string `form:"kubeconfig" json:"kubeconfig" xml:"kubeconfig" binding:"-"`
Configfile string `form:"configfile" json:"configfile" xml:"configfile" binding:"-"`
DeploymentFile string `form:"deploymentFile" json:"deploymentFile" xml:"deploymentFile" binding:"-"`
MysqlInit bool `form:"mysqlInit" json:"mysqlInit" xml:"mysqlInit" binding:"-"`
NgGateWay bool `form:"ngGateWay" json:"ngGateWay" xml:"ngGateWay" binding:"-"`
Namespace string `form:"namespace" json:"namespace" xml:"namespace" binding:"-"`
}

func (I *Install)StartInstall(c *gin.Context) {
if err := c.ShouldBind(I);err != nil{
c.AbortWithError(http.StatusInternalServerError, err)
return
}
fmt.Println(" ********************************************************************************")
fmt.Println(" * *")
fmt.Println(" * 部署程序开始运行 *")
fmt.Println(" * *")
fmt.Println(" ********************************************************************************")
fmt.Println()
pkg.Start(I.Kubeconfig,I.Namespace,I.Configfile,I.DeploymentFile,I.MysqlInit,I.NgGateWay)
}
42 changes: 42 additions & 0 deletions api/restful/restful.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package restful

import (
"github.com/gin-gonic/gin"
"git.internal.yunify.com/qxp/misc/logger"
)
type Router struct {
engine *gin.Engine
}


func newRouter() (*gin.Engine, error) {
gin.SetMode(gin.ReleaseMode)
engine := gin.New()

engine.Use(logger.GinLogger(),
logger.GinRecovery())

return engine, nil
}

func NewRouter() (*Router, error) {
engine, err := newRouter()
if err != nil {
return nil, err
}
installqxp := Install{}
uninstallqxp := UnInstall{}
engine.POST("/install",installqxp.StartInstall)
engine.POST("/uninstall",uninstallqxp.StartUnInstall)
return &Router{
engine: engine,
}, nil
}

// Run 启动服务
func (r *Router) Run() {
r.engine.Run(":8089")
}
// Close 关闭服务
func (r *Router) Close() {
}
35 changes: 35 additions & 0 deletions api/restful/uninstall.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package restful

import (
"fmt"
"github.com/gin-gonic/gin"
"net/http"
"quanxiang/pkg"
)

type UnInstall struct {
Kubeconfig string `form:"kubeconfig" json:"kubeconfig" xml:"kubeconfig" binding:"-"`
DeploymentFile string `form:"deploymentFile" json:"deploymentFile" xml:"deploymentFile" binding:"-"`
UninstallMiddlerware bool `form:"uninstallMiddlerware" json:"uninstallMiddlerware" xml:"uninstallMiddlerware" binding:"-"`
Namespace string `form:"namespace" json:"namespace" xml:"namespace" binding:"-"`
}

func (U UnInstall)StartUnInstall(c *gin.Context) {
if err := c.ShouldBind(U);err != nil{
c.AbortWithError(http.StatusInternalServerError, err)
return
}
fmt.Println(" ********************************************************************************")
fmt.Println(" * *")
fmt.Println(" * 卸载程序开始运行 *")
fmt.Println(" * *")
fmt.Println(" ********************************************************************************")
fmt.Println()
err := pkg.UninstallServece(U.Namespace,U.DeploymentFile,U.Kubeconfig,U.UninstallMiddlerware)
if err != nil {
fmt.Println(err)
fmt.Println(" -------------卸载失败,请根据提示先检查-------------------")
}else{
fmt.Println(" -------------卸载成功,如部署请使用start命令-------------------")
}
}
14 changes: 11 additions & 3 deletions cmd/InstallApp.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ var (
deploymentFile string
mysqlInit bool
ngGateWay bool
isOffline bool
registry string
registryUser string
registryPass string
)
var uninstallMiddlerware bool

Expand Down Expand Up @@ -67,21 +71,25 @@ func Execute() {
fmt.Println(" * *")
fmt.Println(" ********************************************************************************")
fmt.Println()
pkg.Start(kubeconfig,namespace,configfile,deploymentFile,mysqlInit,ngGateWay)
pkg.Start(kubeconfig,namespace,configfile,deploymentFile,registry,registryUser,registryPass,mysqlInit,ngGateWay,isOffline)
},
}
//startCmd.Flags().BoolVarP(&daemon, "deamon", "d", false, "is daemon?")
startCmd.Flags().StringVarP(&kubeconfig,"kubeconfig", "k","","kubeconfig绝对路径,如果kubeconfig文件不在~/.kube/config个路径下需要指定")
startCmd.Flags().StringVarP(&kubeconfig,"kubeconfig", "k","~/.kube/config","kubeconfig绝对路径,如果kubeconfig文件不在~/.kube/config个路径下需要指定")
startCmd.Flags().StringVarP(&configfile, "configfile", "c", "./configs/configs.yml", "配置文件路径")
startCmd.Flags().StringVarP(&deploymentFile, "deploymentFile", "d", "./deployment", "部署服务(deployment文件夹相对或绝对路径)文件夹路径")
startCmd.Flags().BoolVarP(&mysqlInit, "middlerwareInit", "i", false, "是否需要初始化mysql,初次安装需要指定")
startCmd.Flags().BoolVarP(&ngGateWay, "ngGateWay", "g", false, "是否需要部署nginx-controller配置ingress访问")
startCmd.Flags().StringVarP(&namespace,"namespace", "n","default","容器部署在k8s的命名空间,默认为default")
startCmd.Flags().BoolVarP(&isOffline, "isOffline", "o", false, "是否可联网环境,默认否")
startCmd.Flags().StringVarP(&registry,"registry", "r","qxcr.io/qxp","如果是内网环境请设置自己的镜像仓库")
startCmd.Flags().StringVarP(&registryUser,"registryUser", "U","admin","如果是内网环境请设置镜像仓库的用户名")
startCmd.Flags().StringVarP(&registryPass,"registryPass", "P","Harbor12345","如果是内网环境请设置像仓库的密码")
rootCmd.AddCommand(startCmd)
uninstallCmd.Flags().StringVarP(&namespace,"namespace", "n","default","容器部署在k8s的命名空间,默认为default")
uninstallCmd.Flags().BoolVarP(&uninstallMiddlerware, "uninstallMiddlerware", "u", false, "是否需要卸载中间件(只有中间件是该工具部署的才可以指定)")
uninstallCmd.Flags().StringVarP(&deploymentFile,"deploymentFile", "d","./deployment","部署服务(deployment文件夹相对或绝对路径)文件夹路径")
uninstallCmd.Flags().StringVarP(&kubeconfig,"kubeconfig", "k","","kubeconfig绝对路径,如果kubeconfig文件不在~/.kube/config个路径下需要指定")
uninstallCmd.Flags().StringVarP(&kubeconfig,"kubeconfig", "k","~/.kube/config","kubeconfig绝对路径,如果kubeconfig文件不在~/.kube/config个路径下需要指定")
rootCmd.AddCommand(uninstallCmd)


Expand Down
33 changes: 27 additions & 6 deletions configs/configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ kafka:
enabled: true
elastic:
enabled: true
etcd:
enabled: true
mongo:
enabled: true
rootPassword: qxp1234 #Set Mongo password. Required when enabled is true 设置mongo密码,enabled为true时必填
Expand All @@ -18,9 +20,14 @@ minio:
secretKey: Minio123456 #Set Mongo secretKey. Required when enabled is true 设置minio secretKey,enabled为true时必填
#Service profile 服务的配置文件
image:
repo: quanxiang
tag: v0.7.0
imagePullSecrets: "lowcode"
repo: qxcr.io/qxp
tag: v1.0.0
imagePullSecrets: ""
domain: example.com #设置访问平台的域名
args:
enabled: true #如果使用的是未被公网解析的域名,需要设置enabled为true
endpoint: "example.com:31198" #fileserver 域名 域名要与domain设置的域名一致
ip: "xx.xx.xx.xx" #k8s master节点的ip
config:
mysql:
host: mysql.{{.}}.svc.cluster.local:3306 #如果上面中间件配置中mysql.enabled为true此处为mysql,否则请根据您的设置填写mysql host地址和端口
Expand All @@ -36,7 +43,7 @@ config:
password: qxp1234 #如果上面中间件配置中redis.enabled为true此处为上述中间件配置中的redis.password,否则请根据您的设置填写您的redis密码
elastic:
host:
- http://elasticsearch-client.{{.}}.svc.cluster.local:9200 #如果上面中间件配置中elastic.enabled为true此处配置不需要改动,否则请根据您的设置填写您的elasticsearch服务的ip和端口
- http://elasticsearch-master.{{.}}.svc.cluster.local:9200 #如果上面中间件配置中elastic.enabled为true此处配置不需要改动,否则请根据您的设置填写您的elasticsearch服务的ip和端口
log: true
kafka:
broker:
Expand All @@ -52,8 +59,22 @@ config:
password: qxp1234 #如果上面中间件配置中mongo.enabled为true此处为mongo.rootPassword,否则请根据您的设置设置您的密码
passwordSet: false
email:
emails:
- { emailfrom: "[email protected]",username: "XXX",aliasname: "别名",password: "XXX",host: "邮件服务器地址",port: 111 } #设置email信息以接收验证码
enabled: true
host: xx.xx.xx
port: xx
username: xx
password: xx
alias: xx
sender: [email protected]
# email:
# emails:
# - { emailfrom: "[email protected]",username: "XXX",aliasname: "别名",password: "XXX",host: "邮件服务器地址",port: 111 } #设置email信息以接收验证码

etcd:
addrs:
- etcd-cluster.{{.}}.svc.cluster.local:2379 #如果上面中间件配置中etcd.enabled为true此处不需要更改,否则请根据您的设置填写etcd ip地址和端口
username:
password:
storage:
option: minio
urlExpire: 600
Expand Down
Binary file removed deployment/.DS_Store
Binary file not shown.
24 changes: 24 additions & 0 deletions deployment/middleware_deployment/dapr/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

packages/
5 changes: 5 additions & 0 deletions deployment/middleware_deployment/dapr/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: 1.5.1
description: A Helm chart for Dapr on Kubernetes
name: dapr
version: 1.5.1
Loading