From 17b362627a5f0e9cc68fa78b89aa244d30d70746 Mon Sep 17 00:00:00 2001 From: nwtnsqrd <30381446+nwtnsqrd@users.noreply.github.com> Date: Fri, 29 Mar 2019 15:02:14 +0100 Subject: [PATCH 1/2] Add description for using code-server as a systemd unit --- doc/self-hosted/index.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/doc/self-hosted/index.md b/doc/self-hosted/index.md index 8626599c0602..c192b4b9ab4c 100644 --- a/doc/self-hosted/index.md +++ b/doc/self-hosted/index.md @@ -115,5 +115,29 @@ OPTIONS ``` *Important:* For more details about Apache reverse proxy configuration checkout the [documentation](https://httpd.apache.org/docs/current/mod/mod_proxy.html) - especially the [Securing your Server](https://httpd.apache.org/docs/current/mod/mod_proxy.html#access) section + ### Start code-server as systemd unit + Create `/lib/systemd/system/code-server.service` with the following contents: + ``` + [Unit] + Description=Code Server IDE + After=network.target + + [Service] + Type=simple + User= + Restart=on-failure + RestartSec=10 + + ExecStart= --allow-http + + StandardOutput=file:/var/log/code-server-output.log + StandardError=file:/var/log/code-server-error.log + + [Install] + WantedBy=multi-user.target + + ``` + Enable code-server with `systemctl enable code-server.service`. Start with `systemctl start code-server.service`. + ### Help Use `code-server -h` or `code-server --help` to view the usage for the cli. This is also shown at the beginning of this section. From aea504d6417762568d18e497b14fb8474c36a5f6 Mon Sep 17 00:00:00 2001 From: nwtnsqrd <30381446+nwtnsqrd@users.noreply.github.com> Date: Thu, 18 Apr 2019 20:18:27 +0200 Subject: [PATCH 2/2] Add sr229's suggestion sr229 suggested to add "EnvironmentFile" for the systemd unit --- doc/self-hosted/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/self-hosted/index.md b/doc/self-hosted/index.md index c192b4b9ab4c..b6ebdef9dedc 100644 --- a/doc/self-hosted/index.md +++ b/doc/self-hosted/index.md @@ -125,6 +125,7 @@ OPTIONS [Service] Type=simple User= + EnvironmentFile=$HOME/.profile Restart=on-failure RestartSec=10