mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-12-11 05:47:13 -06:00
Refactor (#9840)
This commit is contained in:
parent
43f1e88b98
commit
ca27ae4e4c
@ -15,31 +15,13 @@ update_os
|
||||
|
||||
NODE_VERSION="22" NODE_MODULE="yarn@latest" setup_nodejs
|
||||
PG_VERSION="17" setup_postgresql
|
||||
PG_DB_NAME="umamidb" PG_DB_USER="umami" setup_postgresql_db
|
||||
fetch_and_deploy_gh_release "umami" "umami-software/umami" "tarball"
|
||||
|
||||
msg_info "Setting up postgresql"
|
||||
DB_NAME=umamidb
|
||||
DB_USER=umami
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||
SECRET_KEY="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)"
|
||||
$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 ENCODING 'UTF8' TEMPLATE template0;"
|
||||
$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 "Umami-Credentials"
|
||||
echo "Umami Database User: $DB_USER"
|
||||
echo "Umami Database Password: $DB_PASS"
|
||||
echo "Umami Database Name: $DB_NAME"
|
||||
echo "Umami Secret Key: $SECRET_KEY"
|
||||
} >>~/umami.creds
|
||||
msg_ok "Set up postgresql"
|
||||
|
||||
msg_info "Configuring Umami"
|
||||
cd /opt/umami
|
||||
$STD yarn install
|
||||
echo -e "DATABASE_URL=postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME" >>/opt/umami/.env
|
||||
echo -e "DATABASE_URL=postgresql://$PG_DB_USER:$PG_DB_PASS@localhost:5432/$PG_DB_NAME" >>/opt/umami/.env
|
||||
$STD yarn run build
|
||||
msg_ok "Configured Umami"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user