Enable vector and load .env in installers
Discourse install: add PG_DB_EXTENSIONS="vector" to setup_postgresql_db and remove the separate CREATE EXTENSION psql call; also remove curl and git from the apt install list and drop the automatic admin bootstrap messaging. SimpleLogin install: source /opt/simplelogin/.env before running migrations and add EnvironmentFile=/opt/simplelogin/.env to the systemd unit files (gunicorn, email_handler, job_runner) so services inherit environment variables.
This commit is contained in:
@@ -20,8 +20,6 @@ $STD apt install -y \
|
||||
libreadline-dev \
|
||||
zlib1g-dev \
|
||||
libyaml-dev \
|
||||
curl \
|
||||
git \
|
||||
imagemagick \
|
||||
gsfonts \
|
||||
brotli \
|
||||
@@ -38,7 +36,7 @@ DISCOURSE_DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||
PG_HBA=$(find /etc/postgresql -name pg_hba.conf 2>/dev/null | head -n1)
|
||||
sed -i 's/^local\s\+all\s\+all\s\+peer$/local all all md5/' "$PG_HBA"
|
||||
$STD systemctl restart postgresql
|
||||
PG_DB_NAME="discourse" PG_DB_USER="discourse" PG_DB_PASS="$DISCOURSE_DB_PASS" setup_postgresql_db
|
||||
PG_DB_NAME="discourse" PG_DB_USER="discourse" PG_DB_PASS="$DISCOURSE_DB_PASS" PG_DB_EXTENSIONS="vector" setup_postgresql_db
|
||||
msg_ok "Configured PostgreSQL for Discourse"
|
||||
|
||||
msg_info "Configuring Discourse"
|
||||
@@ -90,7 +88,6 @@ export RAILS_ENV=production
|
||||
set -a
|
||||
source /opt/discourse/.env
|
||||
set +a
|
||||
$STD runuser -u postgres -- psql -d discourse -c "CREATE EXTENSION IF NOT EXISTS vector;"
|
||||
$STD bundle exec rails db:migrate
|
||||
msg_ok "Set Up Database"
|
||||
|
||||
@@ -105,9 +102,6 @@ set +a
|
||||
$STD bundle exec rails assets:precompile
|
||||
msg_ok "Built Discourse Assets"
|
||||
|
||||
msg_info "Preparing Admin Onboarding"
|
||||
msg_ok "Automatic admin bootstrap skipped (use first signup in UI with admin@local)"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/discourse.service
|
||||
[Unit]
|
||||
|
||||
@@ -93,6 +93,10 @@ OPENID_PUBLIC_KEY_PATH=/opt/simplelogin/openid-rsa.pub
|
||||
EOF
|
||||
|
||||
cd /opt/simplelogin
|
||||
set -a
|
||||
# shellcheck source=/dev/null
|
||||
source /opt/simplelogin/.env
|
||||
set +a
|
||||
$STD .venv/bin/flask db upgrade
|
||||
$STD .venv/bin/python init_app.py
|
||||
msg_ok "Configured SimpleLogin"
|
||||
@@ -137,6 +141,7 @@ Requires=postgresql.service redis-server.service
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/simplelogin
|
||||
EnvironmentFile=/opt/simplelogin/.env
|
||||
ExecStart=/opt/simplelogin/.venv/bin/gunicorn wsgi:app -b 127.0.0.1:7777 -w 2 --timeout 120
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
@@ -154,6 +159,7 @@ Requires=postgresql.service redis-server.service
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/simplelogin
|
||||
EnvironmentFile=/opt/simplelogin/.env
|
||||
ExecStart=/opt/simplelogin/.venv/bin/python email_handler.py
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
@@ -171,6 +177,7 @@ Requires=postgresql.service redis-server.service
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/simplelogin
|
||||
EnvironmentFile=/opt/simplelogin/.env
|
||||
ExecStart=/opt/simplelogin/.venv/bin/python job_runner.py
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
Reference in New Issue
Block a user