-
Notifications
You must be signed in to change notification settings - Fork 11
/
main.go
executable file
·97 lines (83 loc) · 3.41 KB
/
main.go
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// Copyright (C) INFINI Labs & INFINI LIMITED.
//
// The INFINI Framework is offered under the GNU Affero General Public License v3.0
// and as commercial software.
//
// For commercial licensing, contact us at:
// - Website: infinilabs.com
// - Email: [email protected]
//
// Open Source licensed under AGPL V3:
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Copyright © INFINI Ltd. All rights reserved.
* web: https://infinilabs.com
* mail: hello#infini.ltd */
package main
import (
_ "expvar"
"infini.sh/framework"
"infini.sh/framework/core/module"
"infini.sh/framework/core/util"
"infini.sh/framework/modules/api"
"infini.sh/framework/modules/elastic"
"infini.sh/framework/modules/metrics"
"infini.sh/framework/modules/pipeline"
"infini.sh/framework/modules/queue"
queue2 "infini.sh/framework/modules/queue/disk_queue"
"infini.sh/framework/modules/redis"
"infini.sh/framework/modules/s3"
stats2 "infini.sh/framework/modules/stats"
"infini.sh/framework/modules/task"
_ "infini.sh/framework/plugins"
stats "infini.sh/framework/plugins/stats_statsd"
"infini.sh/gateway/config"
_ "infini.sh/gateway/pipeline"
"infini.sh/gateway/proxy"
"infini.sh/gateway/service/floating_ip"
"infini.sh/gateway/service/forcemerge"
)
func setup() {
module.RegisterSystemModule(&stats2.SimpleStatsModule{})
module.RegisterUserPlugin(&stats.StatsDModule{})
module.RegisterSystemModule(&s3.S3Module{})
module.RegisterSystemModule(&queue2.DiskQueue{})
module.RegisterSystemModule(&redis.RedisModule{})
module.RegisterSystemModule(&elastic.ElasticModule{})
module.RegisterSystemModule(&queue.Module{})
module.RegisterSystemModule(&task.TaskModule{})
module.RegisterSystemModule(&api.APIModule{})
module.RegisterModuleWithPriority(&pipeline.PipeModule{},100)
module.RegisterUserPlugin(forcemerge.ForceMergeModule{})
module.RegisterUserPlugin(floating_ip.FloatingIPPlugin{})
module.RegisterUserPlugin(&metrics.MetricsModule{})
module.RegisterPluginWithPriority(&proxy.GatewayModule{},200)
}
func start() {
module.Start()
}
func main() {
terminalHeader := ("\n ___ _ _____ __ __ __ _ \n")
terminalHeader += (" / _ \\ /_\\ /__ \\/__\\/ / /\\ \\ \\/_\\ /\\_/\\\n")
terminalHeader += (" / /_\\///_\\\\ / /\\/_\\ \\ \\/ \\/ //_\\\\\\_ _/\n")
terminalHeader += ("/ /_\\\\/ _ \\/ / //__ \\ /\\ / _ \\/ \\ \n")
terminalHeader += ("\\____/\\_/ \\_/\\/ \\__/ \\/ \\/\\_/ \\_/\\_/ \n\n")
terminalFooter := ""
app := framework.NewApp("gateway", "A light-weight, powerful and high-performance search gateway.",
util.TrimSpaces(config.Version), util.TrimSpaces(config.BuildNumber), util.TrimSpaces(config.LastCommitLog), util.TrimSpaces(config.BuildDate), util.TrimSpaces(config.EOLDate), terminalHeader, terminalFooter)
app.Init(nil)
defer app.Shutdown()
if app.Setup(setup, start, nil) {
app.Run()
}
}