question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

st2api and st2auth always binds to 127.0.0.1

See original GitHub issue

I’ve set the host param in st2.conf for auth and api to 0.0.0.0, but the config is ignored and the gunicorn process binds to 127.0.0.1:

[root@base-stackstorm2-138-onint ~]# ps -ef | grep gunicorn
st2      20711     1  9 22:50 ?        00:00:00 /opt/stackstorm/st2/bin/python /opt/stackstorm/st2/bin/gunicorn_pecan /opt/stackstorm/st2/lib/python2.7/site-packages/st2api/gunicorn_config.py -k eventlet -b 127.0.0.1:9101 --workers 1 --threads 1 --graceful-timeout 10 --timeout 30
st2      20723     1  9 22:50 ?        00:00:00 /opt/stackstorm/st2/bin/python /opt/stackstorm/st2/bin/gunicorn_pecan /opt/stackstorm/st2/lib/python2.7/site-packages/st2stream/gunicorn_config.py -k eventlet -b 127.0.0.1:9102 --workers 1 --threads 10 --graceful-timeout 10 --timeout 30
st2      20735     1  9 22:50 ?        00:00:00 /opt/stackstorm/st2/bin/python /opt/stackstorm/st2/bin/gunicorn_pecan /opt/stackstorm/st2/lib/python2.7/site-packages/st2auth/gunicorn_config.py -k eventlet -b 127.0.0.1:9100 --workers 1 --threads 1 --graceful-timeout 10 --timeout 30
...

I’ve tried modifying the hard-coded local addresses in both https://github.com/StackStorm/st2/blob/master/st2api/st2api/gunicorn_config.py#L29 and https://github.com/StackStorm/st2/blob/master/st2auth/st2auth/gunicorn_config.py#L29

as well as the init scripts /etc/init.d/st2api, /etc/init.d/st2auth, which was hard-coding the bind address in the DAEMON_ARGS variable: DAEMON_ARGS="-k eventlet -b 127.0.0.1:9101 --workers 1 --threads 1 --graceful-timeout 10 --timeout 30 --pid ${PIDFILE}".

However, the auth and api endpoints are still binding to 127.0.0.1 after restarting the st2 processes.

I’m using st2 v1.4, and my environment was set up by following the documentation.

My st2.conf looks like:

[exporter]
logging = /etc/st2/logging.exporter.conf

[garbagecollector]
logging = /etc/st2/logging.garbagecollector.conf

[auth]
host = 0.0.0.0
port = 9100
use_ssl = False
debug = True
enable = True
logging = /etc/st2/logging.auth.conf
mode = standalone

# Note: Settings bellow are only used in "standalone" mode
backend = flat_file
backend_kwargs = {"file_path": "/etc/st2/.htpasswd"}

# Base URL to the API endpoint excluding the version (e.g. http://myhost.net:9101/)
api_url = 

[system]
base_path = /opt/stackstorm

[syslog]
host = 127.0.0.1
port = 514
facility = local7
protocol = udp

[log]
excludes = requests,paramiko
redirect_stderr = False
mask_secrets = True

[system_user]
user = stanley
ssh_key_file = /home/stanley/.ssh/stanley_rsa

[messaging]
url = amqp://guest:guest@127.0.0.1:5672/

[ssh_runner]
remote_dir = /tmp
use_paramiko_ssh_runner = True

Perhaps I am missing other hard-coded overrides?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
emptyweecommented, Apr 22, 2017

Not sure why it doesn’t work for the author, but updating DAEMON_ARGS via /etc/sysconfig/st2api worked very well for me:

 # ps aux | grep st2api
st2      18075 25.8  0.1 232588 28156 ?        S    09:57   0:01 /opt/stackstorm/st2/bin/python /opt/stackstorm/st2/bin/gunicorn_pecan /opt/stackstorm/st2/lib/python2.7/site-packages/st2api/gunicorn_config.py -k eventlet -b 0.0.0.0:9101 --workers 1 --threads 1 --graceful-timeout 10 --timeout 30 --pid /var/run/st2/st2api.pid
st2      18110 45.0  0.2 284364 45472 ?        D    09:57   0:00 /opt/stackstorm/st2/bin/python /opt/stackstorm/st2/bin/gunicorn_pecan /opt/stackstorm/st2/lib/python2.7/site-packages/st2api/gunicorn_config.py -k eventlet -b 0.0.0.0:9101 --workers 1 --threads 1 --graceful-timeout 10 --timeout 30 --pid /var/run/st2/st2api.pid
root     18121  0.0  0.0 103312   904 pts/3    S+   09:57   0:00 grep st2api
09:57:14 j0 root@lvcops101:~
# netstat -anp | grep 9101
tcp        0      0 0.0.0.0:9101                0.0.0.0:*                   LISTEN      18075/python

# cat /etc/sysconfig/st2api
DAEMON_ARGS="-k eventlet -b 0.0.0.0:9101 --workers 1 --threads 1 --graceful-timeout 10 --timeout 30 --pid ${PIDFILE}"

This way I don’t have to update the original init.d script, which can be updated during upgrade. I am on CentOS 6.8

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change bind address of st2api and st2auth service - API
can someone tell me how to change bind address of st2auth, st2api and st2stream by default it binds to 127.0.0.1 but I am...
Read more >
ssh -R binds to 127.0.0.1 only on remote - Server Fault
By default, sshd(8) binds remote port forwardings to the loopback address. This prevents other remote hosts from connecting to forwarded ports.
Read more >
st2 - Puppet module to manage/configure StackStorm
redis_bind_ip. Data type: Any. Bind IP of the Redis server. Default is 127.0.0.1. Default value: $st2::params::redis_bind_ip ...
Read more >
What is the difference between 127.0.0.1 and non-localhost ...
You can always do whatever you want on your own LAN. On a given PC, what governs whether an IP address is available...
Read more >
stackstorm 29. 源碼分析之----stackstorm的actionrunner服務併發能力 ...
At this point we will always ack a message. message.ack(). def shutdown(self): ... Host and port to bind the API server. host =...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found