-
-
Save mactkg/9fbd7ed2674b27cdbd47390dbfa4eb91 to your computer and use it in GitHub Desktop.
Install code-server on Coder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VERSION=${VERSION:-2.1692-vsc1.39.2} | |
WORK_DIR=/home/ubuntu/projects | |
USER_ID=1000 | |
GROUP_ID=1000 | |
PORT=8888 | |
TARBALL_URL=https://github.com/cdr/code-server/releases/download/$VERSION/code-server$VERSION-linux-x86_64.tar.gz | |
curl -L $TARBALL_URL | tar xfz - -C /usr/local/ | |
EXEC_PATH=/usr/local/code-server$VERSION-linux-x86_64/code-server | |
mkdir -p $WORK_DIR | |
chown $USER_ID:$GROUP_ID $WORK_DIR | |
cat << EOT > /etc/systemd/system/code-server.service | |
[Unit] | |
Description=VSCode in a browser | |
After=network.target | |
[Service] | |
Type=simple | |
ExecStart=$EXEC_PATH --host 0.0.0.0 --port $PORT --locale ja-JP $WORK_DIR | |
WorkingDirectory=$WORK_DIR | |
ExecStop=/sbin/start-stop-daemon --stop -x $EXEC_PATH | |
Restart=on-failure | |
User=$USER_ID | |
[Install] | |
WantedBy=multi-user.target | |
EOT | |
systemctl daemon-reload | |
systemctl enable code-server.service | |
systemctl start code-server.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment