Skip to content

Commit

Permalink
Add notifications-server to CLI (#108)
Browse files Browse the repository at this point in the history
* Notifications server added to CLI

* Variable to be used to mount volume from host

* Update cli/stack/notificationsserver.go

Co-Authored-By: nunojusto <nuno@justoweb.com>

* Update cli/stack/notificationsserver.go

Co-Authored-By: nunojusto <nuno@justoweb.com>

* Update cli/stack/notificationsserver.go

Co-Authored-By: nunojusto <nuno@justoweb.com>

* Correct order of the Service list

* Correct lists order

* added container Name attribute

* bubble up err
  • Loading branch information
nunojusto committed Nov 30, 2018
1 parent d0cbb19 commit 51c80c5
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
55 changes: 55 additions & 0 deletions cli/stack/notificationsserver.go
@@ -0,0 +1,55 @@
package stack

import (
"fmt"
"os"
"path/filepath"

"github.com/docker/docker/api/types/container"
"github.com/docker/go-connections/nat"
)

// NewNotificationsServer creates a new service for the cityofzion/neo-python image.
func NewNotificationsServer() (Service, error) {
pwd, err := os.Getwd()
if err != nil {
return Service{}, err
}

binds := []string{
fmt.Sprintf("%s:/configs", filepath.Dir(pwd)),
}

return Service{
Author: "cityofzion",
ContainerConfig: &container.Config{
Cmd: []string{
"/bin/sh",
"-c",
"/bin/cp /configs/notifications-server.config.json /neo-python/custom-config.json && /usr/bin/python3 /neo-python/neo/bin/api_server.py --config /neo-python/custom-config.json --port-rest 8080",
},
Env: []string{
"NOTIFICATIONS_SERVER=notifications-server",
},
ExposedPorts: map[nat.Port]struct{}{
"8080/tcp": {},
},
},
HostConfig: &container.HostConfig{
Binds: binds,
PortBindings: map[nat.Port][]nat.PortBinding{
"8080/tcp": {
{
HostIP: "0.0.0.0",
HostPort: "8080",
},
},
},
Privileged: false,
PublishAllPorts: false,
},
Image: "neo-python",
Name: "notifications-server",
Tag: "v0.8.1",
}, nil
}
7 changes: 6 additions & 1 deletion cli/stack/services.go
Expand Up @@ -7,8 +7,13 @@ func Services() ([]Service, error) {
return nil, err
}

notificationsServer, err := NewNotificationsServer()
if err != nil {
return nil, err
}

return []Service{
NewFaucet(), NewPostgres(), neoPython,
NewFaucet(), NewPostgres(), neoPython, NewPrivateNet(), notificationsServer,
}, nil
}

Expand Down

0 comments on commit 51c80c5

Please sign in to comment.