mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-03-21 17:33:01 +01:00
Compare commits
1 Commits
add-script
...
fix/coder-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c7fb75f6d |
@@ -1,75 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
|
||||||
|
|
||||||
# Copyright (c) 2021-2026 community-scripts ORG
|
|
||||||
# Author: Slaviša Arežina (tremor021)
|
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
||||||
# Source: https://wakapi.dev/ | https://github.com/muety/wakapi
|
|
||||||
|
|
||||||
APP="Alpine-Wakapi"
|
|
||||||
var_tags="${var_tags:-code;time-tracking}"
|
|
||||||
var_cpu="${var_cpu:-1}"
|
|
||||||
var_ram="${var_ram:-512}"
|
|
||||||
var_disk="${var_disk:-4}"
|
|
||||||
var_os="${var_os:-alpine}"
|
|
||||||
var_version="${var_version:-3.23}"
|
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
|
||||||
|
|
||||||
header_info "$APP"
|
|
||||||
variables
|
|
||||||
color
|
|
||||||
catch_errors
|
|
||||||
|
|
||||||
function update_script() {
|
|
||||||
header_info
|
|
||||||
check_container_storage
|
|
||||||
check_container_resources
|
|
||||||
if [[ ! -d /opt/wakapi ]]; then
|
|
||||||
msg_error "No ${APP} Installation Found!"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/muety/wakapi/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
|
||||||
if [ "${RELEASE}" != "$(cat ~/.wakapi 2>/dev/null)" ] || [ ! -f ~/.wakapi ]; then
|
|
||||||
msg_info "Stopping Wakapi Service"
|
|
||||||
$STD rc-service wakapi stop
|
|
||||||
msg_ok "Stopped Wakapi Service"
|
|
||||||
|
|
||||||
msg_info "Updating Wakapi LXC"
|
|
||||||
$STD apk -U upgrade
|
|
||||||
msg_ok "Updated Wakapi LXC"
|
|
||||||
|
|
||||||
msg_info "Creating backup"
|
|
||||||
mkdir -p /opt/wakapi-backup
|
|
||||||
cp /opt/wakapi/config.yml /opt/wakapi/wakapi_db.db /opt/wakapi-backup/
|
|
||||||
msg_ok "Created backup"
|
|
||||||
|
|
||||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "wakapi" "muety/wakapi" "tarball"
|
|
||||||
|
|
||||||
msg_info "Configuring Wakapi"
|
|
||||||
cd /opt/wakapi
|
|
||||||
$STD go mod download
|
|
||||||
$STD go build -o wakapi
|
|
||||||
cp /opt/wakapi-backup/config.yml /opt/wakapi/
|
|
||||||
cp /opt/wakapi-backup/wakapi_db.db /opt/wakapi/
|
|
||||||
rm -rf /opt/wakapi-backup
|
|
||||||
msg_ok "Configured Wakapi"
|
|
||||||
|
|
||||||
msg_info "Starting Service"
|
|
||||||
$STD rc-service wakapi start
|
|
||||||
msg_ok "Started Service"
|
|
||||||
msg_ok "Updated successfully"
|
|
||||||
else
|
|
||||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
|
||||||
fi
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
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 "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Copyright (c) 2021-2026 community-scripts ORG
|
|
||||||
# Author: Slaviša Arežina (tremor021)
|
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
||||||
# Source: https://wakapi.dev/ | https://github.com/muety/wakapi
|
|
||||||
|
|
||||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
||||||
color
|
|
||||||
verb_ip6
|
|
||||||
catch_errors
|
|
||||||
setting_up_container
|
|
||||||
network_check
|
|
||||||
update_os
|
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
|
||||||
$STD apk add --no-cache \
|
|
||||||
ca-certificates \
|
|
||||||
tzdata
|
|
||||||
$STD update-ca-certificates
|
|
||||||
$STD apk add --no-cache go --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
|
|
||||||
msg_ok "Installed Dependencies"
|
|
||||||
|
|
||||||
fetch_and_deploy_gh_release "wakapi" "muety/wakapi" "tarball"
|
|
||||||
|
|
||||||
msg_info "Configuring Wakapi"
|
|
||||||
LOCAL_IP=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
|
|
||||||
cd /opt/wakapi
|
|
||||||
$STD go mod download
|
|
||||||
$STD go build -o wakapi
|
|
||||||
cp config.default.yml config.yml
|
|
||||||
sed -i 's/listen_ipv6: ::1/listen_ipv6: "-"/g' config.yml
|
|
||||||
sed -i 's/listen_ipv4: 127.0.0.1/listen_ipv4: "0.0.0.0"/g' config.yml
|
|
||||||
sed -i "s/public_url: http:\/\/localhost:3000/public_url: http:\/\/$LOCAL_IP:3000/g" config.yml
|
|
||||||
msg_ok "Configured Wakapi"
|
|
||||||
|
|
||||||
msg_info "Enabling Wakapi Service"
|
|
||||||
cat <<EOF >/etc/init.d/wakapi
|
|
||||||
#!/sbin/openrc-run
|
|
||||||
description="Wakapi Service"
|
|
||||||
directory="/opt/wakapi"
|
|
||||||
command="/opt/wakapi/wakapi"
|
|
||||||
command_args="-config config.yml"
|
|
||||||
command_background="true"
|
|
||||||
command_user="root"
|
|
||||||
pidfile="/var/run/wakapi.pid"
|
|
||||||
|
|
||||||
depend() {
|
|
||||||
use net
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
chmod +x /etc/init.d/wakapi
|
|
||||||
$STD rc-update add wakapi default
|
|
||||||
msg_ok "Enabled Wakapi Service"
|
|
||||||
|
|
||||||
msg_info "Starting Wakapi"
|
|
||||||
$STD rc-service wakapi start
|
|
||||||
msg_ok "Started Wakapi"
|
|
||||||
|
|
||||||
motd_ssh
|
|
||||||
customize
|
|
||||||
@@ -89,26 +89,31 @@ VERSION=$(curl -fsSL https://api.github.com/repos/coder/code-server/releases/lat
|
|||||||
awk '{print substr($2, 3, length($2)-4) }')
|
awk '{print substr($2, 3, length($2)-4) }')
|
||||||
|
|
||||||
msg_info "Installing Code-Server v${VERSION}"
|
msg_info "Installing Code-Server v${VERSION}"
|
||||||
|
config_path="${HOME}/.config/code-server/config.yaml"
|
||||||
|
preexisting_config=false
|
||||||
|
|
||||||
if [ -f ~/.config/code-server/config.yaml ]; then
|
if [ -f "$config_path" ]; then
|
||||||
existing_config=true
|
preexisting_config=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl -fOL https://github.com/coder/code-server/releases/download/v"$VERSION"/code-server_"${VERSION}"_amd64.deb &>/dev/null
|
curl -fOL https://github.com/coder/code-server/releases/download/v"$VERSION"/code-server_"${VERSION}"_amd64.deb &>/dev/null
|
||||||
dpkg -i code-server_"${VERSION}"_amd64.deb &>/dev/null
|
dpkg -i code-server_"${VERSION}"_amd64.deb &>/dev/null
|
||||||
rm -rf code-server_"${VERSION}"_amd64.deb
|
rm -rf code-server_"${VERSION}"_amd64.deb
|
||||||
mkdir -p ~/.config/code-server/
|
mkdir -p "${HOME}/.config/code-server/"
|
||||||
systemctl enable -q --now code-server@"$USER"
|
|
||||||
|
|
||||||
if [ $existing_config = false ]; then
|
if [ "$preexisting_config" = false ]; then
|
||||||
cat <<EOF >~/.config/code-server/config.yaml
|
cat <<EOF >"$config_path"
|
||||||
bind-addr: 0.0.0.0:8680
|
bind-addr: 0.0.0.0:8680
|
||||||
auth: none
|
auth: none
|
||||||
password:
|
password:
|
||||||
cert: false
|
cert: false
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
systemctl enable -q --now code-server@"$USER"
|
||||||
systemctl restart code-server@"$USER"
|
systemctl restart code-server@"$USER"
|
||||||
|
if ! systemctl is-active --quiet code-server@"$USER"; then
|
||||||
|
error_exit "code-server service failed to start."
|
||||||
|
fi
|
||||||
msg_ok "Installed Code-Server v${VERSION} on $hostname"
|
msg_ok "Installed Code-Server v${VERSION} on $hostname"
|
||||||
|
|
||||||
echo -e "${APP} should be reachable by going to the following URL.
|
echo -e "${APP} should be reachable by going to the following URL.
|
||||||
|
|||||||
Reference in New Issue
Block a user