Refactor (#9563)
This commit is contained in:
parent
a2c31c7eaf
commit
8cf12d7f4d
@ -16,42 +16,25 @@ update_os
|
|||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt install -y \
|
$STD apt install -y \
|
||||||
redis \
|
redis \
|
||||||
jq \
|
|
||||||
make
|
make
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
HOST_IP=$(hostname -I | awk '{print $1}')
|
|
||||||
NODE_VERSION="22" NODE_MODULE="pnpm@$(curl -s https://raw.githubusercontent.com/docmost/docmost/main/package.json | jq -r '.packageManager | split("@")[1]')" setup_nodejs
|
NODE_VERSION="22" NODE_MODULE="pnpm@$(curl -s https://raw.githubusercontent.com/docmost/docmost/main/package.json | jq -r '.packageManager | split("@")[1]')" setup_nodejs
|
||||||
PG_VERSION="16" setup_postgresql
|
PG_VERSION="16" setup_postgresql
|
||||||
|
PG_DB_NAME="docmost_db" PG_DB_USER="docmost_user" setup_postgresql_db
|
||||||
|
import_local_ip
|
||||||
fetch_and_deploy_gh_release "docmost" "docmost/docmost"
|
fetch_and_deploy_gh_release "docmost" "docmost/docmost"
|
||||||
|
|
||||||
msg_info "Setting up PostgreSQL"
|
|
||||||
DB_NAME="docmost_db"
|
|
||||||
DB_USER="docmost_user"
|
|
||||||
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 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 "Docmost-Credentials"
|
|
||||||
echo "Database Name: $DB_NAME"
|
|
||||||
echo "Database User: $DB_USER"
|
|
||||||
echo "Database Password: $DB_PASS"
|
|
||||||
} >>~/docmost.creds
|
|
||||||
msg_ok "Set up PostgreSQL"
|
|
||||||
|
|
||||||
msg_info "Configuring Docmost (Patience)"
|
msg_info "Configuring Docmost (Patience)"
|
||||||
cd /opt/docmost
|
cd /opt/docmost
|
||||||
mv .env.example .env
|
mv .env.example .env
|
||||||
mkdir data
|
mkdir data
|
||||||
sed -i -e "s|APP_SECRET=.*|APP_SECRET=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)|" \
|
sed -i -e "s|APP_SECRET=.*|APP_SECRET=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)|" \
|
||||||
-e "s|DATABASE_URL=.*|DATABASE_URL=postgres://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME|" \
|
-e "s|DATABASE_URL=.*|DATABASE_URL=\"postgres://$PG_DB_USER:$PG_DB_PASS@localhost:5432/$PG_DB_NAME?schema=public\"|" \
|
||||||
-e "s|FILE_UPLOAD_SIZE_LIMIT=.*|FILE_UPLOAD_SIZE_LIMIT=50mb|" \
|
-e "s|FILE_UPLOAD_SIZE_LIMIT=.*|FILE_UPLOAD_SIZE_LIMIT=50mb|" \
|
||||||
-e "s|DRAWIO_URL=.*|DRAWIO_URL=https://embed.diagrams.net|" \
|
-e "s|DRAWIO_URL=.*|DRAWIO_URL=https://embed.diagrams.net|" \
|
||||||
-e "s|DISABLE_TELEMETRY=.*|DISABLE_TELEMETRY=true|" \
|
-e "s|DISABLE_TELEMETRY=.*|DISABLE_TELEMETRY=true|" \
|
||||||
-e "s|APP_URL=.*|APP_URL=http://$HOST_IP:3000|" \
|
-e "s|APP_URL=.*|APP_URL=http://$LOCAL_IP:3000|" \
|
||||||
/opt/docmost/.env
|
/opt/docmost/.env
|
||||||
export NODE_OPTIONS="--max-old-space-size=2048"
|
export NODE_OPTIONS="--max-old-space-size=2048"
|
||||||
$STD pnpm install
|
$STD pnpm install
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user