feat: Add MinIO storage support and update image URLs
All checks were successful
Deploy Production (merchbay.com) / deploy (push) Successful in 2m54s

- Implemented MinIO storage driver in AppServiceProvider for S3-compatible storage.
- Added helper functions to generate MinIO URLs for files and images.
- Updated filesystem configuration to include MinIO settings.
- Modified site configuration to include MinIO URL.
- Enhanced Docker Compose configuration for local development with MinIO.
- Updated various Blade templates to use MinIO URLs for images instead of local paths.
- Ensured all image references in views are now pointing to MinIO storage.
This commit is contained in:
Frank John Begornia
2026-05-13 00:25:23 +08:00
parent 6c97e60805
commit ad8d8d7564
28 changed files with 229 additions and 76 deletions

View File

@@ -1,3 +1,19 @@
# ─────────────────────────────────────────────────────────────────────────────
# Local development stack
#
# Default (local MariaDB):
# docker compose --env-file .env.local -f docker-compose.local.yml up --build
#
# Remote DB via SSH private-key tunnel:
# 1. Set SSH_HOST, SSH_USER, SSH_KEY_PATH, SSH_DB_REMOTE_HOST,
# SSH_DB_REMOTE_PORT (and DB_* creds) in .env.local
# 2. docker compose --env-file .env.local -f docker-compose.local.yml --profile ssh-db up --build
# The app will talk to db-tunnel (port 3306) instead of the local db.
#
# App: http://localhost:8080
# phpMyAdmin: http://localhost:8081
# ─────────────────────────────────────────────────────────────────────────────
services:
db:
image: mariadb:10.6
@@ -5,10 +21,10 @@ services:
container_name: merchbay_db_local
restart: unless-stopped
environment:
MYSQL_DATABASE: merchbay
MYSQL_DATABASE: ${DB_DATABASE:-merchbay_db}
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: merchbay
MYSQL_PASSWORD: secret
MYSQL_USER: ${DB_USERNAME:-merchbay}
MYSQL_PASSWORD: ${DB_PASSWORD:-secret}
ports:
- "3306:3306"
volumes:
@@ -29,14 +45,14 @@ services:
- APP_DEBUG=true
- APP_URL=http://localhost:8080
- DB_CONNECTION=mysql
- DB_HOST=db
- DB_PORT=3306
- DB_DATABASE=merchbay
- DB_USERNAME=merchbay
- DB_PASSWORD=secret
- DB_HOST=${DB_HOST:-db}
- DB_PORT=${DB_PORT:-3306}
- DB_DATABASE=${DB_DATABASE:-merchbay_db}
- DB_USERNAME=${DB_USERNAME:-merchbay}
- DB_PASSWORD=${DB_PASSWORD:-secret}
- PROD_PRIVATE=http://localhost:8080
- IMAGES_URL=http://localhost:8080
- UPLOAD_URL=http://localhost:8080/uploads/
- IMAGES_URL=${IMAGES_URL:-https://minio.crewsportswear.app/merchbay}
- UPLOAD_URL=${UPLOAD_URL:-https://minio.crewsportswear.app/merchbay/uploads/}
- MAIL_DRIVER=log
- MAIL_HOST=localhost
- MAIL_PORT=1025
@@ -48,15 +64,67 @@ services:
- ANALYTICS_SITE_ID=
- ANALYTICS_CLIENT_ID=
- ANALYTICS_SERVICE_EMAIL=
# MinIO S3 Storage (connect to production MinIO for testing)
- MINIO_ENDPOINT=https://minio.crewsportswear.app
- MINIO_KEY=${MINIO_KEY:-minioadmin}
- MINIO_SECRET=${MINIO_SECRET:-minioadmin}
- MINIO_BUCKET=merchbay
- MINIO_REGION=us-east-1
- MINIO_USE_PATH_STYLE=false
- MINIO_URL=https://minio.crewsportswear.app
env_file:
- path: .env.local
required: false
volumes:
- ./:/var/www/html
- ./storage:/var/www/html/storage
- ./public/uploads:/var/www/html/public/uploads
# Keep the vendor/ directory from the image — prevents the bind-mount
# from wiping out the composer install done during docker build.
- vendor_local:/var/www/html/vendor
depends_on:
- db
networks:
- merchbay-local
# ── SSH tunnel to a remote database ────────────────────────────────────────
# Activated only with: --profile ssh-db
# Requires SSH_HOST, SSH_USER, SSH_KEY_PATH (and optionally SSH_PORT,
# SSH_DB_REMOTE_HOST, SSH_DB_REMOTE_PORT) set in .env.local.
db-tunnel:
profiles:
- ssh-db
image: alpine:3.19
container_name: merchbay_db_tunnel
restart: unless-stopped
environment:
- SSH_HOST=${SSH_HOST}
- SSH_PORT=${SSH_PORT:-22}
- SSH_USER=${SSH_USER:-root}
- SSH_DB_REMOTE_HOST=${SSH_DB_REMOTE_HOST:-127.0.0.1}
- SSH_DB_REMOTE_PORT=${SSH_DB_REMOTE_PORT:-3306}
volumes:
- ${SSH_KEY_PATH:-~/.ssh/id_rsa}:/ssh/id_rsa:ro
command:
- sh
- -c
- |
apk add --no-cache openssh-client
cp /ssh/id_rsa /tmp/id_rsa
chmod 600 /tmp/id_rsa
echo "Starting SSH tunnel to $$SSH_HOST..."
exec ssh -N \
-o StrictHostKeyChecking=no \
-o ServerAliveInterval=30 \
-o ServerAliveCountMax=3 \
-o ExitOnForwardFailure=yes \
-i /tmp/id_rsa \
-L "0.0.0.0:3306:$$SSH_DB_REMOTE_HOST:$$SSH_DB_REMOTE_PORT" \
-p "$$SSH_PORT" \
"$$SSH_USER@$$SSH_HOST"
networks:
- merchbay-local
phpmyadmin:
image: arm64v8/phpmyadmin
platform: linux/arm64
@@ -79,3 +147,4 @@ networks:
volumes:
db_data:
vendor_local: