xTHExBEASTx commited on
Commit
906a710
·
verified ·
1 Parent(s): df3ac6b

Upload 5 files

Browse files
Files changed (2) hide show
  1. Dockerfile +2 -1
  2. start.sh +8 -12
Dockerfile CHANGED
@@ -84,7 +84,8 @@ RUN chmod +x /start.sh
84
 
85
  # User Setup
86
  RUN useradd -m -u 1000 user
87
- RUN chown -R user:user /var/lib/postgresql /var/lib/rabbitmq /var/log/libretime /etc/libretime /var/lib/libretime /srv/libretime /var/lib/nginx /var/log/nginx /var/log/supervisor /var/run/postgresql /var/log/icecast2
 
88
 
89
  # Ensure PHP run directory exists and is writable
90
  RUN mkdir -p /run/php && chown -R user:user /run/php
 
84
 
85
  # User Setup
86
  RUN useradd -m -u 1000 user
87
+ RUN mkdir -p /var/log/rabbitmq
88
+ RUN chown -R user:user /var/lib/postgresql /var/lib/rabbitmq /var/log/rabbitmq /var/log/libretime /etc/libretime /var/lib/libretime /srv/libretime /var/lib/nginx /var/log/nginx /var/log/supervisor /var/run/postgresql /var/log/icecast2
89
 
90
  # Ensure PHP run directory exists and is writable
91
  RUN mkdir -p /run/php && chown -R user:user /run/php
start.sh CHANGED
@@ -27,23 +27,19 @@ if [ ! -s "$PG_DATA/PG_VERSION" ]; then
27
  /usr/lib/postgresql/13/bin/pg_ctl -D "$PG_DATA" -w start
28
 
29
  echo "Creating LibreTime DB and User..."
30
- createdb -h localhost libretime || true
31
- psql -h localhost -c "CREATE USER libretime WITH PASSWORD 'libretime';" || true
32
- psql -h localhost -c "GRANT ALL PRIVILEGES ON DATABASE libretime TO libretime;" || true
33
- psql -h localhost -c "ALTER USER libretime CREATEDB;" || true
 
34
 
35
  echo "Stopping PG..."
36
  /usr/lib/postgresql/13/bin/pg_ctl -D "$PG_DATA" stop
37
  fi
38
 
39
- # 3. Setup RabbitMQ (Environment var usually handles this, or default is fine)
40
- # We assume default guest:guest or libretime:libretime via env in Dockerfile/Supervisor?
41
- # Supervisor sets HOME=/var/lib/rabbitmq.
42
- # We might need to enable plugins or set user.
43
- # For simplicity, we stick to default 'guest' if localhost, but config uses 'libretime'.
44
- # We need to create rabbitmq user if not exists.
45
- # We'll do it in background or let it fail?
46
- # Better: Start rabbitmq server detached, configure, stop.
47
  echo "Configuring RabbitMQ..."
48
  /usr/sbin/rabbitmq-server -detached
49
  sleep 10
 
27
  /usr/lib/postgresql/13/bin/pg_ctl -D "$PG_DATA" -w start
28
 
29
  echo "Creating LibreTime DB and User..."
30
+ # Connect to 'postgres' db as current user (who is superuser due to initdb)
31
+ psql -h localhost -d postgres -c "CREATE DATABASE libretime;" || true
32
+ psql -h localhost -d postgres -c "CREATE USER libretime WITH PASSWORD 'libretime';" || true
33
+ psql -h localhost -d postgres -c "GRANT ALL PRIVILEGES ON DATABASE libretime TO libretime;" || true
34
+ psql -h localhost -d postgres -c "ALTER USER libretime CREATEDB;" || true
35
 
36
  echo "Stopping PG..."
37
  /usr/lib/postgresql/13/bin/pg_ctl -D "$PG_DATA" stop
38
  fi
39
 
40
+ # 3. Setup RabbitMQ
41
+ # Ensure log dir exists and is writable (just in case Dockerfile missed it or volume overwrote it)
42
+ mkdir -p /var/log/rabbitmq
 
 
 
 
 
43
  echo "Configuring RabbitMQ..."
44
  /usr/sbin/rabbitmq-server -detached
45
  sleep 10