Skip to content

[doc/quickstart] add init docs #981

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

Merged
merged 1 commit into from
Sep 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions doc/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,62 @@ server {

</VirtualHost>
```

### Run automatically at startup

In some cases you might need to run code-server automatically once the host starts. You may use your local init service to do so.

#### Systemd

```ini
[Unit]

Description=VSCode in a browser

After=network.target

[Service]

Type=simple

ExecStart=/usr/bin/code-server $(pwd)

WorkingDirectory=$HOME/projects

ExecStop=/sbin/start-stop-daemon --stop -x /usr/bin/code-server

Restart=on-failure

User=1000

[Install]

WantedBy=multi-user.target
```

#### OpenRC

```sh
#!/sbin/openrc-run

depend() {
after net-online
need net
}

supervisor=supervise-daemon
name="code-server"
command="/opt/cdr/code-server"
command_args=""

pidfile="/var/run/cdr.pid"
respawn_delay=5

set -o allexport
if [ -f /etc/environment ]; then source /etc/environment; fi
set +o allexport
```

#### Kubernetes/Docker

Make sure you set your restart policy to always - this will ensure your container starts as the daemon starts.