Skip to content

A self-hosted media server and file management system

more fixes to docker and stop using supervisor

aminnausine7542b1f065d
diff --git a/Dockerfile b/Dockerfile
index be93f0de..e92dfe20 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -11,12 +11,9 @@ RUN apk update && apk add --no-cache \
oniguruma-dev \
postgresql-dev \
postgresql-client \
- nodejs \
- npm \
ffmpeg \
exiftool \
- supervisor \
- cronie
+ supervisor
# Install PHP extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
@@ -28,51 +25,44 @@ COPY --from=composer/composer:latest-bin /composer /usr/bin/composer
RUN echo "error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED" > /usr/local/etc/php/conf.d/error_reporting.ini
-# Create Supervisor directory
-RUN mkdir -p /etc/supervisor/conf.d
+# # Create Supervisor directory
+# RUN mkdir -p /etc/supervisor/conf.d
-# Copy Supervisor main config
-COPY docker/supervisor/supervisord.conf /etc/supervisord.conf
-# Copy Supervisor configuration
-COPY docker/supervisor/laravel-worker.conf /etc/supervisor/conf.d/laravel-worker.conf
+# # Copy Supervisor main config
+# COPY docker/supervisor/supervisord.conf /etc/supervisord.conf
+# # Copy Supervisor configuration
+# COPY docker/supervisor/laravel-worker.conf /etc/supervisor/conf.d/laravel-worker.conf
-# Copy crontab file
-COPY docker/crontab /etc/crontabs/www-data
+# # Copy crontab file
+# COPY docker/crontab /etc/crontabs/www-data
-# Ensure correct permissions
-RUN chmod 0644 /etc/crontabs/www-data
+# # Ensure correct permissions
+# RUN chmod 0644 /etc/crontabs/www-data
-RUN crond
+# RUN crond
WORKDIR /var/www/html
COPY . .
+
RUN composer install --no-dev --optimize-autoloader --no-interaction --no-scripts
RUN chmod o+w ./storage/ -R
RUN chmod o+w ./public/ -R
-RUN cp .env.example .env
-
-RUN php artisan key:generate
-
-RUN php artisan reverb:generate
-
-RUN php artisan storage:link
+# Copy .env and set up Laravel
+RUN cp .env.example .env && php artisan key:generate && php artisan reverb:generate && php artisan storage:link
FROM node:22 AS builder
WORKDIR /var/www/html
-COPY package.json ./
-COPY package-lock.json ./
+COPY package.json package-lock.json ./
+RUN npm ci
# Copy application files again
COPY --from=backend /var/www/html /var/www/html
-RUN npm ci
-
-
RUN npm run build-only && \
npm cache clean --force && \
rm -rf node_modules
@@ -82,15 +72,18 @@ FROM backend AS final
COPY --from=builder /var/www/html/public/build ./public/build
-RUN chown -R www-data:www-data /var/www/html/
-RUN chmod -R 755 /var/www/html/
+# Set correct permissions
+RUN chown -R www-data:www-data /var/www/html && chmod -R 755 /var/www/html
-USER www-data
+# Clean up unnecessary files
+RUN rm -rf node_modules vendor/bin ~/.composer/cache /usr/local/bin/composer
# Make storage folders mountable
VOLUME [ "/var/www/html/storage" ]
+USER www-data
+
EXPOSE 9000
ENTRYPOINT ["/var/www/html/docker/entrypoint.sh"]
-CMD ["supervisord", "-c", "/etc/supervisord.conf"]
-# CMD ["php-fpm"]
+# CMD ["supervisord", "-c", "/etc/supervisord.conf"]
+CMD ["php-fpm"]
diff --git a/conf/nginx/nginx-site.conf b/conf/nginx/nginx-site.conf
deleted file mode 100644
index 89d070ce..00000000
--- a/conf/nginx/nginx-site.conf
+++ /dev/null
@@ -1,20 +0,0 @@
-server {
- listen 80;
- index index.php index.html;
- root /var/www/html/public;
-
- location / {
- try_files $uri $uri/ /index.php?$query_string;
- }
-
- location ~ \.php$ {
- fastcgi_pass app:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
-
- location ~ /\.ht {
- deny all;
- }
-}
diff --git a/docker-compose.yaml b/docker-compose.yaml
index 66c54d38..9cd69270 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -23,44 +23,62 @@ services:
- DB_DATABASE=mediaServer
- DB_USERNAME=postgres
- DB_PASSWORD=root
- # queue:
- # image: mediaserver:latest # Reuse the built image
- # container_name: job_queue
- # command: php artisan queue:work --timeout=3600 --tries=3
- # restart: unless-stopped
- # tty: true
- # volumes:
- # - ./data:/var/www/html/storage/app/public
- # networks:
- # - docker-network
- # depends_on:
- # - app
- # event-queue:
- # image: mediaserver:latest # Reuse the built image
- # container_name: event_queue
- # command: php artisan queue:work --queue=high --tries=3
- # restart: unless-stopped
- # tty: true
- # volumes:
- # - ./data:/var/www/html/storage/app/public
- # networks:
- # - docker-network
- # depends_on:
- # - app
- # scheduler:
- # image: mediaserver:latest # Reuse the built image
- # container_name: laravel_scheduler
- # command: php artisan schedule:work
- # restart: unless-stopped
- # tty: true
- # volumes:
- # - ./data:/var/www/html/storage/app/public
- # networks:
- # - docker-network
- # depends_on:
- # - app
+ queue:
+ image: aminnausin/mediaserver:latest # Reuse the built image
+ container_name: job_queue
+ command: php artisan queue:work --timeout=3600 --tries=3
+ restart: unless-stopped
+ tty: true
+ volumes:
+ - ./data:/var/www/html/storage/app/public
+ networks:
+ - docker-network
+ depends_on:
+ - db
+ environment:
+ - DB_HOST=db
+ - DB_PORT=5432
+ - DB_DATABASE=mediaServer
+ - DB_USERNAME=postgres
+ - DB_PASSWORD=root
+ event-queue:
+ image: aminnausin/mediaserver:latest # Reuse the built image
+ container_name: event_queue
+ command: php artisan queue:work --queue=high --tries=3
+ restart: unless-stopped
+ tty: true
+ volumes:
+ - ./data:/var/www/html/storage/app/public
+ networks:
+ - docker-network
+ depends_on:
+ - db
+ environment:
+ - DB_HOST=db
+ - DB_PORT=5432
+ - DB_DATABASE=mediaServer
+ - DB_USERNAME=postgres
+ - DB_PASSWORD=root
+ scheduler:
+ image: aminnausin/mediaserver:latest # Reuse the built image
+ container_name: laravel_scheduler
+ command: php artisan schedule:work
+ restart: unless-stopped
+ tty: true
+ volumes:
+ - ./data:/var/www/html/storage/app/public
+ networks:
+ - docker-network
+ depends_on:
+ - db
+ environment:
+ - DB_HOST=db
+ - DB_PORT=5432
+ - DB_DATABASE=mediaServer
+ - DB_USERNAME=postgres
+ - DB_PASSWORD=root
# pulse:
- # image: mediaserver:latest # Reuse the built image
+ # image: aminnausin/mediaserver:latest # Reuse the built image
# container_name: pulse
# command: php artisan pulse:check
# restart: unless-stopped
@@ -70,24 +88,35 @@ services:
# networks:
# - docker-network
# depends_on:
- # - app
- # ws:
- # image: mediaserver:latest # Reuse the built image
- # container_name: ws
- # command: php artisan reverb:start
- # restart: unless-stopped
- # tty: true
- # volumes:
- # - ./data:/var/www/html/storage/app/public
- # ports:
- # - 6001:6001
- # expose:
- # - '6001'
- # networks:
- # - docker-network
- # depends_on:
- # - app
-
+ # - db
+ # environment:
+ # - DB_HOST=db
+ # - DB_PORT=5432
+ # - DB_DATABASE=mediaServer
+ # - DB_USERNAME=postgres
+ # - DB_PASSWORD=root
+ ws:
+ image: aminnausin/mediaserver:latest # Reuse the built image
+ container_name: ws
+ command: php artisan reverb:start
+ restart: unless-stopped
+ tty: true
+ volumes:
+ - ./data:/var/www/html/storage/app/public
+ ports:
+ - 6001:6001
+ expose:
+ - '6001'
+ networks:
+ - docker-network
+ depends_on:
+ - db
+ environment:
+ - DB_HOST=db
+ - DB_PORT=5432
+ - DB_DATABASE=mediaServer
+ - DB_USERNAME=postgres
+ - DB_PASSWORD=root
nginx:
image: nginx:alpine
container_name: nginx
@@ -103,19 +132,6 @@ services:
- app
networks:
- docker-network
- caddy:
- image: caddy:2.9.1-alpine
- container_name: caddy
- ports:
- - 80:80
- - 443:443
- - 443:443/udp
- volumes:
- - ./docker/caddy/Caddyfile:/etc/caddy/Caddyfile
- networks:
- - docker-network
- depends_on:
- - nginx
db:
image: bitnami/postgresql:17.2.0
container_name: database
@@ -141,3 +157,17 @@ volumes:
networks:
docker-network:
driver: bridge
+
+ # caddy:
+ # image: caddy:2.9.1-alpine
+ # container_name: caddy
+ # ports:
+ # - 80:80
+ # - 443:443
+ # - 443:443/udp
+ # volumes:
+ # - ./docker/caddy/Caddyfile:/etc/caddy/Caddyfile
+ # networks:
+ # - docker-network
+ # depends_on:
+ # - nginx
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 338095d7..e2a2b9e8 100644
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -15,6 +15,6 @@ done
php artisan migrate
# Start Supervisor in the background
-echo "Starting Supervisor..."
+# echo "Starting Supervisor..."
exec "$@"
diff --git a/routes/console.php b/routes/console.php
index b8ca9d63..f654987e 100755
--- a/routes/console.php
+++ b/routes/console.php
@@ -10,5 +10,4 @@ use Illuminate\Support\Facades\Schedule;
// })->purpose('Display an inspiring quote')->hourly();
Schedule::job(new ScheduledIndexFiles)->everySixHours()->environments(['staging', 'production']);
-Schedule::command('pulse:check')->everyMinute();
Schedule::command('sanctum:prune-expired --hours=2')->daily();