Updated using docs
This commit is contained in:
25
ct/koffan.sh
25
ct/koffan.sh
@@ -6,13 +6,13 @@ source <(curl -s https://raw.githubusercontent.com/AminGholizad/ProxmoxVED/main/
|
|||||||
# Source: https://github.com/PanSalut/Koffan
|
# Source: https://github.com/PanSalut/Koffan
|
||||||
|
|
||||||
APP="Koffan"
|
APP="Koffan"
|
||||||
var_tags="productivity"
|
var_tags="${var_tags:-productivity}"
|
||||||
var_cpu="1"
|
var_cpu="${var_cpu:-1}"
|
||||||
var_ram="512"
|
var_ram="${var_ram:-512}"
|
||||||
var_disk="4"
|
var_disk="${var_disk:-4}"
|
||||||
var_os="debian"
|
var_os="${var_os:-debian}"
|
||||||
var_version="13"
|
var_version="${var_version:-13}"
|
||||||
var_unprivileged="1"
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
|
|
||||||
header_info "$APP"
|
header_info "$APP"
|
||||||
variables
|
variables
|
||||||
@@ -34,9 +34,9 @@ function update_script() {
|
|||||||
systemctl stop koffan
|
systemctl stop koffan
|
||||||
msg_ok "Stopped Service"
|
msg_ok "Stopped Service"
|
||||||
|
|
||||||
msg_info "Creating Backup"
|
msg_info "Backing up Data"
|
||||||
tar -czf /opt/koffan_backup_$(date +%F).tar.gz /opt/data/
|
cp -r /opt/koffan/data /opt/koffan_data_backup 2>/dev/null || true
|
||||||
msg_ok "Backup Created"
|
msg_ok "Backed up Data"
|
||||||
|
|
||||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "koffan" "PanSalut/Koffan"
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "koffan" "PanSalut/Koffan"
|
||||||
|
|
||||||
@@ -45,6 +45,11 @@ function update_script() {
|
|||||||
go build -o koffan main.go
|
go build -o koffan main.go
|
||||||
msg_ok "Rebuild Completed"
|
msg_ok "Rebuild Completed"
|
||||||
|
|
||||||
|
msg_info "Restoring Data"
|
||||||
|
cp -r /opt/koffan_data_backup/. /opt/koffan/data/ 2>/dev/null || true
|
||||||
|
rm -rf /opt/koffan_data_backup
|
||||||
|
msg_ok "Restored Data"
|
||||||
|
|
||||||
msg_info "Starting Service"
|
msg_info "Starting Service"
|
||||||
systemctl start koffan
|
systemctl start koffan
|
||||||
msg_ok "Started Service"
|
msg_ok "Started Service"
|
||||||
|
|||||||
@@ -24,23 +24,23 @@ go build -o koffan main.go
|
|||||||
msg_ok "Building Completed"
|
msg_ok "Building Completed"
|
||||||
|
|
||||||
msg_info "Configuring Koffan"
|
msg_info "Configuring Koffan"
|
||||||
mkdir /opt/data
|
mkdir /opt/koffan/data
|
||||||
cat <<EOF >/opt/data/.env
|
cat <<EOF >/opt/koffan/data/.env
|
||||||
APP_ENV=production
|
APP_ENV=production
|
||||||
APP_PASSWORD=shopping123
|
APP_PASSWORD=shopping123
|
||||||
PORT=3000
|
PORT=3000
|
||||||
DB_PATH=/opt/data/shopping.db
|
DB_PATH=/opt/koffan/data/shopping.db
|
||||||
EOF
|
EOF
|
||||||
msg_ok "Configuration Completed"
|
msg_ok "Configuration Completed"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating systemd service"
|
||||||
cat <<EOF >/etc/systemd/system/koffan.service
|
cat <<EOF >/etc/systemd/system/koffan.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Koffan Service
|
Description=Koffan Service
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
EnvironmentFile=/opt/data/.env
|
EnvironmentFile=/opt/koffan/data/.env
|
||||||
WorkingDirectory=/opt/koffan
|
WorkingDirectory=/opt/koffan
|
||||||
ExecStart=/opt/koffan/koffan
|
ExecStart=/opt/koffan/koffan
|
||||||
Restart=always
|
Restart=always
|
||||||
@@ -48,9 +48,11 @@ Restart=always
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
systemctl enable -q --now koffan
|
msg_ok "Service created"
|
||||||
msg_ok "Created Service"
|
|
||||||
|
|
||||||
|
msg_info "Finalizing Koffan installation"
|
||||||
|
systemctl enable -q --now koffan
|
||||||
motd_ssh
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
|
msg_ok "Koffan installation complete"
|
||||||
cleanup_lxc
|
cleanup_lxc
|
||||||
|
|||||||
Reference in New Issue
Block a user