Skip to content

Commit ca27ae4

Browse files
authored
Refactor (#9840)
1 parent 43f1e88 commit ca27ae4

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

install/umami-install.sh

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,13 @@ update_os
1515

1616
NODE_VERSION="22" NODE_MODULE="yarn@latest" setup_nodejs
1717
PG_VERSION="17" setup_postgresql
18+
PG_DB_NAME="umamidb" PG_DB_USER="umami" setup_postgresql_db
1819
fetch_and_deploy_gh_release "umami" "umami-software/umami" "tarball"
1920

20-
msg_info "Setting up postgresql"
21-
DB_NAME=umamidb
22-
DB_USER=umami
23-
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
24-
SECRET_KEY="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)"
25-
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
26-
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
27-
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
28-
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
29-
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'"
30-
{
31-
echo "Umami-Credentials"
32-
echo "Umami Database User: $DB_USER"
33-
echo "Umami Database Password: $DB_PASS"
34-
echo "Umami Database Name: $DB_NAME"
35-
echo "Umami Secret Key: $SECRET_KEY"
36-
} >>~/umami.creds
37-
msg_ok "Set up postgresql"
38-
3921
msg_info "Configuring Umami"
4022
cd /opt/umami
4123
$STD yarn install
42-
echo -e "DATABASE_URL=postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME" >>/opt/umami/.env
24+
echo -e "DATABASE_URL=postgresql://$PG_DB_USER:$PG_DB_PASS@localhost:5432/$PG_DB_NAME" >>/opt/umami/.env
4325
$STD yarn run build
4426
msg_ok "Configured Umami"
4527

0 commit comments

Comments
 (0)