init npm / node on dev environment setup, run npm server (need to make this configurable), more init items for dispatcharr

This commit is contained in:
dekzter 2025-03-05 08:33:12 -05:00
parent 6b0becce62
commit 59f8ec033c
6 changed files with 36 additions and 7 deletions

View file

@ -24,6 +24,7 @@ RUN apt-get update && \
python -m pip install virtualenv && \
virtualenv /dispatcharrpy && \
git clone https://github.com/Dispatcharr/Dispatcharr /app && \
cd /app && \
git checkout --track origin/uwsgi && \
cd /app && \
pip install --no-cache-dir -r requirements.txt && \

View file

@ -50,8 +50,10 @@ fi
chmod +x /etc/profile.d/dispatcharr.sh
# Run init scripts
bash /app/docker/init/01-user-setup.sh
bash /app/docker/init/02-postgres.sh
echo "Starting init process..."
. /app/docker/init/01-user-setup.sh
. /app/docker/init/02-postgres.sh
. /app/docker/init/03-init-dispatcharr.sh
# Start PostgreSQL
echo "Starting Postgres..."
@ -65,11 +67,15 @@ postgres_pid=$(su - postgres -c "/usr/lib/postgresql/14/bin/pg_ctl -D /data stat
echo "✅ Postgres started with PID $postgres_pid"
pids+=("$postgres_pid")
echo "🚀 Starting nginx..."
nginx
nginx_pid=$(pgrep nginx | sort | head -n1)
echo "✅ nginx started with PID $nginx_pid"
pids+=("$nginx_pid")
if [ "$DISPATCHARR_ENV" = "dev" ]; then
. /app/docker/init/99-init-dev.sh
else
echo "🚀 Starting nginx..."
nginx
nginx_pid=$(pgrep nginx | sort | head -n1)
echo "✅ nginx started with PID $nginx_pid"
pids+=("$nginx_pid")
fi
echo "🚀 Starting uwsgi..."
su - $POSTGRES_USER -c "cd /app && uwsgi --ini /app/docker/uwsgi.ini &"

View file

@ -49,4 +49,7 @@ EOF
fi
kill $postgres_pid
while kill -0 $postgres_pid; do
sleep 1
done
fi

View file

@ -3,4 +3,5 @@
# Required so both uwsgi and nginx (www-data) can use it
# @TODO: change nginx to run as the same use as uwsgi
touch /app/uwsgi.sock
chown -R $PUID:$PGID /app
chmod 777 /app/uwsgi.sock

View file

@ -0,0 +1,17 @@
#!/bin/bash
echo "🚀 Development Mode - Setting up Frontend..."
# Install Node.js
if ! command -v node 2>&1 >/dev/null
then
echo "=== setting up nodejs ==="
curl -sL https://deb.nodesource.com/setup_23.x -o /tmp/nodesource_setup.sh
bash /tmp/nodesource_setup.sh
apt-get update
apt-get install -y --no-install-recommends \
nodejs
fi
# Install frontend dependencies
cd /app/frontend && npm install

View file

@ -4,6 +4,7 @@ exec-pre-app = python manage.py migrate --noinput
attach-daemon = celery -A dispatcharr worker -l info
attach-daemon = redis-server
attach-daemon = cd /app/frontend && npm run start
# Core settings
chdir = /app