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

Add a systemd service #644

Closed
lotigara opened this issue May 12, 2024 · 11 comments
Closed

Add a systemd service #644

lotigara opened this issue May 12, 2024 · 11 comments
Labels
enhancement Indicates new feature requests or improvement for existing functionality releasing related to release process, artifacts

Comments

@lotigara
Copy link

I want to setup YaCy on my Debian server, however there is nothing about systemd service. So, I took this systemd service and rewrote it, there is a result:

# yacy.service
[Unit]
Description=YaCy is free software for your own search engine.
After=network.target

[Service]
User=yacy
Group=www-data
WorkingDirectory=/home/yacy/yacy
ExecStart=/home/yacy/yacy/startYACY.sh
Restart=always
ExecReload=/home/yacy/yacy/restartYACY.sh
KillMode=mixed
TimeoutStopSec=1

[Install]
WantedBy=multi-user.target
@okybaca okybaca added enhancement Indicates new feature requests or improvement for existing functionality releasing related to release process, artifacts labels May 12, 2024
@okybaca
Copy link
Contributor

okybaca commented May 12, 2024

another systemd solution offered here

@lotigara
Copy link
Author

lotigara commented May 12, 2024

another systemd solution offered here

Thanks! But it for Fedora, so I'm writing similar instruction for Debian. By the way, why don’t you add instructions for installing YaCy as a service?

@lotigara
Copy link
Author

lotigara commented May 12, 2024

There they are:
(# for commands as root user and $ for commands as YaCy user)

# useradd --system yacydm -m -d /home/yacy
# useradd --system yacy -m -d /home/yacy
# su -l yacy

$ wget https://download.yacy.net/yacy_v1.930_202404051704_de941c6fe.tar.gz
$ tar -xf yacy_v1.930_202404051704_de941c6fe.tar.gz -C ..
$ exit

# chown -R yacydm:yacydm /home/yacy/
# chown -R yacy:yacy /home/yacy/DATA/

# cat > yacy.service << EOF
[Unit]
Description=YaCy Search Server
After=network.target

[Service]
Type=forking
User=yacy
ExecStart=/home/yacy/startYACY.sh
ExecStop=/home/yacy/stopYACY.sh
ExecRestart=/home/yacy/restartYACY.sh

[Install]
WantedBy=multi-user.target
EOF

# cp yacy.service /etc/systemd/system/
# systemctl enable --now yacy.service

# cat >> yacy-nginx << EOF
server {
        listen 80;
        server_name search.example.com;
        access_log /var/log/nginx/search-access.log;
        error_log /var/log/nginx/search-error.log;

        location / {
                proxy_pass http://127.0.0.1:8090;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Real-IP $remote_addr;
        }
}
EOF

# cp yacy-nginx /etc/nginx/sites-available/yacy
# ln -s /etc/nginx/sites-{available,enabled}/yacy
# nginx -t
# nginx -s reload
# certbot --nginx -d search.example.com

@okybaca
Copy link
Contributor

okybaca commented May 12, 2024 via email

@okybaca
Copy link
Contributor

okybaca commented May 12, 2024 via email

@lotigara
Copy link
Author

just one remark: out of security reasons, i'm used to have two yacy accounts: yacy and yacyadm, second one with write permissions for all the files, first one for DATA only. potential exploit permissions are limited to DATA folder only and cannot modify the rest of yacy.

Thanks! I'll modify this instruction.

@okybaca
Copy link
Contributor

okybaca commented May 12, 2024 via email

@lotigara
Copy link
Author

lotigara commented May 12, 2024

There is my Pull Request: yacy/yacy_net_homepage#35

@Orbiter
Copy link
Member

Orbiter commented May 13, 2024

pulled it, thank you!

@lotigara
Copy link
Author

You're welcome!

@Orbiter
Copy link
Member

Orbiter commented May 20, 2024

This is a documentation issue. Thanks to your work here, this is resolved as documentation update; yacy/yacy_net_homepage#35 is pulled.

@Orbiter Orbiter closed this as completed May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates new feature requests or improvement for existing functionality releasing related to release process, artifacts
Projects
None yet
Development

No branches or pull requests

3 participants