Update wger-install.sh
This commit is contained in:
parent
ab4270ed83
commit
6a1b5dd4ce
@ -20,7 +20,7 @@ $STD apt-get install -y \
|
|||||||
libpq-dev
|
libpq-dev
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
NODE_VERSION="22" NODE_MODULE="yarn,sass" setup_nodejs
|
NODE_VERSION="22" NODE_MODULE="sass" setup_nodejs
|
||||||
setup_uv
|
setup_uv
|
||||||
|
|
||||||
PG_VERSION="16" setup_postgresql
|
PG_VERSION="16" setup_postgresql
|
||||||
@ -32,6 +32,9 @@ msg_info "Setting up wger"
|
|||||||
mkdir -p /opt/wger/{static,media}
|
mkdir -p /opt/wger/{static,media}
|
||||||
chmod o+w /opt/wger/media
|
chmod o+w /opt/wger/media
|
||||||
cd /opt/wger
|
cd /opt/wger
|
||||||
|
$STD corepack enable
|
||||||
|
$STD npm install
|
||||||
|
$STD npm run build:css:sass
|
||||||
$STD uv venv
|
$STD uv venv
|
||||||
$STD uv pip install .
|
$STD uv pip install .
|
||||||
SECRET_KEY=$(openssl rand -base64 40)
|
SECRET_KEY=$(openssl rand -base64 40)
|
||||||
@ -46,6 +49,21 @@ DJANGO_MEDIA_ROOT=/opt/wger/media
|
|||||||
DJANGO_STATIC_ROOT=/opt/wger/static
|
DJANGO_STATIC_ROOT=/opt/wger/static
|
||||||
SECRET_KEY=${SECRET_KEY}
|
SECRET_KEY=${SECRET_KEY}
|
||||||
EOF
|
EOF
|
||||||
|
cat <<'WSGI' >/opt/wger/wsgi_wrapper.py
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
env_file = Path('/opt/wger/.env')
|
||||||
|
if env_file.exists():
|
||||||
|
for line in env_file.read_text().splitlines():
|
||||||
|
if line.strip() and not line.startswith('#') and '=' in line:
|
||||||
|
key, value = line.split('=', 1)
|
||||||
|
os.environ.setdefault(key.strip(), value.strip())
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings.main')
|
||||||
|
|
||||||
|
from wger.wsgi import application
|
||||||
|
WSGI
|
||||||
set -a && source /opt/wger/.env && set +a
|
set -a && source /opt/wger/.env && set +a
|
||||||
export DJANGO_SETTINGS_MODULE=settings.main
|
export DJANGO_SETTINGS_MODULE=settings.main
|
||||||
$STD uv run python manage.py migrate
|
$STD uv run python manage.py migrate
|
||||||
@ -55,7 +73,7 @@ msg_ok "Set up wger"
|
|||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
cat <<EOF >/etc/apache2/sites-available/wger.conf
|
cat <<EOF >/etc/apache2/sites-available/wger.conf
|
||||||
<Directory /opt/wger>
|
<Directory /opt/wger>
|
||||||
<Files wsgi.py>
|
<Files wsgi_wrapper.py>
|
||||||
Require all granted
|
Require all granted
|
||||||
</Files>
|
</Files>
|
||||||
</Directory>
|
</Directory>
|
||||||
@ -64,18 +82,8 @@ cat <<EOF >/etc/apache2/sites-available/wger.conf
|
|||||||
WSGIApplicationGroup %{GLOBAL}
|
WSGIApplicationGroup %{GLOBAL}
|
||||||
WSGIDaemonProcess wger python-path=/opt/wger python-home=/opt/wger/.venv
|
WSGIDaemonProcess wger python-path=/opt/wger python-home=/opt/wger/.venv
|
||||||
WSGIProcessGroup wger
|
WSGIProcessGroup wger
|
||||||
WSGIScriptAlias / /opt/wger/wger/wsgi.py
|
WSGIScriptAlias / /opt/wger/wsgi_wrapper.py
|
||||||
WSGIPassAuthorization On
|
WSGIPassAuthorization On
|
||||||
SetEnv DJANGO_SETTINGS_MODULE settings.main
|
|
||||||
SetEnv DJANGO_DB_ENGINE django.db.backends.postgresql
|
|
||||||
SetEnv DJANGO_DB_DATABASE ${PG_DB_NAME}
|
|
||||||
SetEnv DJANGO_DB_USER ${PG_DB_USER}
|
|
||||||
SetEnv DJANGO_DB_PASSWORD ${PG_DB_PASS}
|
|
||||||
SetEnv DJANGO_DB_HOST localhost
|
|
||||||
SetEnv DJANGO_DB_PORT 5432
|
|
||||||
SetEnv DJANGO_MEDIA_ROOT /opt/wger/media
|
|
||||||
SetEnv DJANGO_STATIC_ROOT /opt/wger/static
|
|
||||||
SetEnv SECRET_KEY ${SECRET_KEY}
|
|
||||||
|
|
||||||
Alias /static/ /opt/wger/static/
|
Alias /static/ /opt/wger/static/
|
||||||
<Directory /opt/wger/static>
|
<Directory /opt/wger/static>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user