Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Systemd startup script does not work #29

Closed
jeromeleonard opened this issue Nov 23, 2016 · 3 comments
Closed

Systemd startup script does not work #29

jeromeleonard opened this issue Nov 23, 2016 · 3 comments
Assignees
Labels
Milestone

Comments

@jeromeleonard
Copy link
Contributor

sudo addgroup thehive
sudo adduser --system thehive
sudo cp /opt/thehive/install/thehive.service /usr/lib/systemd/system (2 things with this, in the thehive.service file it statically states port to be 9000 which in my case has been altered so that would have to be altered, 
secondly and more importantly it points to /var/run/thehive/pid for the running process, but this is a issue since there is nosuch dir existsing and since this is a tmpfs(it would not survive a reboot) how have you all done this? Or have you pointed to the "RUNNING_PID" in the /opt/thehive dir?
sudo chown -R thehive:thehive /opt/thehive
sudo systemctl enable thehive
sudo service start thehive (note, this is in the wrong order, should be "sudo service thehive start")
@To-om To-om added the bug label Nov 23, 2016
@To-om To-om self-assigned this Nov 23, 2016
@ecapuano
Copy link

I shared this on the Google Group and it may have helped someone, so I'll share here as well...

I was able to get my service working properly by making a few small tweaks to the systemd file... Here is my file:

[Unit]
Description=TheHive
Documentation=https://thehive-project.org
Wants=network-online.target
After=network-online.target

[Service]
WorkingDirectory=/opt/thehive
User=thehive
Group=thehive

ExecStart=/opt/thehive/bin/thehive \
			-Dconfig.file=/etc/thehive/application.conf \
			-Dpidfile.path=/opt/thehive/RUNNING_PID


StandardOutput=journal
StandardError=inherit

# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536

# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0

# SIGTERM signal is used to stop the Java process
KillSignal=SIGTERM

# Java process is never killed
SendSIGKILL=no

# When a JVM receives a SIGTERM signal it exits with code 143
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

Notice that I removed any reference to the port number in this file as it is referenced in application.conf, but another thing to consider is that you cannot specify privileged ports (80, 443, < 1024, etc) because you are running TheHive as a non-priv user. So be sure that your configured ports are > 1024 (9000, 9443, etc) .

@saadkadhi
Copy link
Contributor

Thanks @ecapuano for the suggested fix. We will take it into account and update the docs accordingly.

To-om added a commit that referenced this issue Nov 23, 2016
TheHive user must have enough right to create PID file. So put it in installation directory.
@To-om
Copy link
Contributor

To-om commented Nov 23, 2016

I leave the listen port as it is the default port of all PlayFramework applications (and maybe other). I've updated the documentation to warn on privileged port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants