StackStorm / ansible-st2

Ansible Roles and Playbooks to deploy StackStorm
https://galaxy.ansible.com/StackStorm/stackstorm/
Apache License 2.0
100 stars 77 forks source link

Changing Port st2auth listens to without touching systemd service file #320

Open rdancel001 opened 2 years ago

rdancel001 commented 2 years ago

I noticed that the port that st2auth listens on is defined in st2.conf and in the systemd service file as a hardcoded value. I was wondering if it was possible to get the port number changes to something else, like 9105, before its setup as a service so that when the service is created, it'll reflect that new port?

Reason for the change is node_exporter uses 9100 to allow Prometheus to scrape the metrics from it. Installation of the exporter is done during our VM provisioning process so its something that would be less likely to change.

I'd like to avoid directly modifying the systemd file, if possible.

amanda11 commented 2 years ago

@nzlosh Is the port that is in the systemd service file relevant any more (ST2 3.7 onwards)? I thought the value in st2.conf was the only value now needed to be changed, but the systemd file still shows:

# cat /usr/lib/systemd/system/st2auth.service 
[Unit]
Description=StackStorm service st2auth
After=network.target st2auth.socket
Requires=st2auth.socket

[Service]
Type=simple
User=st2
Group=st2
Environment="DAEMON_ARGS=-k eventlet -b 127.0.0.1:9100 --workers 1 --threads 1 --graceful-timeout 10 --timeout 30 --log-config /etc/st2/logging.auth.gunicorn.conf --error-logfile /var/log/st2/st2auth.log"
EnvironmentFile=-/etc/sysconfig/st2auth
ExecStart=/opt/stackstorm/st2/bin/gunicorn st2auth.wsgi:application $DAEMON_ARGS
TimeoutSec=60
PrivateTmp=true
Restart=on-failure
RestartSec=5

But if I change st2.conf to use a different port, the systemd file is unchanged, but it does indeed listen on the port that is specified in st2.conf.

So I'm wondering if for @rdancel001's query he can ignore the value in the systemd file, and just needs to configure the port in st2.conf now. And perhaps we have a tidy-up issue that we have the bind address in the DAEMON_ARGS in the systemd file?

nzlosh commented 2 years ago

After looking into this further, it appears the service files will need to be automatically generated too, I'll prepare a patch next week when I return from holiday.

rdancel001 commented 2 years ago

Sweet! I'm appreciative for the quick response and clarification. I'll test it out and verify as well on my end when I get the chance!