From 06cf03dcb196945ce0d85ee5bf7ab4d431d42f48 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Mon, 16 Jun 2025 15:20:06 +0200 Subject: [PATCH] harmonize tools.func --- install/bluecherry-install.sh | 2 +- install/debian-install.sh | 12 ++--- install/deferred/ampache-install.sh | 50 +++++++++---------- install/deferred/koel-install.sh | 64 ++++++++++++------------ install/deferred/ocis-install.sh | 5 +- install/deferred/openwebui-install.sh | 24 ++++----- install/firefly-install.sh | 18 +++---- install/hanko-install.sh | 2 +- install/healthchecks-install.sh | 20 ++++---- install/librenms-install.sh | 7 ++- install/manyfold-install.sh | 38 +++++++------- install/maxun-install.sh | 72 +++++++++++++-------------- install/maybefinance-install.sh | 60 +++++++++++----------- install/notesnook-install.sh | 2 +- install/wizarr-install.sh | 10 ++-- misc/tools.func | 22 ++++---- 16 files changed, 203 insertions(+), 205 deletions(-) diff --git a/install/bluecherry-install.sh b/install/bluecherry-install.sh index 2dfb579e..e7ca8513 100644 --- a/install/bluecherry-install.sh +++ b/install/bluecherry-install.sh @@ -17,7 +17,7 @@ msg_info "Installing Dependencies" $STD apt-get install -y python3-distutils msg_ok "Installed Dependencies" -install_mariadb +setup_mariadb msg_info "Setting up Bluecherry" export DEBIAN_FRONTEND=noninteractive diff --git a/install/debian-install.sh b/install/debian-install.sh index 8c836c9f..1bb65f6a 100644 --- a/install/debian-install.sh +++ b/install/debian-install.sh @@ -29,22 +29,22 @@ PYTHON_VERSION="3.12" setup_uv # minimal call: fetch_and_deploy_gh_release "defguard" "DefGuard/defguard" "binary" #echo -e "defguard done" -#PHP_VERSION=8.2 PHP_FPM=YES install_php -#install_composer +#PHP_VERSION=8.2 PHP_FPM=YES setup_php +#setup_composer # Example Setting for Test #NODE_MODULE="pnpm@10.1,yarn" #RELEASE=$(curl_handler -fsSL https://api.github.com/repos/babybuddy/babybuddy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') #msg_ok "Get Release $RELEASE" -#NODE_VERSION="22" NODE_MODULE="yarn" install_node_and_modules +#NODE_VERSION="22" NODE_MODULE="yarn" setup_nodejs -#PG_VERSION="16" install_postgresql +#PG_VERSION="16" setup_postgresql #MARIADB_VERSION="11.8" #MYSQL_VERSION="8.0" #install_mongodb -#install_postgresql -#install_mariadb +#setup_postgresql +#setup_mariadb #install_mysql # msg_info "Setup DISTRO env" diff --git a/install/deferred/ampache-install.sh b/install/deferred/ampache-install.sh index ec488afa..35dfe143 100644 --- a/install/deferred/ampache-install.sh +++ b/install/deferred/ampache-install.sh @@ -15,32 +15,32 @@ update_os msg_info "Installing Dependencies (Patience)" apt-get install -y \ - apache2 \ - cron \ - flac \ - vorbis-tools \ - lame \ - ffmpeg \ - lsb-release \ - gosu \ - wget \ - curl \ - git \ - make \ - inotify-tools \ - libavcodec-extra \ - libev-libevent-dev \ - libmp3lame-dev \ - libtheora-dev \ - libvorbis-dev \ - libvpx-dev + apache2 \ + cron \ + flac \ + vorbis-tools \ + lame \ + ffmpeg \ + lsb-release \ + gosu \ + wget \ + curl \ + git \ + make \ + inotify-tools \ + libavcodec-extra \ + libev-libevent-dev \ + libmp3lame-dev \ + libtheora-dev \ + libvorbis-dev \ + libvpx-dev msg_ok "Installed Dependencies" PHP_VERSION=8.4 PHP_MODULE=bcmath,bz2,cli,common,curl,fpm,gd,imagick,intl,mbstring,mysql,sqlite3,xml,xmlrpc,zip PHP_APACHE=YES -install_php -install_mariadb +setup_php +setup_mariadb msg_info "Setting up Database" DB_NAME=ampache2 @@ -68,10 +68,10 @@ sudo mv /opt/ampache/channel/.htaccess.dist /opt/ampache/channel/.htaccess sudo cp /opt/ampache/config/ampache.cfg.php.dist /opt/ampache/config/ampache.cfg.php sudo chmod 664 /opt/ampache/rest/.htaccess /opt/ampache/play/.htaccess sudo sed -i 's/upload_max_filesize = .*/upload_max_filesize = 50M/' /etc/php/8.4/apache2/php.ini && - sudo sed -i 's/post_max_size = .*/post_max_size = 50M/' /etc/php/8.4/apache2/php.ini && - sudo sed -i 's/max_execution_time = .*/max_execution_time = 300/' /etc/php/8.4/apache2/php.ini && - sudo sed -i 's/memory_limit = .*/memory_limit = 256M/' /etc/php/8.4/apache2/php.ini && - sudo systemctl restart apache2 + sudo sed -i 's/post_max_size = .*/post_max_size = 50M/' /etc/php/8.4/apache2/php.ini && + sudo sed -i 's/max_execution_time = .*/max_execution_time = 300/' /etc/php/8.4/apache2/php.ini && + sudo sed -i 's/memory_limit = .*/memory_limit = 256M/' /etc/php/8.4/apache2/php.ini && + sudo systemctl restart apache2 msg_ok "Installed Ampache" motd_ssh diff --git a/install/deferred/koel-install.sh b/install/deferred/koel-install.sh index 9ab4fbb9..38c14d5f 100644 --- a/install/deferred/koel-install.sh +++ b/install/deferred/koel-install.sh @@ -13,31 +13,31 @@ setting_up_container network_check update_os -PG_VERSION="16" install_postgresql -PHP_VERSION=8.3 PHP_MODULE="bcmath,bz2,cli,exif,common,curl,fpm,gd,imagick,intl,mbstring,pgsql,sqlite3,xml,xmlrpc,zip" install_php -NODE_VERSION=22 NODE_MODULE="yarn,npm@latest" install_node_and_modules -install_composer +PG_VERSION="16" setup_postgresql +PHP_VERSION=8.3 PHP_MODULE="bcmath,bz2,cli,exif,common,curl,fpm,gd,imagick,intl,mbstring,pgsql,sqlite3,xml,xmlrpc,zip" setup_php +NODE_VERSION=22 NODE_MODULE="yarn,npm@latest" setup_nodejs +setup_composer msg_info "Installing Dependencies (Patience)" $STD apt-get install -y \ - nginx \ - apt-transport-https \ - lsb-release \ - ffmpeg \ - cron \ - libapache2-mod-xsendfile \ - libzip-dev \ - locales \ - libpng-dev \ - libjpeg62-turbo-dev \ - libpq-dev \ - libwebp-dev + nginx \ + apt-transport-https \ + lsb-release \ + ffmpeg \ + cron \ + libapache2-mod-xsendfile \ + libzip-dev \ + locales \ + libpng-dev \ + libjpeg62-turbo-dev \ + libpq-dev \ + libwebp-dev msg_ok "Installed Dependencies" -# PG_VERSION="16" install_postgresql -# PHP_VERSION=8.3 PHP_MODULE="bcmath,bz2,cli,exif,common,curl,fpm,gd,imagick,intl,mbstring,pgsql,sqlite3,xml,xmlrpc,zip" install_php -# NODE_VERSION=22 NODE_MODULE="yarn,npm@latest" install_node_and_modules -# install_composer +# PG_VERSION="16" setup_postgresql +# PHP_VERSION=8.3 PHP_MODULE="bcmath,bz2,cli,exif,common,curl,fpm,gd,imagick,intl,mbstring,pgsql,sqlite3,xml,xmlrpc,zip" setup_php +# NODE_VERSION=22 NODE_MODULE="yarn,npm@latest" setup_nodejs +# setup_composer msg_info "Setting up PostgreSQL Database" DB_NAME=koel_db @@ -50,10 +50,10 @@ $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 default_transaction_isolation TO 'read committed';" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'" { - echo "Koel-Credentials" - echo "Koel Database User: $DB_USER" - echo "Koel Database Password: $DB_PASS" - echo "Koel Database Name: $DB_NAME" + echo "Koel-Credentials" + echo "Koel Database User: $DB_USER" + echo "Koel Database Password: $DB_PASS" + echo "Koel Database Name: $DB_NAME" } >>~/koel.creds msg_ok "Set up PostgreSQL Database" @@ -67,14 +67,14 @@ cd /opt/koel mv .env.example .env $STD composer install --no-interaction sed -i -e "s/DB_CONNECTION=.*/DB_CONNECTION=pgsql/" \ - -e "s/DB_HOST=.*/DB_HOST=localhost/" \ - -e "s/DB_DATABASE=.*/DB_DATABASE=$DB_NAME/" \ - -e "s/DB_PORT=.*/DB_PORT=5432/" \ - -e "s|APP_KEY=.*|APP_KEY=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)|" \ - -e "s/DB_USERNAME=.*/DB_USERNAME=$DB_USER/" \ - -e "s|DB_PASSWORD=.*|DB_PASSWORD=$DB_PASS|" \ - -e "s|MEDIA_PATH=.*|MEDIA_PATH=/opt/koel_media|" \ - -e "s|FFMPEG_PATH=/usr/local/bin/ffmpeg|FFMPEG_PATH=/usr/bin/ffmpeg|" /opt/koel/.env + -e "s/DB_HOST=.*/DB_HOST=localhost/" \ + -e "s/DB_DATABASE=.*/DB_DATABASE=$DB_NAME/" \ + -e "s/DB_PORT=.*/DB_PORT=5432/" \ + -e "s|APP_KEY=.*|APP_KEY=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)|" \ + -e "s/DB_USERNAME=.*/DB_USERNAME=$DB_USER/" \ + -e "s|DB_PASSWORD=.*|DB_PASSWORD=$DB_PASS|" \ + -e "s|MEDIA_PATH=.*|MEDIA_PATH=/opt/koel_media|" \ + -e "s|FFMPEG_PATH=/usr/local/bin/ffmpeg|FFMPEG_PATH=/usr/bin/ffmpeg|" /opt/koel/.env php artisan koel:init --no-assets chown -R :www-data /opt/* chmod -R g+r /opt/* diff --git a/install/deferred/ocis-install.sh b/install/deferred/ocis-install.sh index d16b6898..987b0397 100644 --- a/install/deferred/ocis-install.sh +++ b/install/deferred/ocis-install.sh @@ -13,7 +13,6 @@ setting_up_container network_check update_os - msg_info "Installing Dependencies" $STD apt-get install -y \ build-essential \ @@ -23,8 +22,8 @@ msg_ok "Installed Dependencies" ## WIP - only protoype with git call -install_go -NODE_VERSION="22" NODE_MODULE="pnpm" install_node_and_modules +setup_go +NODE_VERSION="22" NODE_MODULE="pnpm" setup_nodejs msg_info "Setup ocis" cd /opt diff --git a/install/deferred/openwebui-install.sh b/install/deferred/openwebui-install.sh index aebb1305..0e9384d8 100644 --- a/install/deferred/openwebui-install.sh +++ b/install/deferred/openwebui-install.sh @@ -16,16 +16,16 @@ update_os msg_info "Installing Dependencies" $STD apt-get install -y \ - ffmpeg + ffmpeg msg_ok "Installed Dependencies" msg_info "Setup Python3" $STD apt-get install -y --no-install-recommends \ - python3 \ - python3-pip + python3 \ + python3-pip msg_ok "Setup Python3" -install_node_and_modules +setup_nodejs msg_info "Installing Open WebUI (Patience)" fetch_and_deploy_gh_release "open-webui/open-webui" @@ -55,11 +55,11 @@ msg_ok "Installed Open WebUI" read -r -p "${TAB3}Would you like to add Ollama? " prompt if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then - msg_info "Installing Ollama" - curl -fsSLO https://ollama.com/download/ollama-linux-amd64.tgz - tar -C /usr -xzf ollama-linux-amd64.tgz - rm -rf ollama-linux-amd64.tgz - cat </etc/systemd/system/ollama.service + msg_info "Installing Ollama" + curl -fsSLO https://ollama.com/download/ollama-linux-amd64.tgz + tar -C /usr -xzf ollama-linux-amd64.tgz + rm -rf ollama-linux-amd64.tgz + cat </etc/systemd/system/ollama.service [Unit] Description=Ollama Service After=network-online.target @@ -75,9 +75,9 @@ RestartSec=3 [Install] WantedBy=multi-user.target EOF - systemctl enable -q --now ollama - sed -i 's/ENABLE_OLLAMA_API=false/ENABLE_OLLAMA_API=true/g' /opt/openwebui/.env - msg_ok "Installed Ollama" + systemctl enable -q --now ollama + sed -i 's/ENABLE_OLLAMA_API=false/ENABLE_OLLAMA_API=true/g' /opt/openwebui/.env + msg_ok "Installed Ollama" fi msg_info "Creating Service" diff --git a/install/firefly-install.sh b/install/firefly-install.sh index 68a6f327..e7097178 100644 --- a/install/firefly-install.sh +++ b/install/firefly-install.sh @@ -18,13 +18,13 @@ curl -fsSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/p echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ bookworm main" >/etc/apt/sources.list.d/php.list $STD apt-get update $STD apt-get install -y \ - apache2 \ - libapache2-mod-php8.4 \ - php8.4-{bcmath,cli,intl,curl,zip,gd,xml,mbstring,mysql} \ - composer + apache2 \ + libapache2-mod-php8.4 \ + php8.4-{bcmath,cli,intl,curl,zip,gd,xml,mbstring,mysql} \ + composer msg_ok "Installed Dependencies" -install_mariadb +setup_mariadb msg_info "Setting up database" DB_NAME=firefly @@ -35,10 +35,10 @@ $STD mariadb -u root -e "CREATE DATABASE $DB_NAME;" $STD mariadb -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';" mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;" { - echo "Firefly-Credentials" - echo "Firefly Database User: $DB_USER" - echo "Firefly Database Password: $DB_PASS" - echo "Firefly Database Name: $DB_NAME" + echo "Firefly-Credentials" + echo "Firefly Database User: $DB_USER" + echo "Firefly Database Password: $DB_PASS" + echo "Firefly Database Name: $DB_NAME" } >>~/firefly.creds msg_ok "Set up database" diff --git a/install/hanko-install.sh b/install/hanko-install.sh index 30ad114f..8334e9cb 100644 --- a/install/hanko-install.sh +++ b/install/hanko-install.sh @@ -14,7 +14,7 @@ network_check update_os setup_yq -PG_VERSION="16" install_postgresql +PG_VERSION="16" setup_postgresql msg_info "Setting up PostgreSQL Database" DB_NAME=hanko diff --git a/install/healthchecks-install.sh b/install/healthchecks-install.sh index 4c80c767..84ed2a52 100644 --- a/install/healthchecks-install.sh +++ b/install/healthchecks-install.sh @@ -15,20 +15,20 @@ update_os msg_info "Installing Dependencies" $STD apt-get install -y \ - gcc \ - libpq-dev \ - libcurl4-openssl-dev \ - libssl-dev + gcc \ + libpq-dev \ + libcurl4-openssl-dev \ + libssl-dev msg_ok "Installed Dependencies" msg_info "Setup Python3" $STD apt-get install -y \ - python3 python3-dev python3-pip + python3 python3-dev python3-pip $STD pip install --upgrade pip msg_ok "Setup Python3" setup_uv -PG_VERSION=16 install_postgresql +PG_VERSION=16 setup_postgresql msg_info "Setup Database" DB_NAME=healthchecks_db @@ -42,10 +42,10 @@ $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 default_transaction_isolation TO 'read committed';" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'" { - echo "healthchecks-Credentials" - echo "healthchecks Database User: $DB_USER" - echo "healthchecks Database Password: $DB_PASS" - echo "healthchecks Database Name: $DB_NAME" + echo "healthchecks-Credentials" + echo "healthchecks Database User: $DB_USER" + echo "healthchecks Database Password: $DB_PASS" + echo "healthchecks Database Name: $DB_NAME" } >>~/healthchecks.creds msg_ok "Set up Database" diff --git a/install/librenms-install.sh b/install/librenms-install.sh index b929d53b..bea0d4a8 100644 --- a/install/librenms-install.sh +++ b/install/librenms-install.sh @@ -29,9 +29,9 @@ $STD apt-get install -y \ snmpd msg_ok "Installed Dependencies" -PHP_VERSION=8.2 PHP_FPM=YES PHP_APACHE=NO PHP_MODULE="gmp,mysql,snmp" install_php -install_mariadb -install_composer +PHP_VERSION=8.2 PHP_FPM=YES PHP_APACHE=NO PHP_MODULE="gmp,mysql,snmp" setup_php +setup_mariadb +setup_composer setup_uv msg_info "Installing Python" @@ -74,7 +74,6 @@ setfacl -d -m g::rwx /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/li chmod -R ug=rwX /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/logs /opt/librenms/rrd msg_ok "Setup LibreNMS" - msg_info "Configure MariaDB" sed -i "/\[mysqld\]/a innodb_file_per_table=1\nlower_case_table_names=0" /etc/mysql/mariadb.conf.d/50-server.cnf systemctl enable -q --now mariadb diff --git a/install/manyfold-install.sh b/install/manyfold-install.sh index cb2b01ad..e4dcbf06 100644 --- a/install/manyfold-install.sh +++ b/install/manyfold-install.sh @@ -14,20 +14,20 @@ update_os msg_info "Installing Dependencies" $STD apt-get install -y \ - curl \ - sudo \ - mc \ - gnupg2 postgresql \ - lsb-release \ - rbenv \ - libpq-dev \ - libarchive-dev \ - git \ - libmariadb-dev \ - redis-server \ - nginx \ - libffi-dev \ - libyaml-dev + curl \ + sudo \ + mc \ + gnupg2 postgresql \ + lsb-release \ + rbenv \ + libpq-dev \ + libarchive-dev \ + git \ + libmariadb-dev \ + redis-server \ + nginx \ + libffi-dev \ + libyaml-dev msg_ok "Installed Dependencies" msg_info "Setting up PostgreSQL" @@ -37,10 +37,10 @@ DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13) $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 TEMPLATE template0;" { - echo "Manyfold Credentials" - echo "Manyfold Database User: $DB_USER" - echo "Manyfold Database Password: $DB_PASS" - echo "Manyfold Database Name: $DB_NAME" + echo "Manyfold Credentials" + echo "Manyfold Database User: $DB_USER" + echo "Manyfold Database Password: $DB_PASS" + echo "Manyfold Database Name: $DB_NAME" } >>~/manyfold.creds msg_ok "Set up PostgreSQL" @@ -55,7 +55,7 @@ YARN_VERSION=$(grep '"packageManager":' /opt/manyfold/package.json | sed -E 's/. msg_ok "Downloaded Manyfold" -NODE_VERSION="22" NODE_MODULE="npm@latest,${YARN_VERSION}" install_node_and_modules +NODE_VERSION="22" NODE_MODULE="npm@latest,${YARN_VERSION}" setup_nodejs RUBY_VERSION=${RUBY_INSTALL_VERSION} RUBY_INSTALL_RAILS="true" setup_rbenv_stack # msg_info "Add ruby-build" diff --git a/install/maxun-install.sh b/install/maxun-install.sh index 30ec377e..f68515a1 100644 --- a/install/maxun-install.sh +++ b/install/maxun-install.sh @@ -15,37 +15,37 @@ update_os msg_info "Installing Dependencies" $STD apt-get install -y \ - gpg \ - openssl \ - redis \ - libgbm1 \ - libnss3 \ - libatk1.0-0 \ - libatk-bridge2.0-0 \ - libdrm2 \ - libxkbcommon0 \ - libglib2.0-0 \ - libdbus-1-3 \ - libx11-xcb1 \ - libxcb1 \ - libxcomposite1 \ - libxcursor1 \ - libxdamage1 \ - libxext6 \ - libxi6 \ - libxtst6 \ - ca-certificates \ - libxrandr2 \ - libasound2 \ - libxss1 \ - libxinerama1 \ - nginx + gpg \ + openssl \ + redis \ + libgbm1 \ + libnss3 \ + libatk1.0-0 \ + libatk-bridge2.0-0 \ + libdrm2 \ + libxkbcommon0 \ + libglib2.0-0 \ + libdbus-1-3 \ + libx11-xcb1 \ + libxcb1 \ + libxcomposite1 \ + libxcursor1 \ + libxdamage1 \ + libxext6 \ + libxi6 \ + libxtst6 \ + ca-certificates \ + libxrandr2 \ + libasound2 \ + libxss1 \ + libxinerama1 \ + nginx msg_ok "Installed Dependencies" #configure_lxc "Semantic Search requires a dedicated GPU and at least 16GB RAM. Would you like to install it?" 100 "memory" "16000" -PG_VERSION=17 install_postgresql -NODE_VERSION="22" install_node_and_modules +PG_VERSION=17 setup_postgresql +NODE_VERSION="22" setup_nodejs msg_info "Setup Variables" DB_NAME=maxun_db @@ -65,12 +65,12 @@ $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 default_transaction_isolation TO 'read committed';" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'" { - echo "Maxun-Credentials" - echo "Maxun Database User: $DB_USER" - echo "Maxun Database Password: $DB_PASS" - echo "Maxun Database Name: $DB_NAME" - echo "Maxun JWT Secret: $JWT_SECRET" - echo "Maxun Encryption Key: $ENCRYPTION_KEY" + echo "Maxun-Credentials" + echo "Maxun Database User: $DB_USER" + echo "Maxun Database Password: $DB_PASS" + echo "Maxun Database Name: $DB_NAME" + echo "Maxun JWT Secret: $JWT_SECRET" + echo "Maxun Encryption Key: $ENCRYPTION_KEY" } >>~/maxun.creds msg_ok "Set up Database" @@ -99,9 +99,9 @@ LimitNOFILE=65536 WantedBy=multi-user.target EOF { - echo "__________________" - echo "MinIO Admin User: $MINIO_USER" - echo "MinIO Admin Password: $MINIO_PASS" + echo "__________________" + echo "MinIO Admin User: $MINIO_USER" + echo "MinIO Admin Password: $MINIO_PASS" } >>~/maxun.creds cat </etc/default/minio MINIO_ROOT_USER=${MINIO_USER} diff --git a/install/maybefinance-install.sh b/install/maybefinance-install.sh index f4d270ac..e5d4a788 100644 --- a/install/maybefinance-install.sh +++ b/install/maybefinance-install.sh @@ -15,25 +15,25 @@ update_os msg_info "Installing Dependencies" $STD apt-get install -y --no-install-recommends \ - libpq-dev \ - libvips42 \ - git \ - zlib1g-dev \ - build-essential \ - libssl-dev \ - libreadline-dev \ - libyaml-dev \ - libsqlite3-dev \ - sqlite3 \ - libxml2-dev \ - libxslt1-dev \ - libcurl4-openssl-dev \ - software-properties-common \ - libffi-dev \ - redis + libpq-dev \ + libvips42 \ + git \ + zlib1g-dev \ + build-essential \ + libssl-dev \ + libreadline-dev \ + libyaml-dev \ + libsqlite3-dev \ + sqlite3 \ + libxml2-dev \ + libxslt1-dev \ + libcurl4-openssl-dev \ + software-properties-common \ + libffi-dev \ + redis msg_ok "Installed Dependencies" -PG_VERSION=16 install_postgresql +PG_VERSION=16 setup_postgresql msg_info "Setting up Postgresql" DB_NAME="maybe" @@ -42,10 +42,10 @@ DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)" $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 TEMPLATE template0;" { - echo "${APPLICATION} database credentials" - echo "Database Name: ${DB_NAME}" - echo "Database User: ${DB_USER}" - echo "Database Password: ${DB_PASS}" + echo "${APPLICATION} database credentials" + echo "Database Name: ${DB_NAME}" + echo "Database User: ${DB_USER}" + echo "Database Password: ${DB_PASS}" } >~/maybe.creds msg_ok "Setup Postgresql" @@ -58,20 +58,20 @@ RUBY_VERSION="$(cat /opt/maybe/.ruby-version)" RUBY_INSTALL_RAILS=false setup_rb cd /opt/maybe cp ./.env.example ./.env sed -i -e '/SELF_/a RAILS_ENV=production' \ - -e "s/secret-value/\"$(openssl rand -hex 64)\"/" \ - -e "/^SECRET_KEY/a RAILS_MASTER_KEY=\"$(openssl rand -hex 16)\"" \ - -e "s/_USER=postgres/_USER=${DB_USER}/" \ - -e "s/_PASSWORD=postgres/_PASSWORD=${DB_PASS}/" \ - -e "/_USER=/a POSTGRES_DB=${DB_NAME}" \ - -e 's/^# DISABLE/DISABLE/' \ - ./.env + -e "s/secret-value/\"$(openssl rand -hex 64)\"/" \ + -e "/^SECRET_KEY/a RAILS_MASTER_KEY=\"$(openssl rand -hex 16)\"" \ + -e "s/_USER=postgres/_USER=${DB_USER}/" \ + -e "s/_PASSWORD=postgres/_PASSWORD=${DB_PASS}/" \ + -e "/_USER=/a POSTGRES_DB=${DB_NAME}" \ + -e 's/^# DISABLE/DISABLE/' \ + ./.env sed -i -e '/_DB=/a\ \ REDIS_URL=redis://localhost:6379/1' \ - -e '/_SSL/a\ + -e '/_SSL/a\ RAILS_FORCE_SSL=false\ RAILS_ASSUME_SSL=false' \ - ./.env + ./.env rm -f ./config/credentials.yml.enc $STD ./bin/bundle install $STD ./bin/bundle exec bootsnap precompile --gemfile -j 0 diff --git a/install/notesnook-install.sh b/install/notesnook-install.sh index c970d0d2..a396c98f 100644 --- a/install/notesnook-install.sh +++ b/install/notesnook-install.sh @@ -17,7 +17,7 @@ msg_info "Installing Dependencies" $STD apt-get install -y make git msg_ok "Installed Dependencies" -NODE_MODULE="yarn" install_node_and_modules +NODE_MODULE="yarn" setup_nodejs msg_info "Installing Notesnook (Patience)" fetch_and_deploy_gh_release "notesnook" "streetwriters/notesnook" "tarball" diff --git a/install/wizarr-install.sh b/install/wizarr-install.sh index a0afdc04..0ec81c51 100644 --- a/install/wizarr-install.sh +++ b/install/wizarr-install.sh @@ -15,14 +15,14 @@ update_os msg_info "Installing Dependencies" $STD apt-get install -y \ - curl \ - sudo \ - mc \ - sqlite3 + curl \ + sudo \ + mc \ + sqlite3 msg_ok "Installed Dependencies" setup_uv -NODE_VERSION="22" install_node_and_modules +NODE_VERSION="22" setup_nodejs msg_info "Installing ${APPLICATION}" RELEASE=$(curl -s https://api.github.com/repos/wizarrrr/wizarr/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') diff --git a/misc/tools.func b/misc/tools.func index 10d2d69e..9ac60723 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -12,7 +12,7 @@ # NODE_MODULE - Comma-separated list of global modules (e.g. "yarn,@vue/cli@5.0.0") # ------------------------------------------------------------------------------ -install_node_and_modules() { +setup_nodejs() { local NODE_VERSION="${NODE_VERSION:-22}" local NODE_MODULE="${NODE_MODULE:-}" local CURRENT_NODE_VERSION="" @@ -135,7 +135,7 @@ install_node_and_modules() { # PG_VERSION - Major PostgreSQL version (e.g. 15, 16) (default: 16) # PG_MODULES - Comma-separated list of extensions (e.g. "postgis,contrib") # ------------------------------------------------------------------------------ -install_postgresql() { +setup_postgresql() { local PG_VERSION="${PG_VERSION:-16}" local PG_MODULES="${PG_MODULES:-}" local CURRENT_PG_VERSION="" @@ -223,7 +223,7 @@ install_postgresql() { # MARIADB_VERSION - MariaDB version to install (e.g. 10.11, latest) (default: latest) # ------------------------------------------------------------------------------ -install_mariadb() { +setup_mariadb() { local MARIADB_VERSION="${MARIADB_VERSION:-latest}" local DISTRO_CODENAME DISTRO_CODENAME="$(awk -F= '/^VERSION_CODENAME=/{print $2}' /etc/os-release)" @@ -291,7 +291,7 @@ install_mariadb() { # MYSQL_VERSION - MySQL version to install (e.g. 5.7, 8.0) (default: 8.0) # ------------------------------------------------------------------------------ -install_mysql() { +setup_mysql() { local MYSQL_VERSION="${MYSQL_VERSION:-8.0}" local CURRENT_VERSION="" local NEED_INSTALL=false @@ -372,7 +372,7 @@ install_mysql() { # PHP_MAX_EXECUTION_TIME - (default: 300) # ------------------------------------------------------------------------------ -install_php() { +setup_php() { local PHP_VERSION="${PHP_VERSION:-8.4}" local PHP_MODULE="${PHP_MODULE:-}" local PHP_APACHE="${PHP_APACHE:-NO}" @@ -477,7 +477,7 @@ install_php() { # - Installs to /usr/local/bin/composer # ------------------------------------------------------------------------------ -install_composer() { +setup_composer() { local COMPOSER_BIN="/usr/local/bin/composer" export COMPOSER_ALLOW_SUPERUSER=1 @@ -516,7 +516,7 @@ install_composer() { # GO_VERSION - Version to install (e.g. 1.22.2 or latest) # ------------------------------------------------------------------------------ -install_go() { +setup_go() { local ARCH case "$(uname -m)" in x86_64) ARCH="amd64" ;; @@ -582,7 +582,7 @@ install_go() { # JAVA_VERSION - Temurin JDK version to install (e.g. 17, 21) # ------------------------------------------------------------------------------ -install_java() { +setup_java() { local JAVA_VERSION="${JAVA_VERSION:-21}" local DISTRO_CODENAME DISTRO_CODENAME=$(awk -F= '/VERSION_CODENAME/ { print $2 }' /etc/os-release) @@ -633,7 +633,7 @@ install_java() { # MONGO_VERSION - MongoDB major version to install (e.g. 7.0, 8.0) # ------------------------------------------------------------------------------ -install_mongodb() { +setup_mongodb() { local MONGO_VERSION="${MONGO_VERSION:-8.0}" local DISTRO_ID DISTRO_CODENAME MONGO_BASE_URL DISTRO_ID=$(awk -F= '/^ID=/{ gsub(/"/,"",$2); print $2 }' /etc/os-release) @@ -1365,7 +1365,7 @@ create_selfsigned_certs() { # RUST_CRATES - Comma-separated list of crates (e.g. "cargo-edit,wasm-pack@0.12.1") # ------------------------------------------------------------------------------ -install_rust_and_crates() { +setup_rust() { local RUST_TOOLCHAIN="${RUST_TOOLCHAIN:-stable}" local RUST_CRATES="${RUST_CRATES:-}" local CARGO_BIN="${HOME}/.cargo/bin" @@ -1426,7 +1426,7 @@ install_rust_and_crates() { # - Supports Alpine and Debian-based systems # ------------------------------------------------------------------------------ -install_adminer() { +setup_adminer() { if grep -qi alpine /etc/os-release; then msg_info "Installing Adminer (Alpine)" mkdir -p /var/www/localhost/htdocs/adminer