gs_archive_server: add bind option to the gs_archive_server command

Currently the service by default runs on when started. When
the service is containerized, it needs to be run on so that
the service is accessible from outside of the container (host). Add a
flag '-b'/'bind' so that a different address can be supplied to
the service via the command line and then update the cherrypy global
configs accordingly.

TEST=Start the service by passing the -b flag and verify if it runs on
the correct address.

Change-Id: I359156c58f059c70e2e3190fd4d1f01a23ddc0fa
Tested-by: Sanika Kulkarni <>
Reviewed-by: Allen Li <>
Reviewed-by: Congbin Guo <>
Commit-Queue: Sanika Kulkarni <>
Auto-Submit: Sanika Kulkarni <>
diff --git a/gs_cache/ b/gs_cache/
index 89d7fbb..d0326ae 100644
--- a/gs_cache/
+++ b/gs_cache/
@@ -469,6 +469,12 @@
       '[http://]{<hostname>|<IP>}[:<port_number>]. When skipped, the default '
       'scheme is http and port number is 80. Any other components in URL are '
+  parser.add_argument(
+      '-b', '--bind', default='', type=str,
+      help='Option to specify alternate bind address. By default, '
+      'gs_archive_server starts on')
   return parser.parse_args(argv)
@@ -495,6 +501,7 @@
   cherrypy.server.socket_port = args.port
   cherrypy.server.socket_file = args.socket
+  cherrypy.server.socket_host = args.bind
   # TODO( Remove the fake Omaha app once we have the long
   # term solution rolls out.