1) is there a way to make code-server run automatically as soon as the server boots up?
.....
2) when i run the script to start the service from ansible the service terminates once ansible playbook is complate is there a way to make it start from ansible and not end when ansble it done?
....
Could you create a service that runs code-server and is set to run on startup? For example on ubuntu (just what I use the most) you could create a file in /etc/systemd/system/code-server.service that contains something like this:
[Unit]
Description=A Code-server
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=(user)
ExecStart=(start code-server here using binaries or docker)
[Install]
WantedBy=multi-user.target
And then using:
sudo systemctl start code-server
sudo systemctl enable code-server
to get it to start on boot up. If you are not using Ubuntu, you can find many tutorials for creating startup services on most OS's. If this doesn't work, respond and I will try to help you fix it, or ask on Stack Overflow (as this is not really coder's problem -- unless this is a feature request for a built-in way to do this) Hope this helps!
We already documented this on the quickstart. Closing.
Most helpful comment
Could you create a service that runs code-server and is set to run on startup? For example on ubuntu (just what I use the most) you could create a file in
/etc/systemd/system/code-server.servicethat contains something like this:And then using:
to get it to start on boot up. If you are not using Ubuntu, you can find many tutorials for creating startup services on most OS's. If this doesn't work, respond and I will try to help you fix it, or ask on Stack Overflow (as this is not really coder's problem -- unless this is a feature request for a built-in way to do this) Hope this helps!