TACTIC Open Source
Service install in RHEL - Printable Version

+- TACTIC Open Source (http://forum.southpawtech.com)
+-- Forum: TACTIC Open Source (http://forum.southpawtech.com/forumdisplay.php?fid=3)
+--- Forum: TACTIC Discussion (http://forum.southpawtech.com/forumdisplay.php?fid=4)
+--- Thread: Service install in RHEL (/showthread.php?tid=40)

Pages: 1 2


RE: Service install in RHEL - dankitchen - 12-09-2019

Yes it does here is the output:

$ python3 tactic_python3 start
File "tactic_python3", line 17
TACTIC_INSTALL_DIR=`python3 -c 'import tacticenv; print(tacticenv.get_install_dir())'`
^
SyntaxError: invalid syntax
$


RE: Service install in RHEL - Celton McGrath - 12-09-2019

Hi Dan,

The tactic_python3 file is a init.d script, so you should execute:

$ tactic_python3 start

without the python3 executable prefix.

Can you try again and let me know what you get?

I'm surprised you here you are having difficulty with the service installation. We have released a Fedora 30 VM (available on the Community downloads page) that uses this file without a problem.

I recently did fix one issue with the script - it seemed the chkconfig start priority was too low. In this pull request, I've increased it.

https://github.com/Southpaw-TACTIC/TACTIC/pull/1311

Best,

Celton


RE: Service install in RHEL - remkonoteboom - 12-09-2019

I just tried this on my Fedora 25 (I know, it's pretty old) and it worked.


Code:
[root@localhost tactic]# ./tactic_python3 start
TACTIC_INSTALL_DIR = /spt/tactic/tactic
TACTIC_SITE_DIR =
TACTIC_DATA_DIR = /spt/tactic/tactic_data

Starting Tactic:                                          [  OK  ]
[root@localhost tactic]# ps -ef | grep python
root      810    1  0 Nov29 ?        00:00:03 /usr/bin/python3 -Es /usr/sbin/firewalld --nofork --nopid
root    57136    1  0 11:46 pts/3    00:00:00 su - tactic -m -c /usr/bin/python3 /spt/tactic/tactic/src/bin/monitor.py
tactic  57137 57136  8 11:46 ?        00:00:00 /usr/bin/python3 /spt/tactic/tactic/src/bin/monitor.py
tactic  57162 57137 18 11:46 ?        00:00:00 python3 /spt/tactic/tactic/src/bin/startup.py 8081
tactic  57278 57137 25 11:46 ?        00:00:00 python3 /spt/tactic/tactic/src/bin/startup.py 8082
tactic  57392 57137 48 11:46 ?        00:00:00 python3 /spt/tactic/tactic/src/bin/startup.py 8083
root    57404 54093  0 11:46 pts/3    00:00:00 grep --color=auto python


So at least, this much is working.  I suspect a newer version of Fedora probably has something missing.  We'll see with the output from Dan.  I will try it on a Fedora 30+ later, when I get the chance.


RE: Service install in RHEL - dankitchen - 12-10-2019

Getting a little bit closer. Not sure if I have to have the actual tactic user but here is the output (same output if I try as the root user)

[fedora@ip-172-31-24-227 opt]$ cd /etc/init.d/
[fedora@ip-172-31-24-227 init.d]$ sudo -u apache ./tactic_python3 start
TACTIC_INSTALL_DIR = /opt/tactic/tactic
TACTIC_SITE_DIR =
TACTIC_DATA_DIR = /opt/tactic/tactic_data

Starting Tactic: ./tactic_python3: line 78: kill: (1911) - No such process
Success
[fedora@ip-172-31-24-227 init.d]$ ps -ef | grep python
root 501 1 0 Dec09 ? 00:00:00 /usr/bin/python3 /usr/sbin/firewalld --nofork --nopid
fedora 1998 1845 0 00:03 pts/0 00:00:00 grep --color=auto python
[fedora@ip-172-31-24-227 init.d]$


RE: Service install in RHEL - remkonoteboom - 12-10-2019

More than likely, you will have to run this script as root (init.d scripts always run as root)

You have the line:

[fedora@ip-172-31-24-227 init.d]$ sudo -u apache ./tactic_python3 start

which runs it as apache. This "tactic_python3" will start monitor.py as the user set in line 29

29 TACTIC_USER=tactic

We used to run TACTIC as user apache, but a few years back we switched to a "tactic" user, so all of our documentation and scripts reflect this. If you want to run it as apache, you can, but you will have to change line 29 to reflect this. My guess is that your problems stem from permissions issues dealing with running the script as user "apache" which tries to run "monitor.py" as a user "tactic". The apache user would not be permitted to do that.

Your script is failing at:
78 if kill -0 $PID >&-; then
If may also be that you have a $PID file that it is trying to kill and it can't.

After line:
32 PID_FILE=$TACTIC_TEMP_DIR/log/tactic.pid
echo the PID_FILE to see the location and then try to remove that file first and see if that helps.


RE: Service install in RHEL - dankitchen - 12-10-2019

Thanks! Seems running as apache was part of the issue although I had tried root so not sure overall. I did to remove the pid file as mentioned which does seem to start tactic now but, its odd that if I try to load from the browser it still looks like its down. Here is the output

[fedora@ip-172-31-24-227 init.d]$ sudo ./tactic_python3 start
TACTIC_INSTALL_DIR = /opt/tactic/tactic
TACTIC_SITE_DIR =
TACTIC_DATA_DIR = /opt/tactic/tactic_data

Starting Tactic: Success
[fedora@ip-172-31-24-227 init.d]$ ps -ef | grep python
root 495 1 0 14:42 ? 00:00:00 /usr/bin/python3 /usr/sbin/firewalld --nofork --nopid
root 3596 1 0 14:52 pts/0 00:00:00 su - tactic -m -c /usr/bin/python3 /opt/tactic/tactic/src/bin/monitor.py
tactic 3597 3596 0 14:52 ? 00:00:00 /usr/bin/python3 /opt/tactic/tactic/src/bin/monitor.py
root 4829 1 0 14:58 pts/0 00:00:00 su - tactic -m -c /usr/bin/python3 /opt/tactic/tactic/src/bin/monitor.py
tactic 4830 4829 4 14:58 ? 00:00:00 /usr/bin/python3 /opt/tactic/tactic/src/bin/monitor.py
fedora 4896 1016 0 14:59 pts/0 00:00:00 grep --color=auto python
[fedora@ip-172-31-24-227 init.d]$

If I start Tactic using startup.py it does actually load fine.

I did also try to reinstall Tactic using the rpm instead of the traditional install.py and it works but one thing i noticed is that it created a service file called tacitc.rpmnew?

I am going to spin up another instance and do a fresh install just to make sure I didn't screw anything up in all of this debugging. I will start with the rpm install this time.

it does seem to be going better starting with a fresh instance, it was likely my fault for using the install.py instead of the rpm installer. Thanks for all of the help! I know I will have more questions ;-)