From 76807c72e4343da87a9d446671e127520c800825 Mon Sep 17 00:00:00 2001
From: Gerhard Burger
Date: Sat, 23 Nov 2024 15:10:38 +0100
Subject: [PATCH 1/9] Added outline
---
ct/outline.sh | 109 +++++++++++++++++++++++++
install/outline-install.sh | 157 +++++++++++++++++++++++++++++++++++++
json/outline.json | 47 +++++++++++
3 files changed, 313 insertions(+)
create mode 100644 ct/outline.sh
create mode 100644 install/outline-install.sh
create mode 100644 json/outline.json
diff --git a/ct/outline.sh b/ct/outline.sh
new file mode 100644
index 00000000000..e0aa9fa70e1
--- /dev/null
+++ b/ct/outline.sh
@@ -0,0 +1,109 @@
+#!/usr/bin/env bash
+source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
+# Copyright (c) 2024 community-scripts ORG
+# Author: Gerhard Burger (burgerga)
+# License: MIT
+# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
+
+function header_info {
+clear
+cat <<"EOF"
+ ____ __ ___
+ / __ \__ __/ /_/ (_)___ ___
+ / / / / / / / __/ / / __ \/ _ \
+/ /_/ / /_/ / /_/ / / / / / __/
+\____/\__,_/\__/_/_/_/ /_/\___/
+
+EOF
+}
+header_info
+echo -e "Loading..."
+APP="Outline"
+var_disk="8"
+var_cpu="2"
+var_ram="4096"
+var_os="debian"
+var_version="12"
+variables
+color
+catch_errors
+
+function default_settings() {
+ CT_TYPE="1"
+ PW=""
+ CT_ID=$NEXTID
+ HN=$NSAPP
+ DISK_SIZE="$var_disk"
+ CORE_COUNT="$var_cpu"
+ RAM_SIZE="$var_ram"
+ BRG="vmbr0"
+ NET="dhcp"
+ GATE=""
+ APT_CACHER=""
+ APT_CACHER_IP=""
+ DISABLEIP6="no"
+ MTU=""
+ SD=""
+ NS=""
+ MAC=""
+ VLAN=""
+ SSH="no"
+ VERB="no"
+ echo_default
+}
+
+function update_script() {
+header_info
+check_container_storage
+check_container_resources
+if [[ ! -d /opt/outline ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
+RELEASE=$(curl -s https://api.github.com/repos/outline/outline/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
+if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
+ msg_info "Stopping ${APP}"
+ systemctl stop outline
+ msg_ok "Stopped ${APP}"
+
+ msg_info "Updating ${APP} to ${RELEASE} (Patience)"
+ cd /opt
+ cp /opt/outline/.env /opt/.env
+ mv /opt/outline /opt/outline_bak
+ wget -q "https://github.com/outline/outline/archive/refs/tags/${RELEASE}.zip"
+ unzip -q ${RELEASE}.zip
+ mv outline-${RELEASE:1} /opt/outline
+ cd /opt/outline
+
+ ## Build in development mode
+ unset NODE_ENV
+ yarn install --no-optional --frozen-lockfile &>/dev/null &&
+ yarn cache clean &>/dev/null &&
+ yarn build &>/dev/null
+
+ ## Continue in production mode
+ rm -rf ./node_modules
+ yarn install --production=true--frozen-lockfile &>/dev/null &&
+ yarn cache clean &>/dev/null
+
+ mv /opt/.env /opt/outline/.env
+
+ echo "${RELEASE}" >/opt/${APP}_version.txt
+ msg_ok "Updated ${APP} to ${RELEASE}"
+
+ msg_info "Starting ${APP}"
+ systemctl start outline
+ msg_ok "Started ${APP}"
+ msg_info "Cleaning up"
+ rm -rf /opt/${RELEASE}.zip
+ rm -rf /opt/outline_bak
+ msg_ok "Cleaned"
+ msg_ok "Updated Successfully"
+else
+ msg_ok "No update required. ${APP} is already at ${RELEASE}."
+fi
+exit
+}
+
+start
+build_container
+description
+
+msg_ok "Completed Successfully!\n"
diff --git a/install/outline-install.sh b/install/outline-install.sh
new file mode 100644
index 00000000000..a144d364b19
--- /dev/null
+++ b/install/outline-install.sh
@@ -0,0 +1,157 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2024 community-scripts ORG
+# Author: Gerhard Burger (burgerga)
+# License: MIT
+# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
+
+read -r -p "Enter the public url for your Outline instance (e.g., https://outline.your-domain.tld)): " URL
+read -r -p "Would you like to add Adminer? " adminer_prompt
+
+source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
+color
+verb_ip6
+catch_errors
+setting_up_container
+network_check
+update_os
+
+msg_info "Installing Dependencies"
+$STD apt-get install -y \
+ sudo \
+ curl \
+ lsb-release \
+ postgresql \
+ gnupg \
+ unzip
+msg_ok "Installed Dependencies"
+
+msg_info "Setting up Node.js Repository"
+NODE_MAJOR=20
+mkdir -p /etc/apt/keyrings
+wget -qO- https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
+echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
+msg_ok "Set up Node.js Repository"
+
+msg_info "Setting up Redis Repository"
+wget -qO- https://packages.redis.io/gpg | gpg --dearmor -o /etc/apt/keyrings/redis-archive-keyring.gpg
+echo "deb [signed-by=/etc/apt/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" >/etc/apt/sources.list.d/redis.list
+msg_ok "Set up Redis Repository"
+
+msg_info "Installing Node.js/Yarn"
+$STD apt-get update
+$STD apt-get install -y nodejs
+$STD npm install -g yarn
+msg_ok "Installed Node.js/Yarn"
+
+msg_info "Installing Redis"
+$STD apt-get install -y redis
+sed -i 's/^bind .*/bind 0.0.0.0/' /etc/redis/redis.conf
+systemctl enable -q --now redis-server.service
+msg_ok "Installed Redis"
+
+msg_info "Setting up PostgreSQL DB"
+SECRET_KEY="$(openssl rand -hex 32)"
+UTILS_SECRET="$(openssl rand -hex 32)"
+DB_NAME=outlinedb
+DB_USER=outline
+DB_PASS="$(openssl rand -base64 18 | tr -d '/' | cut -c1-13)"
+DATABASE_URL="postgres://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}"
+$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
+$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';"
+
+{
+ echo "Outline-Credentials"
+ echo "Outline Database User: $DB_USER"
+ echo "Outline Database Password: $DB_PASS"
+ echo "Outline Database Name: $DB_NAME"
+ echo "Outline Secret: $SECRET_KEY"
+ echo "Outline Utils Secret: $UTILS_SECRET"
+} >> ~/outline.creds
+msg_ok "Set up PostgreSQL DB"
+
+
+if [[ "${adminer_prompt,,}" =~ ^(y|yes)$ ]]; then
+ msg_info "Installing Adminer"
+ $STD apt install -y adminer
+ $STD a2enconf adminer
+ systemctl reload apache2
+ IP=$(hostname -I | awk '{print $1}')
+ {
+ echo ""
+ echo "Adminer Interface: $IP/adminer/"
+ echo "Adminer System: PostgreSQL"
+ echo "Adminer Server: localhost:5432"
+ echo "Adminer Username: $DB_USER"
+ echo "Adminer Password: $DB_PASS"
+ echo "Adminer Database: $DB_NAME"
+ } >> ~/outline.creds
+ msg_ok "Installed Adminer"
+fi
+
+msg_info "Installing $APPLICATION (Patience)"
+cd /opt
+RELEASE=$(curl -s https://api.github.com/repos/outline/outline/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
+wget -q "https://github.com/outline/outline/archive/refs/tags/${RELEASE}.zip"
+unzip -q ${RELEASE}.zip
+mv outline-${RELEASE:1} /opt/outline
+cd /opt/outline
+
+## First build in development
+$STD yarn install --no-optional --frozen-lockfile
+$STD yarn cache clean
+$STD yarn build
+
+## Continue in production
+rm -rf ./node_modules
+$STD yarn install --production=true--frozen-lockfile
+$STD yarn cache clean
+
+FILE_STORAGE_LOCAL_ROOT_DIR=/var/lib/outline/data
+mkdir -p $FILE_STORAGE_LOCAL_ROOT_DIR
+
+{
+ echo NODE_ENV=production
+ echo SECRET_KEY=$SECRET_KEY
+ echo UTILS_SECRET=$UTILS_SECRET
+ echo DATABASE_URL=$DATABASE_URL
+ echo REDIS_URL=redis://localhost:6379
+ echo URL=$URL
+ echo FILE_STORAGE=local
+ echo FILE_STORAGE_LOCAL_ROOT_DIR=$FILE_STORAGE_LOCAL_ROOT_DIR
+ echo FILE_STORAGE_UPLOAD_MAX_SIZE=262144000
+ echo WEB_CONCURRENCY=2
+} > /opt/outline/.env
+
+$STD yarn sequelize db:create
+$STD yarn sequelize db:migrate
+
+echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
+msg_ok "Installed $APPLICATION"
+
+msg_info "Creating Service"
+cat </etc/systemd/system/outline.service
+[Unit]
+Description=Linkwarden Service
+After=network.target
+
+[Service]
+Type=exec
+WorkingDirectory=/opt/outline
+ExecStart=/usr/bin/yarn start
+
+[Install]
+WantedBy=multi-user.target
+EOF
+systemctl enable -q --now outline.service
+msg_ok "Created Service"
+
+motd_ssh
+customize
+
+msg_info "Cleaning up"
+rm -rf /opt/${RELEASE}.zip
+$STD apt-get -y autoremove
+$STD apt-get -y autoclean
+msg_ok "Cleaned"
diff --git a/json/outline.json b/json/outline.json
new file mode 100644
index 00000000000..c6cd2d32f2e
--- /dev/null
+++ b/json/outline.json
@@ -0,0 +1,47 @@
+{
+ "name": "Outline",
+ "slug": "outline",
+ "categories": [
+ 14
+ ],
+ "date_created": "2024-11-23",
+ "type": "ct",
+ "updateable": true,
+ "privileged": false,
+ "interface_port": "3000",
+ "documentation": "https://docs.getoutline.com/s/guide",
+ "website": "https://www.getoutline.com/",
+ "logo": "https://raw.githubusercontent.com/outline/outline/refs/heads/main/public/images/icon-192.png",
+ "description": "Outline is the fastest knowledge base for growing teams. Beautiful, realtime collaborative, feature packed, and markdown compatible.",
+ "install_methods": [
+ {
+ "type": "default",
+ "script": "ct/outline.sh",
+ "resources": {
+ "cpu": "2",
+ "ram": "4096",
+ "hdd": "8",
+ "os": "debian",
+ "version": "12"
+ }
+ }
+ ],
+ "default_credentials": {
+ "username": null,
+ "password": null
+ },
+ "notes": [
+ {
+ "text": "Outline needs to be behind a reverse proxy (e.g., Nginx Proxy Manager) to obtain HTTPS and to allow clients to connect. The https URL on which Outline should be reached, is prompted in the script and might not be trivial to change after installation!",
+ "type": "warning"
+ },
+ {
+ "text": "At least one identity provider from `https://docs.getoutline.com/s/hosting/doc/authentication-7ViKRmRY5o` needs to be added to `/opt/outline/.env` to allow users to login, also SMTP can be configured here (look at `/opt/outline/.env.sample` for the correct ENV vars). After editing, restart outline with `systemctl restart outline`.",
+ "type": "warning"
+ },
+ {
+ "text": "Show database credentials: `cat ~/outline.creds`",
+ "type": "info"
+ }
+ ]
+}
From 60f1a6bda2bdf291377114d7e1262d1b693e8c6e Mon Sep 17 00:00:00 2001
From: Gerhard Burger
Date: Sat, 23 Nov 2024 15:20:25 +0100
Subject: [PATCH 2/9] Temporary override of community-scripts url
---
ct/outline.sh | 2 +-
misc/build.func | 12 ++++++------
misc/install.func | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/ct/outline.sh b/ct/outline.sh
index e0aa9fa70e1..aacff200196 100644
--- a/ct/outline.sh
+++ b/ct/outline.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
+source <(curl -s https://raw.githubusercontent.com/burgerga/ProxmoxVE/add_outline/misc/build.func)
# Copyright (c) 2024 community-scripts ORG
# Author: Gerhard Burger (burgerga)
# License: MIT
diff --git a/misc/build.func b/misc/build.func
index aee3366a8b8..a3e163680bf 100644
--- a/misc/build.func
+++ b/misc/build.func
@@ -505,13 +505,13 @@ install_script() {
check_container_resources() {
# Check actual RAM & Cores
current_ram=$(free -m | awk '/^Mem:/{print $2}')
- current_cpu=$(nproc)
+ current_cpu=$(nproc)
# Check whether the current RAM is less than the required RAM or the CPU cores are less than required
if [[ "$current_ram" -lt "$var_ram" ]] || [[ "$current_cpu" -lt "$var_cpu" ]]; then
echo -e "\n⚠️${HOLD} ${GN}Required: ${var_cpu} CPU, ${var_ram}MB RAM ${CL}| ${RD}Current: ${current_cpu} CPU, ${current_ram}MB RAM${CL}"
echo -e "${YWB}Please ensure that the ${APP} LXC is configured with at least ${var_cpu} vCPU and ${var_ram} MB RAM for the build process.${CL}\n"
- exit 1
+ exit 1
else
echo -e ""
fi
@@ -525,7 +525,7 @@ check_container_storage() {
if (( usage > 80 )); then
# Prompt the user for confirmation to continue
echo -e "⚠️${HOLD} ${YWB}Warning: Storage is dangerously low (${usage}%).${CL}"
- read -r -p "Continue anyway? " prompt
+ read -r -p "Continue anyway? " prompt
# Check if the input is 'y' or 'yes', otherwise exit with status 1
if [[ ! ${prompt,,} =~ ^(y|yes)$ ]]; then
echo -e "❌${HOLD} ${YWB}Exiting based on user input.${CL}"
@@ -572,7 +572,7 @@ build_container() {
if [ "$var_os" == "alpine" ]; then
export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/alpine-install.func)"
else
- export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/install.func)"
+ export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/burgerga/ProxmoxVE/add_outline/misc/install.func)"
fi
export CACHER="$APT_CACHER"
export CACHER_IP="$APT_CACHER_IP"
@@ -666,7 +666,7 @@ http://dl-cdn.alpinelinux.org/alpine/latest-stable/community
EOF'
pct exec "$CTID" -- ash -c "apk add bash >/dev/null"
fi
- lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/install/$var_install.sh)" || exit
+ lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/burgerga/ProxmoxVE/add_outline/install/$var_install.sh)" || exit
}
@@ -688,7 +688,7 @@ description() {
-
+
GitHub
diff --git a/misc/install.func b/misc/install.func
index 2a22e2ff9f7..79dbfe28262 100644
--- a/misc/install.func
+++ b/misc/install.func
@@ -119,7 +119,7 @@ network_check() {
ipv6_connected=false
sleep 1
# Check IPv4 connectivity
- if ping -c 1 -W 1 1.1.1.1 &>/dev/null; then
+ if ping -c 1 -W 1 1.1.1.1 &>/dev/null; then
msg_ok "IPv4 Internet Connected";
ipv4_connected=true
else
@@ -198,6 +198,6 @@ EOF
systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
msg_ok "Customized Container"
fi
- echo "bash -c \"\$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/${app}.sh)\"" >/usr/bin/update
+ echo "bash -c \"\$(wget -qLO - https://github.com/burgerga/ProxmoxVE/raw/add_outline/ct/${app}.sh)\"" >/usr/bin/update
chmod +x /usr/bin/update
}
From 7d922d4f39811a9e3ed790745a88ef04726711c7 Mon Sep 17 00:00:00 2001
From: Gerhard Burger
Date: Sun, 24 Nov 2024 11:54:00 +0100
Subject: [PATCH 3/9] Revert "Temporary override of community-scripts url"
This reverts commit 60f1a6bda2bdf291377114d7e1262d1b693e8c6e.
---
ct/outline.sh | 2 +-
misc/build.func | 12 ++++++------
misc/install.func | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/ct/outline.sh b/ct/outline.sh
index aacff200196..e0aa9fa70e1 100644
--- a/ct/outline.sh
+++ b/ct/outline.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-source <(curl -s https://raw.githubusercontent.com/burgerga/ProxmoxVE/add_outline/misc/build.func)
+source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2024 community-scripts ORG
# Author: Gerhard Burger (burgerga)
# License: MIT
diff --git a/misc/build.func b/misc/build.func
index a3e163680bf..aee3366a8b8 100644
--- a/misc/build.func
+++ b/misc/build.func
@@ -505,13 +505,13 @@ install_script() {
check_container_resources() {
# Check actual RAM & Cores
current_ram=$(free -m | awk '/^Mem:/{print $2}')
- current_cpu=$(nproc)
+ current_cpu=$(nproc)
# Check whether the current RAM is less than the required RAM or the CPU cores are less than required
if [[ "$current_ram" -lt "$var_ram" ]] || [[ "$current_cpu" -lt "$var_cpu" ]]; then
echo -e "\n⚠️${HOLD} ${GN}Required: ${var_cpu} CPU, ${var_ram}MB RAM ${CL}| ${RD}Current: ${current_cpu} CPU, ${current_ram}MB RAM${CL}"
echo -e "${YWB}Please ensure that the ${APP} LXC is configured with at least ${var_cpu} vCPU and ${var_ram} MB RAM for the build process.${CL}\n"
- exit 1
+ exit 1
else
echo -e ""
fi
@@ -525,7 +525,7 @@ check_container_storage() {
if (( usage > 80 )); then
# Prompt the user for confirmation to continue
echo -e "⚠️${HOLD} ${YWB}Warning: Storage is dangerously low (${usage}%).${CL}"
- read -r -p "Continue anyway? " prompt
+ read -r -p "Continue anyway? " prompt
# Check if the input is 'y' or 'yes', otherwise exit with status 1
if [[ ! ${prompt,,} =~ ^(y|yes)$ ]]; then
echo -e "❌${HOLD} ${YWB}Exiting based on user input.${CL}"
@@ -572,7 +572,7 @@ build_container() {
if [ "$var_os" == "alpine" ]; then
export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/alpine-install.func)"
else
- export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/burgerga/ProxmoxVE/add_outline/misc/install.func)"
+ export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/install.func)"
fi
export CACHER="$APT_CACHER"
export CACHER_IP="$APT_CACHER_IP"
@@ -666,7 +666,7 @@ http://dl-cdn.alpinelinux.org/alpine/latest-stable/community
EOF'
pct exec "$CTID" -- ash -c "apk add bash >/dev/null"
fi
- lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/burgerga/ProxmoxVE/add_outline/install/$var_install.sh)" || exit
+ lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/install/$var_install.sh)" || exit
}
@@ -688,7 +688,7 @@ description() {
-
+
GitHub
diff --git a/misc/install.func b/misc/install.func
index 79dbfe28262..2a22e2ff9f7 100644
--- a/misc/install.func
+++ b/misc/install.func
@@ -119,7 +119,7 @@ network_check() {
ipv6_connected=false
sleep 1
# Check IPv4 connectivity
- if ping -c 1 -W 1 1.1.1.1 &>/dev/null; then
+ if ping -c 1 -W 1 1.1.1.1 &>/dev/null; then
msg_ok "IPv4 Internet Connected";
ipv4_connected=true
else
@@ -198,6 +198,6 @@ EOF
systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
msg_ok "Customized Container"
fi
- echo "bash -c \"\$(wget -qLO - https://github.com/burgerga/ProxmoxVE/raw/add_outline/ct/${app}.sh)\"" >/usr/bin/update
+ echo "bash -c \"\$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/${app}.sh)\"" >/usr/bin/update
chmod +x /usr/bin/update
}
From 4c99c917bb8ca19990a0dd05bb67ed14bdeb3a0e Mon Sep 17 00:00:00 2001
From: Gerhard Burger
Date: Sun, 24 Nov 2024 11:55:18 +0100
Subject: [PATCH 4/9] Fix service description
---
install/outline-install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install/outline-install.sh b/install/outline-install.sh
index a144d364b19..b5522bf505d 100644
--- a/install/outline-install.sh
+++ b/install/outline-install.sh
@@ -133,7 +133,7 @@ msg_ok "Installed $APPLICATION"
msg_info "Creating Service"
cat </etc/systemd/system/outline.service
[Unit]
-Description=Linkwarden Service
+Description=Outline Service
After=network.target
[Service]
From 302be583b6368b6ca0b06c02f1435cdfcf73b743 Mon Sep 17 00:00:00 2001
From: Gerhard Burger
Date: Wed, 27 Nov 2024 12:31:26 +0100
Subject: [PATCH 5/9] Address reviewer comments
---
ct/outline.sh | 23 +++++------
install/outline-install.sh | 84 +++++++++++++++++++-------------------
2 files changed, 52 insertions(+), 55 deletions(-)
diff --git a/ct/outline.sh b/ct/outline.sh
index e0aa9fa70e1..77c462d84c1 100644
--- a/ct/outline.sh
+++ b/ct/outline.sh
@@ -57,8 +57,9 @@ header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/outline ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
-RELEASE=$(curl -s https://api.github.com/repos/outline/outline/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
-if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
+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=${RELEASE_TAG#v}
+if [[ "${RELEASE}" != "$(cat /opt/Outline_version.txt)" ]] || [[ ! -f /opt/Outline_version.txt ]]; then
msg_info "Stopping ${APP}"
systemctl stop outline
msg_ok "Stopped ${APP}"
@@ -67,20 +68,17 @@ if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}
cd /opt
cp /opt/outline/.env /opt/.env
mv /opt/outline /opt/outline_bak
- wget -q "https://github.com/outline/outline/archive/refs/tags/${RELEASE}.zip"
- unzip -q ${RELEASE}.zip
- mv outline-${RELEASE:1} /opt/outline
+ wget -q "https://github.com/outline/outline/archive/refs/tags/${RELEASE_TAG}.zip"
+ unzip -q ${RELEASE_TAG}.zip
+ mv outline-${RELEASE} /opt/outline
cd /opt/outline
- ## Build in development mode
- unset NODE_ENV
- yarn install --no-optional --frozen-lockfile &>/dev/null &&
- yarn cache clean &>/dev/null &&
+ yarn install --no-optional --frozen-lockfile &>/dev/null
+ yarn cache clean &>/dev/null
yarn build &>/dev/null
- ## Continue in production mode
rm -rf ./node_modules
- yarn install --production=true--frozen-lockfile &>/dev/null &&
+ yarn install --production=true --frozen-lockfile &>/dev/null
yarn cache clean &>/dev/null
mv /opt/.env /opt/outline/.env
@@ -91,8 +89,9 @@ if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}
msg_info "Starting ${APP}"
systemctl start outline
msg_ok "Started ${APP}"
+
msg_info "Cleaning up"
- rm -rf /opt/${RELEASE}.zip
+ rm -rf /opt/${RELEASE_TAG}.zip
rm -rf /opt/outline_bak
msg_ok "Cleaned"
msg_ok "Updated Successfully"
diff --git a/install/outline-install.sh b/install/outline-install.sh
index b5522bf505d..6501598e3d9 100644
--- a/install/outline-install.sh
+++ b/install/outline-install.sh
@@ -5,9 +5,6 @@
# License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
-read -r -p "Enter the public url for your Outline instance (e.g., https://outline.your-domain.tld)): " URL
-read -r -p "Would you like to add Adminer? " adminer_prompt
-
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
color
verb_ip6
@@ -19,6 +16,7 @@ update_os
msg_info "Installing Dependencies"
$STD apt-get install -y \
sudo \
+ mc \
curl \
lsb-release \
postgresql \
@@ -61,74 +59,74 @@ $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 SET timezone TO 'UTC';"
-{
- echo "Outline-Credentials"
- echo "Outline Database User: $DB_USER"
- echo "Outline Database Password: $DB_PASS"
- echo "Outline Database Name: $DB_NAME"
- echo "Outline Secret: $SECRET_KEY"
- echo "Outline Utils Secret: $UTILS_SECRET"
-} >> ~/outline.creds
+cat <~/outline.creds
+Outline-Credentials
+Outline Database User: $DB_USER
+Outline Database Password: $DB_PASS
+Outline Database Name: $DB_NAME
+Outline Secret: $SECRET_KEY
+Outline Utils Secret: $UTILS_SECRET
+EOF
msg_ok "Set up PostgreSQL DB"
+read -r -p "Would you like to add Adminer? " adminer_prompt
if [[ "${adminer_prompt,,}" =~ ^(y|yes)$ ]]; then
msg_info "Installing Adminer"
$STD apt install -y adminer
$STD a2enconf adminer
systemctl reload apache2
IP=$(hostname -I | awk '{print $1}')
- {
- echo ""
- echo "Adminer Interface: $IP/adminer/"
- echo "Adminer System: PostgreSQL"
- echo "Adminer Server: localhost:5432"
- echo "Adminer Username: $DB_USER"
- echo "Adminer Password: $DB_PASS"
- echo "Adminer Database: $DB_NAME"
- } >> ~/outline.creds
+cat <>~/outline.creds
+Adminer Interface: $IP/adminer/
+Adminer System: PostgreSQL
+Adminer Server: localhost:5432
+Adminer Username: $DB_USER
+Adminer Password: $DB_PASS
+Adminer Database: $DB_NAME
+EOF
msg_ok "Installed Adminer"
fi
-msg_info "Installing $APPLICATION (Patience)"
+read -r -p "Enter the public url for your Outline instance (e.g., https://outline.your-domain.tld)): " URL
+msg_info "Installing Outline (Patience)"
cd /opt
-RELEASE=$(curl -s https://api.github.com/repos/outline/outline/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
-wget -q "https://github.com/outline/outline/archive/refs/tags/${RELEASE}.zip"
-unzip -q ${RELEASE}.zip
-mv outline-${RELEASE:1} /opt/outline
+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=${RELEASE_TAG#v}
+wget -q "https://github.com/outline/outline/archive/refs/tags/${RELEASE_TAG}.zip"
+unzip -q ${RELEASE_TAG}.zip
+mv outline-${RELEASE} /opt/outline
cd /opt/outline
-## First build in development
$STD yarn install --no-optional --frozen-lockfile
$STD yarn cache clean
$STD yarn build
-## Continue in production
rm -rf ./node_modules
-$STD yarn install --production=true--frozen-lockfile
+$STD yarn install --production=true --frozen-lockfile
$STD yarn cache clean
FILE_STORAGE_LOCAL_ROOT_DIR=/var/lib/outline/data
mkdir -p $FILE_STORAGE_LOCAL_ROOT_DIR
-{
- echo NODE_ENV=production
- echo SECRET_KEY=$SECRET_KEY
- echo UTILS_SECRET=$UTILS_SECRET
- echo DATABASE_URL=$DATABASE_URL
- echo REDIS_URL=redis://localhost:6379
- echo URL=$URL
- echo FILE_STORAGE=local
- echo FILE_STORAGE_LOCAL_ROOT_DIR=$FILE_STORAGE_LOCAL_ROOT_DIR
- echo FILE_STORAGE_UPLOAD_MAX_SIZE=262144000
- echo WEB_CONCURRENCY=2
-} > /opt/outline/.env
+cat </opt/outline/.env
+NODE_ENV=production
+SECRET_KEY=$SECRET_KEY
+UTILS_SECRET=$UTILS_SECRET
+DATABASE_URL=$DATABASE_URL
+REDIS_URL=redis://localhost:6379
+URL=$URL
+FILE_STORAGE=local
+FILE_STORAGE_LOCAL_ROOT_DIR=$FILE_STORAGE_LOCAL_ROOT_DIR
+FILE_STORAGE_UPLOAD_MAX_SIZE=262144000
+WEB_CONCURRENCY=2
+EOF
$STD yarn sequelize db:create
$STD yarn sequelize db:migrate
-echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
-msg_ok "Installed $APPLICATION"
+echo "${RELEASE}" >/opt/Outline_version.txt
+msg_ok "Installed Outline"
msg_info "Creating Service"
cat </etc/systemd/system/outline.service
@@ -151,7 +149,7 @@ motd_ssh
customize
msg_info "Cleaning up"
-rm -rf /opt/${RELEASE}.zip
+rm /opt/${RELEASE_TAG}.zip
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"
From 769dc9d0165a2bbd81fce093ab8aa182c3e4715a Mon Sep 17 00:00:00 2001
From: Gerhard Burger
Date: Wed, 27 Nov 2024 13:32:22 +0100
Subject: [PATCH 6/9] Remove db:migrate
---
install/outline-install.sh | 1 -
1 file changed, 1 deletion(-)
diff --git a/install/outline-install.sh b/install/outline-install.sh
index 6501598e3d9..fbbf1873bc2 100644
--- a/install/outline-install.sh
+++ b/install/outline-install.sh
@@ -123,7 +123,6 @@ WEB_CONCURRENCY=2
EOF
$STD yarn sequelize db:create
-$STD yarn sequelize db:migrate
echo "${RELEASE}" >/opt/Outline_version.txt
msg_ok "Installed Outline"
From a57d8ac14ec615fa2ad71b0446df599c13ac5986 Mon Sep 17 00:00:00 2001
From: Gerhard Burger
Date: Wed, 27 Nov 2024 14:45:24 +0100
Subject: [PATCH 7/9] Use node version directly in url
---
install/outline-install.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/install/outline-install.sh b/install/outline-install.sh
index fbbf1873bc2..7a64032520b 100644
--- a/install/outline-install.sh
+++ b/install/outline-install.sh
@@ -25,10 +25,9 @@ $STD apt-get install -y \
msg_ok "Installed Dependencies"
msg_info "Setting up Node.js Repository"
-NODE_MAJOR=20
mkdir -p /etc/apt/keyrings
wget -qO- https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
-echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
+echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
msg_ok "Set up Node.js Repository"
msg_info "Setting up Redis Repository"
From b8a16376d48d10a731a438b3b58c745acfe36fd9 Mon Sep 17 00:00:00 2001
From: Gerhard Burger
Date: Wed, 27 Nov 2024 14:48:33 +0100
Subject: [PATCH 8/9] Add empty line before adminer creds
Seperates them from the previous block of credentials
---
install/outline-install.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/install/outline-install.sh b/install/outline-install.sh
index 7a64032520b..fee09257be0 100644
--- a/install/outline-install.sh
+++ b/install/outline-install.sh
@@ -77,6 +77,7 @@ if [[ "${adminer_prompt,,}" =~ ^(y|yes)$ ]]; then
systemctl reload apache2
IP=$(hostname -I | awk '{print $1}')
cat <>~/outline.creds
+
Adminer Interface: $IP/adminer/
Adminer System: PostgreSQL
Adminer Server: localhost:5432
From 612569b955f3f2fb9df88d83451e276c0b01bac0 Mon Sep 17 00:00:00 2001
From: Gerhard Burger
Date: Wed, 27 Nov 2024 21:37:12 +0100
Subject: [PATCH 9/9] Address further reviewer comments
---
ct/outline.sh | 11 ++++----
install/outline-install.sh | 55 +++++++++++++++++---------------------
2 files changed, 30 insertions(+), 36 deletions(-)
diff --git a/ct/outline.sh b/ct/outline.sh
index 77c462d84c1..20ffcbc8a81 100644
--- a/ct/outline.sh
+++ b/ct/outline.sh
@@ -57,9 +57,8 @@ header_info
check_container_storage
check_container_resources
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=${RELEASE_TAG#v}
-if [[ "${RELEASE}" != "$(cat /opt/Outline_version.txt)" ]] || [[ ! -f /opt/Outline_version.txt ]]; then
+RELEASE=$(curl -s 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 ${APP}"
systemctl stop outline
msg_ok "Stopped ${APP}"
@@ -68,8 +67,8 @@ if [[ "${RELEASE}" != "$(cat /opt/Outline_version.txt)" ]] || [[ ! -f /opt/Outli
cd /opt
cp /opt/outline/.env /opt/.env
mv /opt/outline /opt/outline_bak
- wget -q "https://github.com/outline/outline/archive/refs/tags/${RELEASE_TAG}.zip"
- unzip -q ${RELEASE_TAG}.zip
+ wget -q "https://github.com/outline/outline/archive/refs/tags/v${RELEASE}.zip"
+ unzip -q v${RELEASE}.zip
mv outline-${RELEASE} /opt/outline
cd /opt/outline
@@ -91,7 +90,7 @@ if [[ "${RELEASE}" != "$(cat /opt/Outline_version.txt)" ]] || [[ ! -f /opt/Outli
msg_ok "Started ${APP}"
msg_info "Cleaning up"
- rm -rf /opt/${RELEASE_TAG}.zip
+ rm -rf /opt/v${RELEASE}.zip
rm -rf /opt/outline_bak
msg_ok "Cleaned"
msg_ok "Updated Successfully"
diff --git a/install/outline-install.sh b/install/outline-install.sh
index fee09257be0..0d8f1ff1cbc 100644
--- a/install/outline-install.sh
+++ b/install/outline-install.sh
@@ -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 SET timezone TO 'UTC';"
-cat <~/outline.creds
-Outline-Credentials
-Outline Database User: $DB_USER
-Outline Database Password: $DB_PASS
-Outline Database Name: $DB_NAME
-Outline Secret: $SECRET_KEY
-Outline Utils Secret: $UTILS_SECRET
-EOF
+{
+ echo "Outline-Credentials"
+ echo "Outline Database User: $DB_USER"
+ echo "Outline Database Password: $DB_PASS"
+ echo "Outline Database Name: $DB_NAME"
+ echo "Outline Secret: $SECRET_KEY"
+ echo "Outline Utils Secret: $UTILS_SECRET"
+} >~/outline.creds
msg_ok "Set up PostgreSQL DB"
@@ -76,25 +76,23 @@ if [[ "${adminer_prompt,,}" =~ ^(y|yes)$ ]]; then
$STD a2enconf adminer
systemctl reload apache2
IP=$(hostname -I | awk '{print $1}')
-cat <>~/outline.creds
-
-Adminer Interface: $IP/adminer/
-Adminer System: PostgreSQL
-Adminer Server: localhost:5432
-Adminer Username: $DB_USER
-Adminer Password: $DB_PASS
-Adminer Database: $DB_NAME
-EOF
+ {
+ echo ""
+ echo "Adminer Interface: $IP/adminer/"
+ echo "Adminer System: PostgreSQL"
+ echo "Adminer Server: localhost:5432"
+ echo "Adminer Username: $DB_USER"
+ echo "Adminer Password: $DB_PASS"
+ echo "Adminer Database: $DB_NAME"
+ } >>~/outline.creds
msg_ok "Installed Adminer"
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)"
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=${RELEASE_TAG#v}
-wget -q "https://github.com/outline/outline/archive/refs/tags/${RELEASE_TAG}.zip"
-unzip -q ${RELEASE_TAG}.zip
+RELEASE=$(curl -s https://api.github.com/repos/outline/outline/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
+wget -q "https://github.com/outline/outline/archive/refs/tags/v${RELEASE}.zip"
+unzip -q v${RELEASE}.zip
mv outline-${RELEASE} /opt/outline
cd /opt/outline
@@ -106,25 +104,22 @@ rm -rf ./node_modules
$STD yarn install --production=true --frozen-lockfile
$STD yarn cache clean
-FILE_STORAGE_LOCAL_ROOT_DIR=/var/lib/outline/data
-mkdir -p $FILE_STORAGE_LOCAL_ROOT_DIR
+mkdir -p /var/opt/outline/data
cat </opt/outline/.env
NODE_ENV=production
+URL=
SECRET_KEY=$SECRET_KEY
UTILS_SECRET=$UTILS_SECRET
DATABASE_URL=$DATABASE_URL
REDIS_URL=redis://localhost:6379
-URL=$URL
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
WEB_CONCURRENCY=2
EOF
-$STD yarn sequelize db:create
-
-echo "${RELEASE}" >/opt/Outline_version.txt
+echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
msg_ok "Installed Outline"
msg_info "Creating Service"
@@ -148,7 +143,7 @@ motd_ssh
customize
msg_info "Cleaning up"
-rm /opt/${RELEASE_TAG}.zip
+rm -rf /opt/v${RELEASE}.zip
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"