##// 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 178 {'handler_console': {
179 'class ': 'StreamHandler',
180 'args ': '(sys.stderr,)',
179 'class': 'StreamHandler',
180 'args': '(sys.stderr,)',
181 181 'level': log_level,
182 182 }},
183 183
@@ -83,12 +83,17 b' class ServerBase(object):'
83 83 return ' '.join(self._args)
84 84
85 85 @property
86 def bind_addr(self):
87 return '{host}:{port}'.format(**self._config)
88
89 @property
86 90 def http_url(self):
87 91 template = 'http://{host}:{port}/'
88 92 return template.format(**self._config)
89 93
90 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 98 def get_rc_log(self):
94 99 with open(self.log_file) as f:
@@ -137,7 +142,9 b' class RcVCSServer(ServerBase):'
137 142
138 143 def __init__(self, config_file, log_file=None):
139 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 149 def start(self):
143 150 env = os.environ.copy()
@@ -148,10 +155,9 b' class RcVCSServer(ServerBase):'
148 155 host_url = self.host_url()
149 156 assert_no_running_instance(host_url)
150 157
151 log.info('rhodecode-vcsserver start command: {}'.format(' '.join(self._args)))
152 log.info('rhodecode-vcsserver starting at: {}'.format(host_url))
153 log.info('rhodecode-vcsserver command: {}'.format(self.command))
154 log.info('rhodecode-vcsserver logfile: {}'.format(self.log_file))
158 print(f'rhodecode-vcsserver starting at: {host_url}')
159 print(f'rhodecode-vcsserver command: {self.command}')
160 print(f'rhodecode-vcsserver logfile: {self.log_file}')
155 161
156 162 self.process = subprocess.Popen(
157 163 self._args, bufsize=0, env=env,
@@ -169,7 +175,8 b' class RcWebServer(ServerBase):'
169 175 def __init__(self, config_file, log_file=None):
170 176 super(RcWebServer, self).__init__(config_file, log_file)
171 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 181 def start(self):
175 182 env = os.environ.copy()
@@ -181,9 +188,9 b' class RcWebServer(ServerBase):'
181 188 host_url = self.host_url()
182 189 assert_no_running_instance(host_url)
183 190
184 log.info('rhodecode-web starting at: {}'.format(host_url))
185 log.info('rhodecode-web command: {}'.format(self.command))
186 log.info('rhodecode-web logfile: {}'.format(self.log_file))
191 print(f'rhodecode-web starting at: {host_url}')
192 print(f'rhodecode-web command: {self.command}')
193 print(f'rhodecode-web logfile: {self.log_file}')
187 194
188 195 self.process = subprocess.Popen(
189 196 self._args, bufsize=0, env=env,
General Comments 0
You need to be logged in to leave comments. Login now