Commit ce538c6f authored by Stefan Dähling's avatar Stefan Dähling
Browse files

add frontend to kubestub

parent 5d1da0b2
Pipeline #300932 passed with stages
in 4 minutes and 31 seconds
......@@ -39,6 +39,12 @@ pnpbuild:
- export GOPATH=$HOME/go
- docker build -f build/docker/plugnplay/Dockerfile -t plugnplay .
frontendbuild:
stage: build
script:
- export GOPATH=$HOME/go
- docker build -f build/docker/frontend/Dockerfile -t frontend .
stubbuild:
stage: build
script:
......
......@@ -291,6 +291,42 @@ func (stub *LocalStub) deletePnP() (err error) {
return
}
// createFrontend starts a new Frontend docker image
func (stub *LocalStub) createFrontend() (err error) {
com := "docker run -d"
com += " --name=fe"
com += " -p 30013:13000"
com += " --hostname=fe"
com += " --network=clonemap-net"
com += " -e CLONEMAP_DEPLOYMENT_TYPE=\"local\""
com += " -e CLONEMAP_LOG_LEVEL=\"info\""
com += " frontend"
cmd := exec.Command("bash", "-c", com)
cmdOut, err := cmd.Output()
if err != nil {
err = errors.New(err.Error() + " " + string(cmdOut))
}
return
}
// deleteFrontend stops amd removes Frontend docker image
func (stub *LocalStub) deleteFrontend() (err error) {
com := "docker stop fe"
cmd := exec.Command("bash", "-c", com)
cmdOut, err := cmd.Output()
if err != nil {
err = errors.New(err.Error() + " " + string(cmdOut))
return
}
com = "docker rm fe"
cmd = exec.Command("bash", "-c", com)
cmdOut, err = cmd.Output()
if err != nil {
err = errors.New(err.Error() + " " + string(cmdOut))
}
return
}
// createMQTT starts a new MQTT Broker docker image
func (stub *LocalStub) createMQTT() (err error) {
com := "docker run -d"
......
......@@ -79,6 +79,12 @@ func StartLocalStub(fiware bool) {
fmt.Println(err)
return
}
fmt.Println("Create MQTT Broker Container")
err = cntxt.createMQTT()
if err != nil {
fmt.Println(err)
return
}
if fiware {
fmt.Println("Ceate Fiware Containers")
err = cntxt.createFiware()
......@@ -105,14 +111,14 @@ func StartLocalStub(fiware bool) {
fmt.Println(err)
return
}
fmt.Println("Create MQTT Broker Container")
err = cntxt.createMQTT()
fmt.Println("Create Plugnplay Container")
err = cntxt.createPnP()
if err != nil {
fmt.Println(err)
return
}
fmt.Println("Create Plugnplay Container")
err = cntxt.createPnP()
fmt.Println("Create Frontend Container")
err = cntxt.createFrontend()
if err != nil {
fmt.Println(err)
return
......@@ -174,6 +180,12 @@ func (stub *LocalStub) terminate(gracefulStop chan os.Signal) {
fmt.Println(err)
os.Exit(0)
}
fmt.Println("Stop Frontend Container")
err = stub.deleteFrontend()
if err != nil {
fmt.Println(err)
os.Exit(0)
}
fmt.Println("Stop MQTT Broker Container")
err = stub.deleteMQTT()
if err != nil {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment