diff --git a/apps/code-server/data/.bashrc b/apps/code-server/data/.bashrc new file mode 100644 index 0000000..2a1ba76 --- /dev/null +++ b/apps/code-server/data/.bashrc @@ -0,0 +1 @@ +source "${HOME}/.loaders/init.sh" diff --git a/apps/code-server/data/.loaders/init.sh b/apps/code-server/data/.loaders/init.sh new file mode 100644 index 0000000..3868b6e --- /dev/null +++ b/apps/code-server/data/.loaders/init.sh @@ -0,0 +1,41 @@ +lazy_load() { + local command="${1}" + local loader="${2}" + local arguments=${@:3} + if ! which $command > /dev/null 2>&1 + then + echo "${command} isn't installed yet, installing it now..." + $loader + echo "${command} installed! Running \"${command} ${arguments}\"..." + echo + fi + $command $arguments +} + +setup_node() { + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash + export NVM_DIR="$HOME/.nvm" + source "${HOME}/.nvm/nvm.sh" + source "${HOME}/.nvm/bash_completion" + nvm install stable +} + +setup_python() { + sudo apt-get update + sudo apt-get install -y python3 python3-pip +} + +setup_rust() { + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + source "${HOME}/.cargo/env" +} + +alias node="lazy_load node setup_node" +alias npm="lazy_load npm setup_node" +alias python3="lazy_load python3 setup_python" +alias pip3="lazy_load pip3 setup_python" +alias python="python3" +alias pip="pip3" +alias rustup="lazy_load rustup setup_rust" +alias rustc="lazy_load rustc setup_rust" +alias cargo="lazy_load cargo setup_rust" diff --git a/apps/code-server/docker-compose.yml b/apps/code-server/docker-compose.yml new file mode 100644 index 0000000..a86a2c8 --- /dev/null +++ b/apps/code-server/docker-compose.yml @@ -0,0 +1,15 @@ +version: "3.7" + +services: + server: + image: codercom/code-server:3.11.0@sha256:d712341c622b0ae896d8f5b8c02368e44e1f5a03b93cd0489f937352dfc7bab8 + user: "1000:1000" + ports: + - "${APP_CODE_SERVER_PORT}:8080" + volumes: + - ${APP_DATA_DIR}/data:/home/coder + environment: + PASSWORD: "moneyprintergobrrr" + networks: + default: + ipv4_address: $APP_CODE_SERVER_IP diff --git a/apps/registry.json b/apps/registry.json index b5fb188..a820552 100644 --- a/apps/registry.json +++ b/apps/registry.json @@ -87,6 +87,28 @@ "defaultPassword": "", "torOnly": false }, + { + "id": "code-server", + "category": "Development", + "name": "code-server", + "version": "3.10.2", + "tagline": "Run VS Code on your Umbrel", + "description": "Run VS Code on your Umbrel and access it in the browser so you can code on any device with a consistent development environment. This way you can use your Umbrel not only to code from any device, anywhere, but to also speed up tests, compilations, downloads, and more.\n\nBy running all intensive tasks run on your Umbrel, preserve battery life of your devices when you're on the go.", + "developer": "Coder", + "website": "https://coder.com", + "dependencies": [], + "repo": "https://github.com/cdr/code-server", + "support": "https://github.com/cdr/code-server/discussions", + "port": 8091, + "gallery": [ + "1.jpg", + "2.jpg", + "3.jpg" + ], + "path": "", + "defaultPassword": "moneyprintergobrrr", + "torOnly": false + }, { "id": "gitea", "category": "Development", diff --git a/scripts/configure b/scripts/configure index 195de7c..445a974 100755 --- a/scripts/configure +++ b/scripts/configure @@ -182,6 +182,8 @@ APP_ELEMENT_IP="10.21.21.45" APP_ELEMENT_PORT="8088" APP_VAULTWARDEN_IP="10.21.21.46" APP_VAULTWARDEN_PORT="8089" +APP_CODE_SERVER_IP="10.21.21.53" +APP_CODE_SERVER_PORT="8091" # Generate RPC credentials if [[ -z ${BITCOIN_RPC_USER+x} ]] || [[ -z ${BITCOIN_RPC_PASS+x} ]] || [[ -z ${BITCOIN_RPC_AUTH+x} ]]; then @@ -369,6 +371,8 @@ for template in "${NGINX_CONF_FILE}" "${BITCOIN_CONF_FILE}" "${LND_CONF_FILE}" " sed -i "s//${APP_ELEMENT_PORT}/g" "${template}" sed -i "s//${APP_VAULTWARDEN_IP}/g" "${template}" sed -i "s//${APP_VAULTWARDEN_PORT}/g" "${template}" + sed -i "s//${APP_CODE_SERVER_IP}/g" "${template}" + sed -i "s//${APP_CODE_SERVER_PORT}/g" "${template}" done ########################################################## diff --git a/templates/.env-sample b/templates/.env-sample index 757be2c..4084519 100644 --- a/templates/.env-sample +++ b/templates/.env-sample @@ -85,3 +85,5 @@ APP_ELEMENT_IP= APP_ELEMENT_PORT= APP_VAULTWARDEN_IP= APP_VAULTWARDEN_PORT= +APP_CODE_SERVER_IP= +APP_CODE_SERVER_PORT= diff --git a/templates/torrc-sample b/templates/torrc-sample index c9beed9..b38b587 100644 --- a/templates/torrc-sample +++ b/templates/torrc-sample @@ -123,4 +123,8 @@ HiddenServicePort 80 :80 HiddenServiceDir /var/lib/tor/app-vaultwarden HiddenServicePort 80 : +# code-server Hidden Service +HiddenServiceDir /var/lib/tor/app-code-server +HiddenServicePort 80 :8080 + HashedControlPassword