Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions conf/examples/silver-empty-schema.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"Args": ["", ""],
"GracefulShutdownTimeout": 5,
"RestartDelaySecs": 10,
"MaxCrashCount": 10,
"MaxCrashCountPerHour": 10,
"StartupDelaySecs": 20,
"MonitorPing": {
"URL": "",
Expand All @@ -31,7 +31,7 @@
"Args": ["", ""],
"GracefulShutdownTimeout": 5,
"RestartDelaySecs": 10,
"MaxCrashCount": 10,
"MaxCrashCountPerHour": 10,
"StartupDelaySecs": 20,
"MonitorPing": {
"URL": "",
Expand Down
210 changes: 105 additions & 105 deletions conf/examples/silver-kitchen-sink.conf
Original file line number Diff line number Diff line change
@@ -1,105 +1,105 @@
{
"ServiceDescription": {
"DisplayName": "Kitchen Sink Service",
"Description": "This service would do a everything!"
},
"ServiceConfig": {
"StopFile": ".stop",
"ReloadFile": ".reload",
"LogFile": "${ServiceName}.log",
"LogFileMaxSizeMb": 200,
"PidFile": "${ServiceName}.pid"
},
"EnvironmentVars": {
"DATA_SOURCE": "localhost:9000"
},
"Services": [
{
"Path": "myservice/v*/simple-server",
},
{
"Path": "myservice/v*/java.exe",
"Args": ["-Xmx=200m", "-Droot=${ServiceRoot}", "org.example.MyServer"],
"GracefulShutdownTimeout": 5,
"RestartDelaySecs": 10,
"MaxCrashCount": 10,
"StartupDelaySecs": 20,
"MonitorPing": {
"URL": "http://localhost:80/login",
"IntervalSecs": 30,
"RestartOnFailureCount": 3,
"TimeoutSecs": 10,
"StartupDelaySecs": 60
}
},
{
"Path": "otherservice/v*/service.exe",
"MonitorPing": {
"URL": "echo://127.0.0.1:4300",
"IntervalSecs": 30,
"TimeoutSecs": 10,
"StartupDelaySecs": 30,
"RestartOnFailureCount": 3
}
},
{
"Path": "otherservice/v*/service.exe",
"MonitorPing": {
"URL": "echo://127.0.0.1:4300",
"IntervalSecs": 30,
"TimeoutSecs": 10,
"StartupDelaySecs": 30,
"RestartOnFailureCount": 3
}
},
{
"Path": "another/v*/service.exe",
"MonitorPing": {
"URL": "file://logs/service.log",
"IntervalSecs": 120,
"RestartOnFailureCount": 1
}
}
],
"StartupTasks": [
{
"Path": "updater.exe",
"Args": ["http://example.org/check-update"],
"TimeoutSecs": 3600,
"StartupDelaySecs": 60,
"StartupRandomDelaySecs": 3600
},
{
"Path": "install/verify.exe",
"TimeoutSecs": 10,
"StartupDelaySecs": 0,
"StartupRandomDelaySecs": 1
}
],
"ScheduledTasks": [
{
"Schedule": "@daily",
"Path": "updater.exe",
"Args": ["http://example.org/check-update"],
"StartupRandomDelaySecs": 3600,
"TimeoutSecs": 3600
},
{
"Schedule": "0 37 * * * *",
"Path": "cleanup/v*/clean.exe",
"TimeoutSecs": 120
}
],
"Commands": [
{
"Name": "checkupdate",
"Path": "update/v*/checkupdate.exe",
"Args": ["http://example.org/check-update", "-interactive"]
},
{
"Name": "edit-config",
"Path": "notepad.exe",
"Args": "${ServiceRoot}/config/mysetup.conf"
}
]
}
{
"ServiceDescription": {
"DisplayName": "Kitchen Sink Service",
"Description": "This service would do a everything!"
},
"ServiceConfig": {
"StopFile": ".stop",
"ReloadFile": ".reload",
"LogFile": "${ServiceName}.log",
"LogFileMaxSizeMb": 200,
"PidFile": "${ServiceName}.pid"
},
"EnvironmentVars": {
"DATA_SOURCE": "localhost:9000"
},
"Services": [
{
"Path": "myservice/v*/simple-server",
},
{
"Path": "myservice/v*/java.exe",
"Args": ["-Xmx=200m", "-Droot=${ServiceRoot}", "org.example.MyServer"],
"GracefulShutdownTimeout": 5,
"RestartDelaySecs": 10,
"MaxCrashCountPerHour": 10,
"StartupDelaySecs": 20,
"MonitorPing": {
"URL": "http://localhost:80/login",
"IntervalSecs": 30,
"RestartOnFailureCount": 3,
"TimeoutSecs": 10,
"StartupDelaySecs": 60
}
},
{
"Path": "otherservice/v*/service.exe",
"MonitorPing": {
"URL": "echo://127.0.0.1:4300",
"IntervalSecs": 30,
"TimeoutSecs": 10,
"StartupDelaySecs": 30,
"RestartOnFailureCount": 3
}
},
{
"Path": "otherservice/v*/service.exe",
"MonitorPing": {
"URL": "echo://127.0.0.1:4300",
"IntervalSecs": 30,
"TimeoutSecs": 10,
"StartupDelaySecs": 30,
"RestartOnFailureCount": 3
}
},
{
"Path": "another/v*/service.exe",
"MonitorPing": {
"URL": "file://logs/service.log",
"IntervalSecs": 120,
"RestartOnFailureCount": 1
}
}
],
"StartupTasks": [
{
"Path": "updater.exe",
"Args": ["http://example.org/check-update"],
"TimeoutSecs": 3600,
"StartupDelaySecs": 60,
"StartupRandomDelaySecs": 3600
},
{
"Path": "install/verify.exe",
"TimeoutSecs": 10,
"StartupDelaySecs": 0,
"StartupRandomDelaySecs": 1
}
],
"ScheduledTasks": [
{
"Schedule": "@daily",
"Path": "updater.exe",
"Args": ["http://example.org/check-update"],
"StartupRandomDelaySecs": 3600,
"TimeoutSecs": 3600
},
{
"Schedule": "0 37 * * * *",
"Path": "cleanup/v*/clean.exe",
"TimeoutSecs": 120
}
],
"Commands": [
{
"Name": "checkupdate",
"Path": "update/v*/checkupdate.exe",
"Args": ["http://example.org/check-update", "-interactive"]
},
{
"Name": "edit-config",
"Path": "notepad.exe",
"Args": "${ServiceRoot}/config/mysetup.conf"
}
]
}
4 changes: 2 additions & 2 deletions make.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ func main() {
func verifyEnv() {
if _, err := exec.LookPath("godep"); err != nil {
fmt.Println("Please install godep. Run:")
fmt.Println(" go make.go setup")
fmt.Println(" go run make.go setup")
}
}

func setupEnv() {
fmt.Println("Installing godep...")
runCmd("go", "get", "github.com/tools/godep")
if _, err := exec.LookPath("godep"); err != nil {
fmt.Println("ERROR: godep does note seem to be on the path")
fmt.Println("ERROR: godep does not seem to be on the path")
}
}

Expand Down
10 changes: 7 additions & 3 deletions service/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestLoadConfig_MissingFileShouldRaiseError(t *testing.T) {
}
}

func TestLocadConfig_ValidConfig(t *testing.T) {
func TestLocalConfig_ValidConfig(t *testing.T) {
// Arrange
testConfig := `
{
Expand All @@ -46,7 +46,7 @@ func TestLocadConfig_ValidConfig(t *testing.T) {
"Path" : "test/path/1",
"Args" : ["arg1", "arg2"],
"GracefulShutdownTimeoutSecs" : 12,
"MaxCrashCount" : 999,
"MaxCrashCountPerHour" : 999,
"RestartDelaySecs" : 1,
"MonitorPing" : {
"URL" : "http://localhost:80/login",
Expand Down Expand Up @@ -144,6 +144,10 @@ func TestLocadConfig_ValidConfig(t *testing.T) {
t.Error("Problem extracting arg")
}

if c.Services[0].MaxCrashCountPerHour != 999 {
t.Error("MaxCrashCountPerHour field was incorrectly parsed")
}

if c.ScheduledTasks[1].Path != "scheduled/task/2" {
t.Error("Problem extracting schedule task path")
}
Expand Down Expand Up @@ -265,7 +269,7 @@ func TestLoadConfig_IncompleteConfig_ShouldError(t *testing.T) {
"Path" : "test/path/1",
"Args" : ["arg1", "arg2"],
"GracefulShutdownTimeoutSecs" : 12,
"MaxCrashCount" : 999,
"MaxCrashCountPerHour" : 999,
"RestartDelaySecs" : 1,
"MonitorPing" : {
"URL" : "http://localhost:80/login",
Expand Down