mirror of
				https://github.com/community-scripts/ProxmoxVE.git
				synced 2025-11-04 02:12:49 +00:00 
			
		
		
		
	Big NodeJS Update: Use Helper Function on all Install-Scripts (#4744)
* Big NodeJS Update: Use Helper Function on all Install-Scripts * add jq in node_function * add more
This commit is contained in:
		@@ -15,13 +15,15 @@ update_os
 | 
			
		||||
 | 
			
		||||
msg_info "Installing Dependencies"
 | 
			
		||||
$STD apt-get install -y \
 | 
			
		||||
    gnupg2 mariadb-server \
 | 
			
		||||
    apache2 \
 | 
			
		||||
    libapache2-mod-php \
 | 
			
		||||
    php-{bcmath,curl,dom,gd,gmp,iconv,intl,json,mbstring,mysqli,opcache,pdo-mysql,redis,tokenizer,xml,zip} \
 | 
			
		||||
    composer
 | 
			
		||||
  mariadb-server \
 | 
			
		||||
  apache2 \
 | 
			
		||||
  libapache2-mod-php \
 | 
			
		||||
  php-{bcmath,curl,dom,gd,gmp,iconv,intl,json,mbstring,mysqli,opcache,pdo-mysql,redis,tokenizer,xml,zip} \
 | 
			
		||||
  composer
 | 
			
		||||
msg_ok "Installed Dependencies"
 | 
			
		||||
 | 
			
		||||
NODE_VERSION="22" NODE_MODULE="yarn@latest" install_node_and_modules
 | 
			
		||||
 | 
			
		||||
msg_info "Setting up MariaDB"
 | 
			
		||||
DB_NAME=monica
 | 
			
		||||
DB_USER=monica
 | 
			
		||||
@@ -30,23 +32,13 @@ $STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
 | 
			
		||||
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');"
 | 
			
		||||
$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
 | 
			
		||||
{
 | 
			
		||||
    echo "monica-Credentials"
 | 
			
		||||
    echo "monica Database User: $DB_USER"
 | 
			
		||||
    echo "monica Database Password: $DB_PASS"
 | 
			
		||||
    echo "monica Database Name: $DB_NAME"
 | 
			
		||||
  echo "monica-Credentials"
 | 
			
		||||
  echo "monica Database User: $DB_USER"
 | 
			
		||||
  echo "monica Database Password: $DB_PASS"
 | 
			
		||||
  echo "monica Database Name: $DB_NAME"
 | 
			
		||||
} >>~/monica.creds
 | 
			
		||||
msg_ok "Set up MariaDB"
 | 
			
		||||
 | 
			
		||||
msg_info "Setting up Node.js/Yarn"
 | 
			
		||||
mkdir -p /etc/apt/keyrings
 | 
			
		||||
curl -fsSL 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
 | 
			
		||||
$STD apt-get update
 | 
			
		||||
$STD apt-get install -y nodejs
 | 
			
		||||
$STD npm install -g npm@latest
 | 
			
		||||
$STD npm install -g yarn
 | 
			
		||||
msg_ok "Installed Node.js/Yarn"
 | 
			
		||||
 | 
			
		||||
msg_info "Installing monica"
 | 
			
		||||
RELEASE=$(curl -fsSL https://api.github.com/repos/monicahq/monica/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
 | 
			
		||||
cd /opt
 | 
			
		||||
@@ -57,9 +49,9 @@ cd /opt/monica
 | 
			
		||||
cp /opt/monica/.env.example /opt/monica/.env
 | 
			
		||||
HASH_SALT=$(openssl rand -base64 32)
 | 
			
		||||
sed -i -e "s|^DB_USERNAME=.*|DB_USERNAME=${DB_USER}|" \
 | 
			
		||||
    -e "s|^DB_PASSWORD=.*|DB_PASSWORD=${DB_PASS}|" \
 | 
			
		||||
    -e "s|^HASH_SALT=.*|HASH_SALT=${HASH_SALT}|" \
 | 
			
		||||
    /opt/monica/.env
 | 
			
		||||
  -e "s|^DB_PASSWORD=.*|DB_PASSWORD=${DB_PASS}|" \
 | 
			
		||||
  -e "s|^HASH_SALT=.*|HASH_SALT=${HASH_SALT}|" \
 | 
			
		||||
  /opt/monica/.env
 | 
			
		||||
$STD composer install --no-dev -o --no-interaction
 | 
			
		||||
$STD yarn install
 | 
			
		||||
$STD yarn run production
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user