1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-04-19 22:08:07 +00:00

Installation and update fixes (#3895)

This commit is contained in:
Slaviša Arežina 2025-04-15 13:03:51 +02:00 committed by GitHub
parent e8e4748c96
commit cabcdc272e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 50 additions and 45 deletions

View File

@ -20,45 +20,48 @@ color
catch_errors catch_errors
function update_script() { function update_script() {
header_info header_info
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -d /opt/outline ]]; then if [[ ! -d /opt/outline ]]; then
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/outline/outline/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Stopping Services"
systemctl stop outline
msg_ok "Services Stopped"
msg_info "Updating ${APP} to ${RELEASE}"
temp_file=$(mktemp)
rm -rf /opt/outline/node_modules
curl -fsSL "https://github.com/outline/outline/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
tar zxf $temp_file
cp -rf outline-${RELEASE}/* /opt/outline
cd /opt/outline
export NODE_OPTIONS="--max-old-space-size=3584"
$STD yarn install --frozen-lockfile
$STD yarn build
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP}"
msg_info "Starting Services"
systemctl start outline
msg_ok "Started Services"
msg_info "Cleaning Up"
rm -rf $temp_file
rm -rf $HOME/outline-${RELEASE}
msg_ok "Cleaned"
msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit exit
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/outline/outline/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Stopping Services"
systemctl stop outline
msg_ok "Services Stopped"
msg_info "Updating ${APP} to ${RELEASE}"
temp_file=$(mktemp)
cp /opt/outline/.env /opt
rm -rf /opt/outline
curl -fsSL "https://github.com/outline/outline/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
tar zxf "$temp_file"
mv outline-"${RELEASE}" /opt/outline
cd /opt/outline || exit
export NODE_ENV=development
export NODE_OPTIONS="--max-old-space-size=3584"
$STD yarn install --frozen-lockfile
$STD yarn build
mv /opt/.env /opt/outline
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP}"
msg_info "Starting Services"
systemctl start outline
msg_ok "Started Services"
msg_info "Cleaning Up"
rm -rf "$temp_file"
rm -rf "$HOME"/outline-"${RELEASE}"
msg_ok "Cleaned"
msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit
} }
start start

View File

@ -15,10 +15,10 @@ update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt-get install -y \ $STD apt-get install -y \
gnupg \ gnupg \
mkcert \ mkcert \
git \ git \
redis redis
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Setting up Node.js Repository" msg_info "Setting up Node.js Repository"
@ -43,7 +43,6 @@ $STD apt-get install -y postgresql-16
DB_NAME="outline" DB_NAME="outline"
DB_USER="outline" DB_USER="outline"
DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)" DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
SECRET_KEY="$(openssl rand -hex 32)"
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" $STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" $STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
@ -52,6 +51,7 @@ $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';"
msg_ok "Set up PostgreSQL" msg_ok "Set up PostgreSQL"
msg_info "Setup Outline (Patience)" msg_info "Setup Outline (Patience)"
SECRET_KEY="$(openssl rand -hex 32)"
temp_file=$(mktemp) temp_file=$(mktemp)
LOCAL_IP="$(hostname -I | awk '{print $1}')" LOCAL_IP="$(hostname -I | awk '{print $1}')"
RELEASE=$(curl -fsSL https://api.github.com/repos/outline/outline/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') RELEASE=$(curl -fsSL https://api.github.com/repos/outline/outline/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
@ -60,6 +60,7 @@ tar zxf $temp_file
mv outline-${RELEASE} /opt/outline mv outline-${RELEASE} /opt/outline
cd /opt/outline cd /opt/outline
cp .env.sample .env cp .env.sample .env
export NODE_ENV=development
sed -i 's/NODE_ENV=production/NODE_ENV=development/g' /opt/outline/.env sed -i 's/NODE_ENV=production/NODE_ENV=development/g' /opt/outline/.env
sed -i "s/generate_a_new_key/${SECRET_KEY}/g" /opt/outline/.env sed -i "s/generate_a_new_key/${SECRET_KEY}/g" /opt/outline/.env
sed -i "s/user:pass@postgres/${DB_USER}:${DB_PASS}@localhost/g" /opt/outline/.env sed -i "s/user:pass@postgres/${DB_USER}:${DB_PASS}@localhost/g" /opt/outline/.env
@ -70,6 +71,7 @@ $STD yarn install --frozen-lockfile
export NODE_OPTIONS="--max-old-space-size=3584" export NODE_OPTIONS="--max-old-space-size=3584"
$STD yarn build $STD yarn build
sed -i 's/NODE_ENV=development/NODE_ENV=production/g' /opt/outline/.env sed -i 's/NODE_ENV=development/NODE_ENV=production/g' /opt/outline/.env
export NODE_ENV=production
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
msg_ok "Setup Outline" msg_ok "Setup Outline"
@ -83,7 +85,7 @@ After=network.target
Type=simple Type=simple
User=root User=root
WorkingDirectory=/opt/outline WorkingDirectory=/opt/outline
ExecStart=/usr/bin/node ./build/server/index.js ExecStart=/usr/bin/yarn start
Restart=always Restart=always
EnvironmentFile=/opt/outline/.env EnvironmentFile=/opt/outline/.env