-
Notifications
You must be signed in to change notification settings - Fork 213
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
Memphis nats integration tcp #253
Changes from 23 commits
0ab8228
2fff337
f8064f4
b3f148e
1c57caf
c85e266
cac448a
292d200
6be4af9
078bc0a
5e2f59b
eb3eadf
c7ecd74
dca10b4
bd6e60e
33b6812
80fea08
254b709
7bff251
6ecfc13
6d1d167
b0be302
c0609c7
d514c6a
1e32f99
f0d69e6
f517cd7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,6 @@ import ( | |
"memphis-broker/analytics" | ||
"memphis-broker/background_tasks" | ||
"memphis-broker/db" | ||
"memphis-broker/handlers" | ||
"memphis-broker/http_server" | ||
"memphis-broker/server" | ||
"os" | ||
|
@@ -93,48 +92,51 @@ func usage() { | |
os.Exit(0) | ||
} | ||
|
||
func handleError(s *server.Server, message string, err error) { | ||
if err != nil { | ||
s.Errorf(message + " " + err.Error()) | ||
} | ||
} | ||
|
||
func runMemphis(s *server.Server) { | ||
|
||
if !s.MemphisInitialized() { | ||
s.Fatalf("Jetstream not enabled on global account") | ||
} | ||
|
||
err := db.InitializeDbConnection(s) | ||
handleError(s, "Failed initializing db connection: ", err) | ||
|
||
err = analytics.InitializeAnalytics() | ||
handleError(s, "Failed initializing analytics: ", err) | ||
dbInstance, err := db.InitializeDbConnection(s) | ||
if err != nil { | ||
s.Errorf("Failed initializing db connection:" + " " + err.Error()) | ||
os.Exit(1) | ||
} | ||
|
||
handlers.InitializeHandlers(s) | ||
err = analytics.InitializeAnalytics(dbInstance.Client) | ||
if err != nil { | ||
s.Errorf("Failed initializing analytics: " + " " + err.Error()) | ||
db.Close(dbInstance, s) | ||
os.Exit(1) | ||
} | ||
|
||
err = handlers.CreateRootUserOnFirstSystemLoad() | ||
handleError(s, "Failed to create root user: ", err) | ||
s.InitializeMemphisHandlers(dbInstance) | ||
|
||
err = server.CreateRootUserOnFirstSystemLoad() | ||
if err != nil { | ||
s.Errorf("Failed to create root user: " + " " + err.Error()) | ||
db.Close(dbInstance, s) | ||
os.Exit(1) | ||
} | ||
background_tasks.InitializeZombieResources(s) | ||
|
||
defer db.Close() | ||
defer db.Close(dbInstance, s) | ||
|
||
// defer broker.Close() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can remove this one |
||
defer analytics.Close() | ||
|
||
wg := new(sync.WaitGroup) | ||
wg.Add(4) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be 3 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indeed |
||
|
||
// go tcp_server.InitializeTcpServer(wg) | ||
go http_server.InitializeHttpServer(s, wg) | ||
go background_tasks.KillZombieResources(wg) | ||
go background_tasks.ListenForPoisonMessages(s) | ||
|
||
var env string | ||
if os.Getenv("DOCKER_ENV") != "" { | ||
env = "Docker" | ||
s.Noticef("\n**********\n\nDashboard: http://localhost:9000\nMemphis broker: localhost:5555 (Management Port) / 7766 (Data Port) / 6666 (TCP Port)\nUI/CLI root username - root\nUI/CLI root password - memphis\nSDK root connection token - memphis \n\n**********") | ||
s.Noticef("\n**********\n\nDashboard: http://localhost:9000\nMemphis broker: localhost:5555 (Management Port) / 6666 (TCP Port)\nUI/CLI root username - root\nUI/CLI root password - memphis\nSDK root connection token - memphis \n\n**********") | ||
} else { | ||
env = "K8S" | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to leave these comments ?