##// END OF EJS Templates
tests: fixed starting of customized gunicorn with a explicit --bind call
super-admin -
r4976:6c82c462 default
parent child Browse files
Show More
@@ -176,8 +176,8 b' def ini_config(request, tmpdir_factory, '
176 }},
176 }},
177
177
178 {'handler_console': {
178 {'handler_console': {
179 'class ': 'StreamHandler',
179 'class': 'StreamHandler',
180 'args ': '(sys.stderr,)',
180 'args': '(sys.stderr,)',
181 'level': log_level,
181 'level': log_level,
182 }},
182 }},
183
183
@@ -83,12 +83,17 b' class ServerBase(object):'
83 return ' '.join(self._args)
83 return ' '.join(self._args)
84
84
85 @property
85 @property
86 def bind_addr(self):
87 return '{host}:{port}'.format(**self._config)
88
89 @property
86 def http_url(self):
90 def http_url(self):
87 template = 'http://{host}:{port}/'
91 template = 'http://{host}:{port}/'
88 return template.format(**self._config)
92 return template.format(**self._config)
89
93
90 def host_url(self):
94 def host_url(self):
91 return 'http://' + get_host_url(self.config_file)
95 host = get_host_url(self.config_file)
96 return f'http://{host}'
92
97
93 def get_rc_log(self):
98 def get_rc_log(self):
94 with open(self.log_file) as f:
99 with open(self.log_file) as f:
@@ -137,7 +142,9 b' class RcVCSServer(ServerBase):'
137
142
138 def __init__(self, config_file, log_file=None):
143 def __init__(self, config_file, log_file=None):
139 super(RcVCSServer, self).__init__(config_file, log_file)
144 super(RcVCSServer, self).__init__(config_file, log_file)
140 self._args = ['gunicorn', '--paste', self.config_file]
145 self._args = [
146 'gunicorn', '--bind', self.bind_addr,
147 '--paste', self.config_file]
141
148
142 def start(self):
149 def start(self):
143 env = os.environ.copy()
150 env = os.environ.copy()
@@ -148,10 +155,9 b' class RcVCSServer(ServerBase):'
148 host_url = self.host_url()
155 host_url = self.host_url()
149 assert_no_running_instance(host_url)
156 assert_no_running_instance(host_url)
150
157
151 log.info('rhodecode-vcsserver start command: {}'.format(' '.join(self._args)))
158 print(f'rhodecode-vcsserver starting at: {host_url}')
152 log.info('rhodecode-vcsserver starting at: {}'.format(host_url))
159 print(f'rhodecode-vcsserver command: {self.command}')
153 log.info('rhodecode-vcsserver command: {}'.format(self.command))
160 print(f'rhodecode-vcsserver logfile: {self.log_file}')
154 log.info('rhodecode-vcsserver logfile: {}'.format(self.log_file))
155
161
156 self.process = subprocess.Popen(
162 self.process = subprocess.Popen(
157 self._args, bufsize=0, env=env,
163 self._args, bufsize=0, env=env,
@@ -169,7 +175,8 b' class RcWebServer(ServerBase):'
169 def __init__(self, config_file, log_file=None):
175 def __init__(self, config_file, log_file=None):
170 super(RcWebServer, self).__init__(config_file, log_file)
176 super(RcWebServer, self).__init__(config_file, log_file)
171 self._args = [
177 self._args = [
172 'gunicorn', '--worker-class', 'gevent', '--paste', config_file]
178 'gunicorn', '--bind', self.bind_addr, '--worker-class', 'gevent',
179 '--paste', self.config_file]
173
180
174 def start(self):
181 def start(self):
175 env = os.environ.copy()
182 env = os.environ.copy()
@@ -181,9 +188,9 b' class RcWebServer(ServerBase):'
181 host_url = self.host_url()
188 host_url = self.host_url()
182 assert_no_running_instance(host_url)
189 assert_no_running_instance(host_url)
183
190
184 log.info('rhodecode-web starting at: {}'.format(host_url))
191 print(f'rhodecode-web starting at: {host_url}')
185 log.info('rhodecode-web command: {}'.format(self.command))
192 print(f'rhodecode-web command: {self.command}')
186 log.info('rhodecode-web logfile: {}'.format(self.log_file))
193 print(f'rhodecode-web logfile: {self.log_file}')
187
194
188 self.process = subprocess.Popen(
195 self.process = subprocess.Popen(
189 self._args, bufsize=0, env=env,
196 self._args, bufsize=0, env=env,
General Comments 0
You need to be logged in to leave comments. Login now