diff --git a/ct/outline.sh b/ct/outline.sh new file mode 100644 index 0000000000..20ffcbc8a8 --- /dev/null +++ b/ct/outline.sh @@ -0,0 +1,107 @@ +#!/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, 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}" + + 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/v${RELEASE}.zip" + unzip -q v${RELEASE}.zip + mv outline-${RELEASE} /opt/outline + cd /opt/outline + + yarn install --no-optional --frozen-lockfile &>/dev/null + yarn cache clean &>/dev/null + yarn build &>/dev/null + + 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/v${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 0000000000..0d8f1ff1cb --- /dev/null +++ b/install/outline-install.sh @@ -0,0 +1,149 @@ +#!/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 + +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 \ + mc \ + curl \ + lsb-release \ + postgresql \ + gnupg \ + unzip +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +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_20.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" + + +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 + msg_ok "Installed Adminer" +fi + +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, 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 + +$STD yarn install --no-optional --frozen-lockfile +$STD yarn cache clean +$STD yarn build + +rm -rf ./node_modules +$STD yarn install --production=true --frozen-lockfile +$STD yarn cache clean + +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 +FILE_STORAGE=local +FILE_STORAGE_LOCAL_ROOT_DIR=/var/opt/outline/data +FILE_STORAGE_UPLOAD_MAX_SIZE=262144000 +WEB_CONCURRENCY=2 +EOF + +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Installed Outline" + +msg_info "Creating Service" +cat </etc/systemd/system/outline.service +[Unit] +Description=Outline 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/v${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 0000000000..c6cd2d32f2 --- /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" + } + ] +}