-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Add description for using code-server as a systemd unit #379
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,5 +115,30 @@ 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=<USER> | ||
EnvironmentFile=$HOME/.profile | ||
Restart=on-failure | ||
RestartSec=10 | ||
|
||
ExecStart=<PATH TO BINARY> --allow-http | ||
|
||
StandardOutput=file:/var/log/code-server-output.log | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On Ubuntu 16.04 the Standard* options were not recognized. I ended up with the following systemd unit (I anyways prefer logging to go to journald):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think a more viable alternative is to log this to journald if needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should always be logging to journald. |
||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also set environment file. There is a instance the User environment is not being used by
systemd
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please suggest changes as I am not aware of the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference, see my systemd Unit file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sr229 The Environment file can't work it has wrong formart systemd expects a other formart it will not execute that file with if else statements.
is the only thing that is accepted in it!