This commit is contained in:
Slaviša Arežina 2025-08-01 07:24:13 +02:00 committed by GitHub
parent b6bd8a6de4
commit 654bd1f0d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 21 deletions

View File

@ -27,36 +27,32 @@ function update_script() {
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
if [[ ! -f ~/.outline ]] || [[ "${RELEASE}" != "$(cat ~/.outline)" ]]; then
msg_info "Stopping Services"
systemctl stop outline
msg_ok "Services Stopped"
msg_info "Updating ${APP} to ${RELEASE}"
temp_file=$(mktemp)
msg_info "Creating backup"
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
msg_ok "Backup created"
fetch_and_deploy_gh_release "outline" "outline/outline" "tarball"
msg_info "Updating ${APP} to ${RELEASE}"
cd /opt/outline
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}"

View File

@ -40,14 +40,11 @@ $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';"
} >>~/outline.creds
msg_ok "Set up PostgreSQL Database"
msg_info "Setup Outline (Patience)"
fetch_and_deploy_gh_release "outline" "outline/outline" "tarball"
msg_info "Configuring Outline (Patience)"
SECRET_KEY="$(openssl rand -hex 32)"
temp_file=$(mktemp)
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) }')
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
cp .env.sample .env
export NODE_ENV=development
@ -62,8 +59,7 @@ export NODE_OPTIONS="--max-old-space-size=3584"
$STD yarn build
sed -i 's/NODE_ENV=development/NODE_ENV=production/g' /opt/outline/.env
export NODE_ENV=production
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
msg_ok "Setup Outline"
msg_ok "Configured Outline"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/outline.service
@ -89,7 +85,6 @@ motd_ssh
customize
msg_info "Cleaning up"
rm -rf $temp_file
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"