From 278a779f0d024b9540911a061261feb8cdd20d83 Mon Sep 17 00:00:00 2001 From: Mateusz Wojczal Date: Fri, 16 Feb 2024 12:57:53 +0100 Subject: [PATCH 1/2] local s3 --- .env.example | 15 +++++++++++++-- composer.json | 1 + composer.lock | 2 +- config/filesystems.php | 10 +++++++--- docker-compose.yml | 19 +++++++++++++++++++ docker/.gitignore | 1 + docker/conf/Caddyfile | 11 ++++++++++- 7 files changed, 52 insertions(+), 7 deletions(-) diff --git a/.env.example b/.env.example index 63cbf8d7..69e22f47 100644 --- a/.env.example +++ b/.env.example @@ -3,7 +3,7 @@ APP_ENV=local APP_KEY=base64:pveos6JL8iCwO3MbzoyQpNx6TETMYuUpfZ18CDKl6Cw= APP_DEBUG=true APP_LOG_LEVEL=debug -APP_URL=http://localhost:1000 +APP_URL=http://api.localhost:1001 DB_CONNECTION=pgsql DB_HOST=postgres @@ -50,4 +50,15 @@ MJML_BINARY_PATH=/usr/bin/mjml TRACKER_ENABLED=false -REPORTBRO_URL="https://www.reportbro.com/report/run" \ No newline at end of file +REPORTBRO_URL="https://www.reportbro.com/report/run" + + +FILESYSTEM_DRIVER=s3 + +AWS_ACCESS_KEY_ID=masoud +AWS_SECRET_ACCESS_KEY=tg9t712TG1Odn17fisxXM9y01YrD +AWS_DEFAULT_REGION=us-east-1 +AWS_BUCKET=wellms +AWS_ENDPOINT="http://minio:9000" +AWS_URL="http://storage.localhost:1001/wellms" +AWS_USE_PATH_STYLE_ENDPOINT=true diff --git a/composer.json b/composer.json index a28906b5..cce4a09b 100644 --- a/composer.json +++ b/composer.json @@ -89,6 +89,7 @@ "laravel/passport": "^11", "laravel/socialite": "^5.1", "laravel/tinker": "^2.9", + "league/flysystem-aws-s3-v3": "^3.0", "predis/predis": "^2.2", "psr/http-message": "^1", "sentry/sentry-laravel": "^4.2", diff --git a/composer.lock b/composer.lock index 578725d5..ee3c7877 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4d93a85e3f81d2e76ac92d8dbb536a02", + "content-hash": "7f360ec551953d82991c897559cbc3fd", "packages": [ { "name": "aloha/twilio", diff --git a/config/filesystems.php b/config/filesystems.php index 6344ccd6..4b222a63 100755 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -46,21 +46,21 @@ 'local' => [ 'driver' => 'local', 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', + 'url' => env('APP_URL') . '/storage', 'visibility' => 'public', ], 'testing' => [ 'driver' => 'local', 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', + 'url' => env('APP_URL') . '/storage', 'visibility' => 'public', ], 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', + 'url' => env('APP_URL') . '/storage', 'visibility' => 'public', ], @@ -71,6 +71,10 @@ 'region' => env('AWS_DEFAULT_REGION'), 'bucket' => env('AWS_BUCKET'), 'url' => env('AWS_URL'), + 'endpoint' => env('AWS_ENDPOINT'), + 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), + + ], ], diff --git a/docker-compose.yml b/docker-compose.yml index 7ffbaaf8..b6a97fc1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -73,3 +73,22 @@ services: networks: - escola_lms image: escolalms/reportbro-server:latest + + minio: + image: bitnami/minio + networks: + - escola_lms + ports: + - "9000:9000" + - "9001:9001" + volumes: + - ./docker/minio_storage:/data + - ./docker/conf/minio:/docker-entrypoint-initdb.d + environment: + MINIO_DEFAULT_BUCKETS: "${AWS_BUCKET}:download" + MINIO_ROOT_USER: ${AWS_ACCESS_KEY_ID} + MINIO_ROOT_PASSWORD: ${AWS_SECRET_ACCESS_KEY} + AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID} + AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY} + AWS_BUCKET: ${AWS_BUCKET} + AWS_ENDPOINT: ${AWS_ENDPOINT} diff --git a/docker/.gitignore b/docker/.gitignore index 742df5e9..8be1d254 100644 --- a/docker/.gitignore +++ b/docker/.gitignore @@ -3,3 +3,4 @@ /postgres-data /postgres-backups /pgadmin +/minio_storage \ No newline at end of file diff --git a/docker/conf/Caddyfile b/docker/conf/Caddyfile index a75e7cf0..9e1d9d31 100644 --- a/docker/conf/Caddyfile +++ b/docker/conf/Caddyfile @@ -1,5 +1,5 @@ -http://localhost:1001 { +http://api.localhost:1001 { # Resolve the root directory for the app root * /var/www/html/public @@ -32,3 +32,12 @@ http://localhost:1001 { } +http://storage.localhost:1001 { + reverse_proxy minio:9000 +} + +http://minio.localhost:1001 { + reverse_proxy minio:9001 +} + + From 16e9211d295e568d601ed096d86c9cc23c8a2cd3 Mon Sep 17 00:00:00 2001 From: Mateusz Wojczal Date: Fri, 16 Feb 2024 13:31:40 +0100 Subject: [PATCH 2/2] docker build php8.2 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 50a5e75b..56346fa7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM escolalms/php:8.1-prod +FROM escolalms/php:8.2-prod WORKDIR /var/www/html EXPOSE 80 COPY / /var/www/html