Skip to content
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

Add notifications-server to CLI #108

Merged
merged 12 commits into from Nov 30, 2018
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()
nunojusto marked this conversation as resolved.
Show resolved Hide resolved
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