Compare commits

...
Author SHA1 Message Date
push-app-to-main[bot] c5a285c38c Add coder (ct) 2026-11-28 13:01:26 +00:00
2 changed files with 121 additions and 0 deletions

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
#!/usr/bin/env bash
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/coder/coder
APP="Coder"
var_tags="${var_tags:-development;ide;workspaces}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-8}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_arm64="${var_arm64:-yes}"
var_unprivileged="${var_unprivileged:-1}"
export var_access_url="${var_access_url:-}"
export var_admin_email="${var_admin_email:-}"
export var_admin_pass="${var_admin_pass:-}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -f /etc/coder.d/coder.env ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
if check_for_gh_release "coder" "coder/coder"; then
DPKG_FORCE_CONFOLD=1 fetch_and_deploy_gh_release "coder" "coder/coder" "binary" "latest" "" "coder_*_linux_$(arch_resolve "amd64" "arm64").deb"
msg_ok "Updated successfully!"
fi
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
echo -e "${GATEWAY}${BGN}http://${IP}:3000${CL}"
echo -e "${INFO}${YW}Admin credentials: /opt/coder_data/.env${CL}"
+68
View File
@@ -0,0 +1,68 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/coder/coder
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
setup_postgresql
PG_DB_NAME="coder" PG_DB_USER="coder" PG_DB_CREDS_FILE="/dev/null" setup_postgresql_db
fetch_and_deploy_gh_release "coder" "coder/coder" "binary" "latest" "" "coder_*_linux_$(arch_resolve "amd64" "arm64").deb"
var_access_url="${var_access_url:-http://${LOCAL_IP}:3000}"
if [[ ! "$var_access_url" =~ ^https?:// ]]; then
msg_warn "Access URL '${var_access_url}' has no scheme, using http://${var_access_url}"
var_access_url="http://${var_access_url}"
fi
msg_info "Configuring Coder"
cat <<EOF >/etc/coder.d/coder.env
CODER_HTTP_ADDRESS=0.0.0.0:3000
CODER_ACCESS_URL=${var_access_url}
CODER_PG_CONNECTION_URL=postgres://coder:${PG_DB_PASS}@127.0.0.1:5432/coder?sslmode=disable
EOF
chmod 640 /etc/coder.d/coder.env
chown root:coder /etc/coder.d/coder.env
mkdir -p /opt/coder_data
cat <<EOF >/opt/coder_data/.env
CODER_ADMIN_USERNAME=admin
CODER_ADMIN_EMAIL=${var_admin_email:-admin@coder.local}
CODER_ADMIN_PASSWORD=${var_admin_pass:-$(random_password)}
EOF
chmod 600 /opt/coder_data/.env
# The first start runs all database migrations before it reports ready, longer than 90s on slow disks
mkdir -p /etc/systemd/system/coder.service.d
cat <<EOF >/etc/systemd/system/coder.service.d/override.conf
[Service]
TimeoutStartSec=30min
EOF
systemctl daemon-reload
systemctl enable -q --now coder
msg_ok "Configured Coder"
msg_info "Creating Coder Admin"
source /opt/coder_data/.env
for _ in {1..60}; do
curl -fsS http://127.0.0.1:3000/healthz >/dev/null 2>&1 && break
sleep 2
done
$STD coder login http://127.0.0.1:3000 \
--first-user-username "$CODER_ADMIN_USERNAME" \
--first-user-email "$CODER_ADMIN_EMAIL" \
--first-user-password "$CODER_ADMIN_PASSWORD" \
--first-user-full-name "Admin" \
--first-user-trial=false
msg_ok "Created Coder Admin"
motd_ssh
customize
cleanup_lxc