@@ -16,42 +16,25 @@ update_os
1616msg_info " Installing Dependencies"
1717$STD apt install -y \
1818 redis \
19- jq \
2019 make
2120msg_ok " Installed Dependencies"
2221
23- HOST_IP=$( hostname -I | awk ' {print $1}' )
2422NODE_VERSION=" 22" NODE_MODULE=" pnpm@$( curl -s https://raw.githubusercontent.com/docmost/docmost/main/package.json | jq -r ' .packageManager | split("@")[1]' ) " setup_nodejs
2523PG_VERSION=" 16" setup_postgresql
24+ PG_DB_NAME=" docmost_db" PG_DB_USER=" docmost_user" setup_postgresql_db
25+ import_local_ip
2626fetch_and_deploy_gh_release " docmost" " docmost/docmost"
2727
28- msg_info " Setting up PostgreSQL"
29- DB_NAME=" docmost_db"
30- DB_USER=" docmost_user"
31- DB_PASS=" $( openssl rand -base64 18 | tr -dc ' a-zA-Z0-9' | cut -c1-13) "
32- $STD sudo -u postgres psql -c " CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS ';"
33- $STD sudo -u postgres psql -c " CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
34- $STD sudo -u postgres psql -c " ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
35- $STD sudo -u postgres psql -c " ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
36- $STD sudo -u postgres psql -c " ALTER ROLE $DB_USER SET timezone TO 'UTC'"
37- {
38- echo " Docmost-Credentials"
39- echo " Database Name: $DB_NAME "
40- echo " Database User: $DB_USER "
41- echo " Database Password: $DB_PASS "
42- } >> ~/docmost.creds
43- msg_ok " Set up PostgreSQL"
44-
4528msg_info " Configuring Docmost (Patience)"
4629cd /opt/docmost
4730mv .env.example .env
4831mkdir data
4932sed -i -e " s|APP_SECRET=.*|APP_SECRET=$( openssl rand -base64 32 | tr -dc ' a-zA-Z0-9' | cut -c1-32) |" \
50- -e " s|DATABASE_URL=.*|DATABASE_URL=postgres://$DB_USER : $DB_PASS @localhost:5432/$DB_NAME |" \
33+ -e " s|DATABASE_URL=.*|DATABASE_URL=\" postgres://$PG_DB_USER : $PG_DB_PASS @localhost:5432/$PG_DB_NAME ?schema=public \" |" \
5134 -e " s|FILE_UPLOAD_SIZE_LIMIT=.*|FILE_UPLOAD_SIZE_LIMIT=50mb|" \
5235 -e " s|DRAWIO_URL=.*|DRAWIO_URL=https://embed.diagrams.net|" \
5336 -e " s|DISABLE_TELEMETRY=.*|DISABLE_TELEMETRY=true|" \
54- -e " s|APP_URL=.*|APP_URL=http://$HOST_IP :3000|" \
37+ -e " s|APP_URL=.*|APP_URL=http://$LOCAL_IP :3000|" \
5538 /opt/docmost/.env
5639export NODE_OPTIONS=" --max-old-space-size=2048"
5740$STD pnpm install
0 commit comments