add -reverseProxyServer="volume.xxx.com" to volume server try to fix #9 (reverted from commit 3beb80c907)

This commit is contained in:
yourchanges 2015-02-03 13:54:44 +08:00
parent 3beb80c907
commit 133181bbe4
3 changed files with 2 additions and 18 deletions

View file

@ -49,7 +49,6 @@ var cmdServer = &Command{
var ( var (
serverIp = cmdServer.Flag.String("ip", "", "ip or server name") serverIp = cmdServer.Flag.String("ip", "", "ip or server name")
serverPublicIp = cmdServer.Flag.String("publicIp", "", "ip or server name") serverPublicIp = cmdServer.Flag.String("publicIp", "", "ip or server name")
reverseProxyServer = cmdServer.Flag.String("reverseProxyServer", "", "front-end reverse proxy server url <ip:port|domain_name>, for replication > 000")
serverBindIp = cmdServer.Flag.String("ip.bind", "0.0.0.0", "ip address to bind to") serverBindIp = cmdServer.Flag.String("ip.bind", "0.0.0.0", "ip address to bind to")
serverMaxCpu = cmdServer.Flag.Int("maxCpu", 0, "maximum number of CPUs. 0 means all available CPUs") serverMaxCpu = cmdServer.Flag.Int("maxCpu", 0, "maximum number of CPUs. 0 means all available CPUs")
serverTimeout = cmdServer.Flag.Int("idleTimeout", 10, "connection idle seconds") serverTimeout = cmdServer.Flag.Int("idleTimeout", 10, "connection idle seconds")
@ -231,13 +230,10 @@ func runServer(cmd *Command, args []string) bool {
*serverIp, *volumePort, *volumeAdminPort, *serverPublicIp, *serverIp, *volumePort, *volumeAdminPort, *serverPublicIp,
folders, maxCounts, folders, maxCounts,
*serverIp+":"+strconv.Itoa(*masterPort), *volumePulse, *serverDataCenter, *serverRack, *serverIp+":"+strconv.Itoa(*masterPort), *volumePulse, *serverDataCenter, *serverRack,
serverWhiteList, *volumeFixJpgOrientation, *reverseProxyServer, serverWhiteList, *volumeFixJpgOrientation,
) )
glog.V(0).Infoln("Start Seaweed volume server", util.VERSION, "at", *serverIp+":"+strconv.Itoa(*volumePort)) glog.V(0).Infoln("Start Seaweed volume server", util.VERSION, "at", *serverIp+":"+strconv.Itoa(*volumePort))
if *reverseProxyServer != "" {
glog.V(0).Infoln("The Seaweed volume server", util.VERSION, " is running behind the reverse proxy server", *reverseProxyServer)
}
volumeListener, e := util.NewListener( volumeListener, e := util.NewListener(
*serverBindIp+":"+strconv.Itoa(*volumePort), *serverBindIp+":"+strconv.Itoa(*volumePort),
time.Duration(*serverTimeout)*time.Second, time.Duration(*serverTimeout)*time.Second,

View file

@ -33,7 +33,6 @@ type VolumeServerOptions struct {
rack *string rack *string
whiteList []string whiteList []string
fixJpgOrientation *bool fixJpgOrientation *bool
reverseProxyServer *string
} }
func init() { func init() {
@ -50,7 +49,6 @@ func init() {
v.dataCenter = cmdVolume.Flag.String("dataCenter", "", "current volume server's data center name") v.dataCenter = cmdVolume.Flag.String("dataCenter", "", "current volume server's data center name")
v.rack = cmdVolume.Flag.String("rack", "", "current volume server's rack name") v.rack = cmdVolume.Flag.String("rack", "", "current volume server's rack name")
v.fixJpgOrientation = cmdVolume.Flag.Bool("images.fix.orientation", true, "Adjust jpg orientation when uploading.") v.fixJpgOrientation = cmdVolume.Flag.Bool("images.fix.orientation", true, "Adjust jpg orientation when uploading.")
v.reverseProxyServer = cmdVolume.Flag.String("reverseProxyServer", "", "front-end reverse proxy server url <ip:port|domain_name>, for replication > 000")
} }
var cmdVolume = &Command{ var cmdVolume = &Command{
@ -124,7 +122,6 @@ func runVolume(cmd *Command, args []string) bool {
*v.master, *v.pulseSeconds, *v.dataCenter, *v.rack, *v.master, *v.pulseSeconds, *v.dataCenter, *v.rack,
v.whiteList, v.whiteList,
*v.fixJpgOrientation, *v.fixJpgOrientation,
*v.reverseProxyServer,
) )
listeningAddress := *v.bindIp + ":" + strconv.Itoa(*v.port) listeningAddress := *v.bindIp + ":" + strconv.Itoa(*v.port)
@ -154,9 +151,5 @@ func runVolume(cmd *Command, args []string) bool {
if e := http.Serve(listener, publicMux); e != nil { if e := http.Serve(listener, publicMux); e != nil {
glog.Fatalf("Volume server fail to serve: %v", e) glog.Fatalf("Volume server fail to serve: %v", e)
} }
if *v.reverseProxyServer != "" {
glog.V(0).Infoln("The Seaweed volume server", util.VERSION, "is running behind the reverse proxy server", *v.reverseProxyServer)
}
return true return true
} }

View file

@ -28,13 +28,8 @@ func NewVolumeServer(publicMux, adminMux *http.ServeMux, ip string,
masterNode string, pulseSeconds int, masterNode string, pulseSeconds int,
dataCenter string, rack string, dataCenter string, rack string,
whiteList []string, whiteList []string,
fixJpgOrientation bool, fixJpgOrientation bool) *VolumeServer {
reverseProxyServer string) *VolumeServer {
publicUrl := publicIp + ":" + strconv.Itoa(port) publicUrl := publicIp + ":" + strconv.Itoa(port)
if reverseProxyServer != "" {
publicUrl = reverseProxyServer
}
vs := &VolumeServer{ vs := &VolumeServer{
masterNode: masterNode, masterNode: masterNode,
pulseSeconds: pulseSeconds, pulseSeconds: pulseSeconds,