Skip to content

Commit

Permalink
Prepare the release for goconserver 0.1
Browse files Browse the repository at this point in the history
This commit includes the following works

- Add new flat -h, --help to show the help message.
- Add more description for goconserver configuration file.
- Modify the makefile to change the permission of directories.
  • Loading branch information
chenglch committed Nov 2, 2017
1 parent 6d34760 commit 0703810
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ install: build
cp ${SERVER_BINARY} /usr/local/bin/${SERVER_BINARY}
cp ${CLIENT_BINARY} /usr/local/bin/${CLIENT_BINARY}
mkdir -p /etc/goconserver /var/log/goconserver/nodes /var/lib/goconserver
chmod 700 /etc/goconserver /var/log/goconserver/nodes /var/lib/goconserver

if [ ! -f "/etc/goconserver/server.conf" ]; then \
cp etc/goconserver/server.conf /etc/goconserver/; \
Expand Down
25 changes: 13 additions & 12 deletions etc/goconserver/server.conf
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
global:
host: 127.0.0.1
host: 127.0.0.1 # the host name or ip address as the server address, If ssl/tls is enabled, hostname must be specified here.
# ssl_key_file: /etc/goconserver/cert/server-key.pem
# ssl_cert_file: /etc/goconserver/cert/server-cert.pem
# ssl_ca_cert_file: /etc/goconserver/cert/ca.pem
logfile: "/var/log/goconserver/server.log"
logfile: "/var/log/goconserver/server.log" # the log file for goconserver daemon.
log_level: "info" # debug, info, warn, error, fatal, panic
worker: 4
storage_type: file
worker: 4 # the max cpu cores could be used
storage_type: file # file or etcd, etcd is just experimental option.

api:
port: "8089"
port: "8089" # http(s) port
http_timeout: 5 # in second

console:
port: 12430
datadir: "/var/lib/goconserver/"
logdir: "/var/log/goconserver/nodes/"
target_timeout: 30
client_timeout: 30
reconnect_interval: 5 # retry interval in seconds if console could not be connected
rpcport: 12431
port: 12430 # the console session port for client(congo) to connect.
datadir: "/var/lib/goconserver/" # the data file to save the session node information.
logdir: "/var/log/goconserver/nodes/" # log files for session nodes.
target_timeout: 30 # timeout option to connect to the target, like BMC, hypervisor, etc.
client_timeout: 30 # timeout option for client to connect to the goconserver.
reconnect_interval: 5 # retry interval in second if console could not be connected.
rpcport: 12431 # [experimental] port for grpc server to support goconserver cluster, only available if storage_type is set to etcd.

# below is experimental option for etcd storage
etcd:
dail_timeout: 5
request_timeout: 2
Expand Down
8 changes: 0 additions & 8 deletions glide.lock

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

11 changes: 11 additions & 0 deletions goconserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var (
ServerCmd *cobra.Command
confFile string
showVer bool
help bool
Version string
BuildTime string
Commit string
Expand All @@ -34,6 +35,7 @@ func init() {
Long: `goconserver daemon service`}
ServerCmd.Flags().StringVarP(&confFile, "config-file", "c", "/etc/goconserver/server.conf", "Specify the configuration file for goconserver daemon.")
ServerCmd.Flags().BoolVarP(&showVer, "version", "v", false, "Show the version of goconserver.")
ServerCmd.Flags().BoolVarP(&help, "help", "h", false, "Show the help message of goconserver.")
}

func loadTlsConfig(serverConfig *common.ServerConfig) *tls.Config {
Expand Down Expand Up @@ -61,6 +63,15 @@ func main() {
fmt.Printf("Version: %s, BuildTime: %s Commit: %s\n", Version, BuildTime, Commit)
os.Exit(0)
}
if help {
fmt.Printf(`Usage: goconserver [flag]
-c --config-file <configuration file> Start the goconserver daemon service.
If not specified, use /etc/goconserver/server.conf by default.
-h --help Show the help message.
-v --version Show the version information of the goconserver.`)
fmt.Println("\n")
os.Exit(0)
}
serverConfig, err := common.InitServerConfig(confFile)
if err != nil {
panic(err)
Expand Down

0 comments on commit 0703810

Please sign in to comment.