Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add notifications-server to CLI (#108)
* 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
Showing
2 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters