Skip to content

Bundle systemd system unit #1997

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
Aug 27, 2020
Merged
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions ci/build/code-server-user.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=code-server
After=network.target

[Service]
Type=exec
ExecStart=/usr/bin/code-server
Restart=always

[Install]
WantedBy=default.target
1 change: 1 addition & 0 deletions ci/build/code-server.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ After=network.target
Type=exec
ExecStart=/usr/bin/code-server
Restart=always
User=%i

[Install]
WantedBy=default.target
5 changes: 4 additions & 1 deletion ci/build/nfpm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ homepage: "https://github.com/cdr/code-server"
license: "MIT"
files:
./ci/build/code-server-nfpm.sh: /usr/bin/code-server
./ci/build/code-server.service: /usr/lib/systemd/user/code-server.service
./ci/build/code-server.service: /usr/lib/systemd/system/code-server.service
# Only included for backwards compat with previous releases that shipped
# the user service. See #1997
./ci/build/code-server-user.service: /usr/lib/systemd/user/code-server.service
./release-standalone/**/*: "/usr/lib/code-server/"
6 changes: 3 additions & 3 deletions doc/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ sed -i.bak 's/auth: password/auth: none/' ~/.config/code-server/config.yaml
Restart `code-server` with (assuming you followed the guide):

```bash
systemctl --user restart code-server
sudo systemctl restart code-server@$USER
```

Now forward local port 8080 to `127.0.0.1:8080` on the remote instance by running the following command on your local machine.
Expand Down Expand Up @@ -277,7 +277,7 @@ sudo setcap cap_net_bind_service=+ep /usr/lib/code-server/lib/node
Assuming you have been following the guide, restart `code-server` with:

```bash
systemctl --user restart code-server
sudo systemctl restart code-server@$USER
```

Edit your instance and checkmark the allow HTTPS traffic option.
Expand All @@ -295,7 +295,7 @@ Edit the `password` field in the `code-server` config file at `~/.config/code-se
and then restart `code-server` with:

```bash
systemctl --user restart code-server
sudo systemctl restart code-server@$USER
```

### How do I securely access development web services?
Expand Down
8 changes: 4 additions & 4 deletions doc/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ commands presented in the rest of this document.
```bash
curl -fOL https://github.com/cdr/code-server/releases/download/v3.4.1/code-server_3.4.1_amd64.deb
sudo dpkg -i code-server_3.4.1_amd64.deb
systemctl --user enable --now code-server
sudo systemctl enable --now code-server@$USER
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```

Expand All @@ -90,7 +90,7 @@ systemctl --user enable --now code-server
```bash
curl -fOL https://github.com/cdr/code-server/releases/download/v3.4.1/code-server-3.4.1-amd64.rpm
sudo rpm -i code-server-3.4.1-amd64.rpm
systemctl --user enable --now code-server
sudo systemctl enable --now code-server@$USER
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```

Expand All @@ -99,7 +99,7 @@ systemctl --user enable --now code-server
```bash
# Installs code-server from the AUR using yay.
yay -S code-server
systemctl --user enable --now code-server
sudo systemctl enable --now code-server@$USER
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```

Expand All @@ -108,7 +108,7 @@ systemctl --user enable --now code-server
git clone https://aur.archlinux.org/code-server.git
cd code-server
makepkg -si
systemctl --user enable --now code-server
sudo systemctl enable --now code-server@$USER
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```

Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ echo_systemd_postinstall() {
echoh
cath << EOF
To have systemd start code-server now and restart on boot:
systemctl --user enable --now code-server
sudo systemctl enable --now code-server@$USER
Or, if you don't want/need a background service you can run:
code-server
EOF
Expand Down