mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-01-23 02:34:42 +00:00
Update run local
This commit is contained in:
parent
003dd9d9e4
commit
b894375f99
4 changed files with 19 additions and 7 deletions
|
|
@ -34,7 +34,7 @@ func createOverlordConnection() (*websocket.Conn, error) {
|
|||
func initilizeOverlord() {
|
||||
overlord := overlord.NewServer()
|
||||
|
||||
log.Println("http://localhost:9000")
|
||||
log.Println("http://localhost:8000")
|
||||
|
||||
http.HandleFunc("/", overlord.GetWeb)
|
||||
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./static"))))
|
||||
|
|
@ -42,12 +42,11 @@ func initilizeOverlord() {
|
|||
// browser facing port
|
||||
go func() {
|
||||
http.HandleFunc("/ws", overlord.WS)
|
||||
http.ListenAndServe(":8000", nil)
|
||||
}()
|
||||
|
||||
// worker facing port
|
||||
http.HandleFunc("/wso", overlord.WSO)
|
||||
http.ListenAndServe(":9000", nil)
|
||||
http.ListenAndServe(":8000", nil)
|
||||
|
||||
log.Println("http://localhost:" + *config.Port)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,5 +180,8 @@ func (c *Client) Listen() {
|
|||
}
|
||||
|
||||
func (c *Client) Close() {
|
||||
if c == nil || c.conn == nil {
|
||||
return
|
||||
}
|
||||
c.conn.Close()
|
||||
}
|
||||
|
|
|
|||
10
run_local.sh
vendored
10
run_local.sh
vendored
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
docker build . -t cloud-game-local
|
||||
docker stop cloud-game-local
|
||||
docker rm cloud-game-local
|
||||
docker run --privileged -d --name cloud-game-local -p 8000:8000 cloud-game-local cmd -debug
|
||||
# Run coordinator first
|
||||
go run cmd/main.go -overlordhost overlord &
|
||||
# Wait till overlord finish initialized
|
||||
# Run a worker connecting to overlord
|
||||
sleep 3s
|
||||
go run cmd/main.go -overlordhost ws://localhost:8000/wso
|
||||
|
|
|
|||
8
run_local_docker.sh
vendored
Executable file
8
run_local_docker.sh
vendored
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
docker build . -t cloud-game-local
|
||||
docker stop cloud-game-local
|
||||
docker rm cloud-game-local-overlord -f
|
||||
docker rm cloud-game-local-worker -f
|
||||
docker run --privileged -d --name cloud-game-local-overlord -p 8000:8000 cloud-game-local cmd -overlordhost overlord
|
||||
sleep 1s
|
||||
docker run --privileged -d --name cloud-game-local-worker cloud-game-local cmd -overlordhost ws://localhost:8000/wso
|
||||
Loading…
Add table
Add a link
Reference in a new issue