Didstopia / rust-server

Provides a dedicated linux server for Rust (the game) running inside a Docker container.
MIT License
244 stars 104 forks source link

Can you give us the systemd equivalent for the startup script? #86

Closed helenclarko closed 3 years ago

helenclarko commented 3 years ago

Is your feature request related to a problem? Please describe. Newer releases of Ubuntu do not have upstart available

Describe the solution you'd like systemd alternative auto startup script

Dids commented 3 years ago

Not sure I follow. This Docker container image uses neither upstart nor systemd.

helenclarko commented 3 years ago

Thanks Dids,

I was referring to the help document created back in 2016 for Ubuntu 14.04.

I probably should have just used 14.04 which has upstart, but I want to check with you first incase you had something.

Dids commented 3 years ago

Do you happen to have a link to that? Still not entirely sure how this relates to this project/Docker image, as we have no control over any documentation outside of this repository. 🙂

helenclarko commented 3 years ago

Of course, this document here: https://rust.didscraft.com/rust-server-on-linux-using-docker/#automaticstartup

I know it's not part of the repository, but I wasn't sure where else to ask for systemd alternative to upstart.

I really hope this was a page you created and I'm not asking in the wrong place. Sorry if I am wasting your time.

Dids commented 3 years ago

Ahh thank you, I'd entirely forgotten about that guide. I'll make a note to update it!

helenclarko commented 3 years ago

No no, Thanks you @Dids

Hardcore-fs commented 3 years ago

why would you need to complicate the docker with such a script.

by using the correct docker commands

docker run --restart unless-stopped

docker would do the same..

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

HalfEatenPie commented 3 years ago

I've translated the upstart code to systemd code simply for my own usecase. Feel free to modify as you need, although probably using docker run --restart unless-stopped is good enough for your own usecase.

Create a file in: /etc/systemd/system/rust-server.service


[Unit]
Description=Rust Server Container
Requires=docker.service
After=docker.service

[Service]
Restart=always
ExecStartPre=-/usr/bin/docker rm -f rust-server 2>/dev/null
ExecStartPre=-/usr/bin/docker pull didstopia/rust-server
ExecStart=/usr/bin/docker run -p 28015:28015 -p 28015:28015/udp -p 28016:28016 -p 8080:8080 -p 28082:28082 --name rust-server --env-file /rust.env -v /rust:/steamcmd/rust --rm didstopia/rust-server
ExecStop=/usr/bin/docker stop rust-server

[Install]
WantedBy=default.target

Modify this code section as you will. I don't offer any support for this. It works well enough for my own usecase, but YMMV.

Edit: added rust+ port

Hardcore-fs commented 3 years ago

you might have missed the (rust+) port?

28082:28082

HalfEatenPie commented 3 years ago

Good catch @Hardcore-fs. I'm getting back into Rust and running a server again and I'm not familiar with this new Rust+. I've made the edit to the above script to reflect those changes.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.