fix: processed some pr comments
This commit is contained in:
parent
69316a347e
commit
4e2237a9f9
@ -46,9 +46,6 @@ function update_script() {
|
|||||||
cp /opt/wger_env_backup /opt/wger/.env
|
cp /opt/wger_env_backup /opt/wger/.env
|
||||||
rm -rf /opt/wger_media_backup /opt/wger_env_backup
|
rm -rf /opt/wger_media_backup /opt/wger_env_backup
|
||||||
|
|
||||||
set -a
|
|
||||||
source /opt/wger/.env
|
|
||||||
set +a
|
|
||||||
msg_ok "Restored Data"
|
msg_ok "Restored Data"
|
||||||
|
|
||||||
msg_info "Updating wger"
|
msg_info "Updating wger"
|
||||||
@ -56,7 +53,7 @@ function update_script() {
|
|||||||
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 pip install .
|
$STD uv pip install .
|
||||||
$STD uv pip install gunicorn celery django-redis psycopg2-binary
|
$STD uv pip install gunicorn psycopg2-binary
|
||||||
$STD uv run python manage.py migrate
|
$STD uv run python manage.py migrate
|
||||||
$STD uv run python manage.py collectstatic --no-input
|
$STD uv run python manage.py collectstatic --no-input
|
||||||
msg_ok "Updated wger"
|
msg_ok "Updated wger"
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
"updateable": true,
|
"updateable": true,
|
||||||
"privileged": false,
|
"privileged": false,
|
||||||
"interface_port": 3000,
|
"interface_port": 3000,
|
||||||
"documentation": "https://wger.readthedocs.io/en/latest/index.html#",
|
"documentation": "https://wger.readthedocs.io/en/latest/index.html",
|
||||||
"website": "https://wger.de",
|
"website": "https://wger.de",
|
||||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/wger.webp",
|
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/wger.webp",
|
||||||
"config_path": "/opt/wger/wger.env",
|
"config_path": "/opt/wger/wger.env",
|
||||||
|
|||||||
@ -13,6 +13,8 @@ setting_up_container
|
|||||||
network_check
|
network_check
|
||||||
update_os
|
update_os
|
||||||
|
|
||||||
|
import_local_ip
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt install -y \
|
$STD apt install -y \
|
||||||
build-essential \
|
build-essential \
|
||||||
@ -29,22 +31,16 @@ PG_DB_NAME="wger" PG_DB_USER="wger" setup_postgresql_db
|
|||||||
|
|
||||||
fetch_and_deploy_gh_release "wger" "wger-project/wger" "tarball" "latest" "/opt/wger"
|
fetch_and_deploy_gh_release "wger" "wger-project/wger" "tarball" "latest" "/opt/wger"
|
||||||
|
|
||||||
WG_IP="$(hostname -I | awk '{print $1}')"
|
|
||||||
WG_PORT="3000"
|
|
||||||
WG_URL="http://${WG_IP}:${WG_PORT}"
|
|
||||||
|
|
||||||
msg_info "Setting up wger"
|
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 corepack enable
|
||||||
$STD npm install
|
$STD npm install
|
||||||
$STD npm run build:css:sass
|
$STD npm run build:css:sass
|
||||||
|
|
||||||
$STD uv venv
|
$STD uv venv
|
||||||
$STD uv pip install .
|
$STD uv pip install . --group docker
|
||||||
$STD uv pip install gunicorn psycopg2-binary
|
# $STD uv pip install psycopg2-binary
|
||||||
|
|
||||||
SECRET_KEY=$(openssl rand -base64 40)
|
SECRET_KEY=$(openssl rand -base64 40)
|
||||||
|
|
||||||
@ -64,8 +60,8 @@ DJANGO_MEDIA_ROOT=/opt/wger/media
|
|||||||
DJANGO_STATIC_ROOT=/opt/wger/static
|
DJANGO_STATIC_ROOT=/opt/wger/static
|
||||||
DJANGO_STATIC_URL=/static/
|
DJANGO_STATIC_URL=/static/
|
||||||
|
|
||||||
ALLOWED_HOSTS=${WG_IP},localhost,127.0.0.1
|
ALLOWED_HOSTS=${LOCAL_IP},localhost,127.0.0.1
|
||||||
CSRF_TRUSTED_ORIGINS=${WG_URL}
|
CSRF_TRUSTED_ORIGINS=http://${LOCAL_IP}:3000
|
||||||
|
|
||||||
USE_X_FORWARDED_HOST=True
|
USE_X_FORWARDED_HOST=True
|
||||||
SECURE_PROXY_SSL_HEADER=HTTP_X_FORWARDED_PROTO,http
|
SECURE_PROXY_SSL_HEADER=HTTP_X_FORWARDED_PROTO,http
|
||||||
@ -80,7 +76,7 @@ USE_CELERY=True
|
|||||||
CELERY_BROKER=redis://127.0.0.1:6379/2
|
CELERY_BROKER=redis://127.0.0.1:6379/2
|
||||||
CELERY_BACKEND=redis://127.0.0.1:6379/2
|
CELERY_BACKEND=redis://127.0.0.1:6379/2
|
||||||
|
|
||||||
SITE_URL=${WG_URL}
|
SITE_URL=http://${LOCAL_IP}:3000
|
||||||
SECRET_KEY=${SECRET_KEY}
|
SECRET_KEY=${SECRET_KEY}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -88,7 +84,6 @@ set -a && source /opt/wger/.env && set +a
|
|||||||
|
|
||||||
$STD uv run wger bootstrap
|
$STD uv run wger bootstrap
|
||||||
$STD uv run python manage.py collectstatic --no-input
|
$STD uv run python manage.py collectstatic --no-input
|
||||||
|
|
||||||
cat <<EOF | uv run python manage.py shell
|
cat <<EOF | uv run python manage.py shell
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
@ -105,9 +100,9 @@ if created:
|
|||||||
user.save()
|
user.save()
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
msg_ok "wger configured"
|
msg_ok "Set up wger"
|
||||||
|
|
||||||
msg_info "Creating Gunicorn service"
|
msg_info "Creating Config and Services"
|
||||||
cat <<EOF >/etc/systemd/system/wger.service
|
cat <<EOF >/etc/systemd/system/wger.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=wger Gunicorn
|
Description=wger Gunicorn
|
||||||
@ -128,9 +123,7 @@ Restart=always
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
msg_ok "Gunicorn service created"
|
|
||||||
|
|
||||||
msg_info "Creating Celery worker service"
|
|
||||||
cat <<EOF >/etc/systemd/system/celery.service
|
cat <<EOF >/etc/systemd/system/celery.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=wger Celery Worker
|
Description=wger Celery Worker
|
||||||
@ -146,11 +139,6 @@ Restart=always
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
msg_ok "Celery worker service created"
|
|
||||||
|
|
||||||
msg_info "Creating Celery beat service"
|
|
||||||
mkdir -p /var/lib/wger/celery
|
|
||||||
chmod 700 /var/lib/wger/celery
|
|
||||||
|
|
||||||
cat <<EOF >/etc/systemd/system/celery-beat.service
|
cat <<EOF >/etc/systemd/system/celery-beat.service
|
||||||
[Unit]
|
[Unit]
|
||||||
@ -168,9 +156,7 @@ Restart=always
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
msg_ok "Celery beat service created"
|
|
||||||
|
|
||||||
msg_info "Configuring Nginx"
|
|
||||||
cat <<'EOF' >/etc/nginx/sites-available/wger
|
cat <<'EOF' >/etc/nginx/sites-available/wger
|
||||||
server {
|
server {
|
||||||
listen 3000;
|
listen 3000;
|
||||||
@ -197,12 +183,11 @@ server {
|
|||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
msg_ok "Nginx configured"
|
msg_ok "Created Config and Services"
|
||||||
|
|
||||||
systemctl enable --now redis-server nginx wger celery celery-beat
|
|
||||||
|
|
||||||
$STD rm -f /etc/nginx/sites-enabled/default
|
$STD rm -f /etc/nginx/sites-enabled/default
|
||||||
$STD ln -sf /etc/nginx/sites-available/wger /etc/nginx/sites-enabled/wger
|
$STD ln -sf /etc/nginx/sites-available/wger /etc/nginx/sites-enabled/wger
|
||||||
|
systemctl enable -q --now redis-server nginx wger celery celery-beat
|
||||||
|
|
||||||
systemctl restart nginx
|
systemctl restart nginx
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user