Address further reviewer comments

This commit is contained in:
Gerhard Burger 2024-11-27 21:37:12 +01:00
parent b8a16376d4
commit 612569b955
2 changed files with 30 additions and 36 deletions

View File

@ -57,9 +57,8 @@ header_info
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -d /opt/outline ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /opt/outline ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
RELEASE_TAG=$(curl -s https://api.github.com/repos/outline/outline/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') RELEASE=$(curl -s https://api.github.com/repos/outline/outline/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
RELEASE=${RELEASE_TAG#v} if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
if [[ "${RELEASE}" != "$(cat /opt/Outline_version.txt)" ]] || [[ ! -f /opt/Outline_version.txt ]]; then
msg_info "Stopping ${APP}" msg_info "Stopping ${APP}"
systemctl stop outline systemctl stop outline
msg_ok "Stopped ${APP}" msg_ok "Stopped ${APP}"
@ -68,8 +67,8 @@ if [[ "${RELEASE}" != "$(cat /opt/Outline_version.txt)" ]] || [[ ! -f /opt/Outli
cd /opt cd /opt
cp /opt/outline/.env /opt/.env cp /opt/outline/.env /opt/.env
mv /opt/outline /opt/outline_bak mv /opt/outline /opt/outline_bak
wget -q "https://github.com/outline/outline/archive/refs/tags/${RELEASE_TAG}.zip" wget -q "https://github.com/outline/outline/archive/refs/tags/v${RELEASE}.zip"
unzip -q ${RELEASE_TAG}.zip unzip -q v${RELEASE}.zip
mv outline-${RELEASE} /opt/outline mv outline-${RELEASE} /opt/outline
cd /opt/outline cd /opt/outline
@ -91,7 +90,7 @@ if [[ "${RELEASE}" != "$(cat /opt/Outline_version.txt)" ]] || [[ ! -f /opt/Outli
msg_ok "Started ${APP}" msg_ok "Started ${APP}"
msg_info "Cleaning up" msg_info "Cleaning up"
rm -rf /opt/${RELEASE_TAG}.zip rm -rf /opt/v${RELEASE}.zip
rm -rf /opt/outline_bak rm -rf /opt/outline_bak
msg_ok "Cleaned" msg_ok "Cleaned"
msg_ok "Updated Successfully" msg_ok "Updated Successfully"

View File

@ -58,14 +58,14 @@ $STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PAS
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER WITH CREATEDB;" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER WITH CREATEDB;"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';"
cat <<EOF >~/outline.creds {
Outline-Credentials echo "Outline-Credentials"
Outline Database User: $DB_USER echo "Outline Database User: $DB_USER"
Outline Database Password: $DB_PASS echo "Outline Database Password: $DB_PASS"
Outline Database Name: $DB_NAME echo "Outline Database Name: $DB_NAME"
Outline Secret: $SECRET_KEY echo "Outline Secret: $SECRET_KEY"
Outline Utils Secret: $UTILS_SECRET echo "Outline Utils Secret: $UTILS_SECRET"
EOF } >~/outline.creds
msg_ok "Set up PostgreSQL DB" msg_ok "Set up PostgreSQL DB"
@ -76,25 +76,23 @@ if [[ "${adminer_prompt,,}" =~ ^(y|yes)$ ]]; then
$STD a2enconf adminer $STD a2enconf adminer
systemctl reload apache2 systemctl reload apache2
IP=$(hostname -I | awk '{print $1}') IP=$(hostname -I | awk '{print $1}')
cat <<EOF >>~/outline.creds {
echo ""
Adminer Interface: $IP/adminer/ echo "Adminer Interface: $IP/adminer/"
Adminer System: PostgreSQL echo "Adminer System: PostgreSQL"
Adminer Server: localhost:5432 echo "Adminer Server: localhost:5432"
Adminer Username: $DB_USER echo "Adminer Username: $DB_USER"
Adminer Password: $DB_PASS echo "Adminer Password: $DB_PASS"
Adminer Database: $DB_NAME echo "Adminer Database: $DB_NAME"
EOF } >>~/outline.creds
msg_ok "Installed Adminer" msg_ok "Installed Adminer"
fi fi
read -r -p "Enter the public url for your Outline instance (e.g., https://outline.your-domain.tld)): " URL
msg_info "Installing Outline (Patience)" msg_info "Installing Outline (Patience)"
cd /opt cd /opt
RELEASE_TAG=$(curl -s https://api.github.com/repos/outline/outline/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') RELEASE=$(curl -s https://api.github.com/repos/outline/outline/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
RELEASE=${RELEASE_TAG#v} wget -q "https://github.com/outline/outline/archive/refs/tags/v${RELEASE}.zip"
wget -q "https://github.com/outline/outline/archive/refs/tags/${RELEASE_TAG}.zip" unzip -q v${RELEASE}.zip
unzip -q ${RELEASE_TAG}.zip
mv outline-${RELEASE} /opt/outline mv outline-${RELEASE} /opt/outline
cd /opt/outline cd /opt/outline
@ -106,25 +104,22 @@ rm -rf ./node_modules
$STD yarn install --production=true --frozen-lockfile $STD yarn install --production=true --frozen-lockfile
$STD yarn cache clean $STD yarn cache clean
FILE_STORAGE_LOCAL_ROOT_DIR=/var/lib/outline/data mkdir -p /var/opt/outline/data
mkdir -p $FILE_STORAGE_LOCAL_ROOT_DIR
cat <<EOF >/opt/outline/.env cat <<EOF >/opt/outline/.env
NODE_ENV=production NODE_ENV=production
URL=
SECRET_KEY=$SECRET_KEY SECRET_KEY=$SECRET_KEY
UTILS_SECRET=$UTILS_SECRET UTILS_SECRET=$UTILS_SECRET
DATABASE_URL=$DATABASE_URL DATABASE_URL=$DATABASE_URL
REDIS_URL=redis://localhost:6379 REDIS_URL=redis://localhost:6379
URL=$URL
FILE_STORAGE=local FILE_STORAGE=local
FILE_STORAGE_LOCAL_ROOT_DIR=$FILE_STORAGE_LOCAL_ROOT_DIR FILE_STORAGE_LOCAL_ROOT_DIR=/var/opt/outline/data
FILE_STORAGE_UPLOAD_MAX_SIZE=262144000 FILE_STORAGE_UPLOAD_MAX_SIZE=262144000
WEB_CONCURRENCY=2 WEB_CONCURRENCY=2
EOF EOF
$STD yarn sequelize db:create echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
echo "${RELEASE}" >/opt/Outline_version.txt
msg_ok "Installed Outline" msg_ok "Installed Outline"
msg_info "Creating Service" msg_info "Creating Service"
@ -148,7 +143,7 @@ motd_ssh
customize customize
msg_info "Cleaning up" msg_info "Cleaning up"
rm /opt/${RELEASE_TAG}.zip rm -rf /opt/v${RELEASE}.zip
$STD apt-get -y autoremove $STD apt-get -y autoremove
$STD apt-get -y autoclean $STD apt-get -y autoclean
msg_ok "Cleaned" msg_ok "Cleaned"