dgraph-io / dgraph

The high-performance database for modern applications
https://dgraph.io
Other
20.31k stars 1.49k forks source link

curl https://get.dgraph.io -sSf | bash -s -- --systemd creates wrong .service file #8122

Closed Aifolin closed 1 month ago

Aifolin commented 2 years ago

For alfa it creates:

[Unit]
Description=dgraph.io Alpha instance
Wants=network.target
After=network.target
Requires=dgraph-zero.service

[Service]
Type=simple
WorkingDirectory=/var/lib/dgraph
ExecStart= -c 'dgraph alpha -p /var/lib/dgraph/p -w /var/lib/dgraph/w'
Restart=on-failure
StandardOutput=journal
StandardError=journal
User=dgraph
Group=dgraph

[Install]
WantedBy=multi-user.target

For zero it creates:

[Unit]
Description=dgraph.io Zero instance
Wants=network.target
After=network.target

[Service]
Type=simple
WorkingDirectory=/var/lib/dgraph
ExecStart= -c 'dgraph zero --wal /var/lib/dgraph/zw'
Restart=on-failure
StandardOutput=journal
StandardError=journal
User=dgraph
Group=dgraph

[Install]
WantedBy=multi-user.target
RequiredBy=dgraph-alpha.service

ExecStart should be: ExecStart=dgraph alpha -p /var/lib/dgraph/p -w /var/lib/dgraph/w and ExecStart=dgraph zero --wal /var/lib/dgraph/zw

MichelDiz commented 2 years ago

Can you explain what is the issue itself? What is causing.

Aifolin commented 2 years ago

Can you explain what is the issue itself? What is causing.

I use command at clean debian 11 node. curl https://get.dgraph.io -sSf | bash -s -- --systemd It creates creates two files as I described upper.

/etc/systemd/system/dgraph-alpha.service file include next string: ExecStart= -c 'dgraph alpha -p /var/lib/dgraph/p -w /var/lib/dgraph/w' and /etc/systemd/system/dgraph-zero.service file include: ExecStart= -c 'dgraph zero --wal /var/lib/dgraph/zw'

Then I tried to start dgraph alpha

root@some:~# systemctl start dgraph-alpha.service 
root@some:~# systemctl status dgraph-alpha.service 
○ dgraph-alpha.service - dgraph.io Alpha instance
     Loaded: loaded (/etc/systemd/system/dgraph-alpha.service; disabled; vendor preset: enabled)
     Active: inactive (dead)

Jan 20 10:42:56 some.com systemd[1]: Started dgraph.io Alpha instance.
Jan 20 10:42:56 some.com systemd[24437]: dgraph-alpha.service: Executable c missing, skipping: No such file or directory
Jan 20 10:42:56 some.com systemd[1]: dgraph-alpha.service: Deactivated successfully.

Tried to start dgraph zero: dgraph-zero.service: Executable c missing, skipping: No such file or directory

When I removed -c and ' ' from systemd files dgraph starts well

Or maybe it should be like: ExecStart=/usr/bin/bash -c 'dgraph alpha -p /var/lib/dgraph/p -w /var/lib/dgraph/w'

MichelDiz commented 2 years ago

This script should find your shell and replace the variable https://github.com/dgraph-io/Install-Dgraph/blob/master/contrib/service.tmpl - I will make it bash as default. Thanks!

github-actions[bot] commented 1 month ago

This issue has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open.