2

I'am using minio for file storage, also i've configured it all using docker-compose. My laravel filesystem configuration file looks like this.

's3' => [
        'driver' => 's3',
        'key' => '',
        'secret' => '',
        'region' => 'ap-southeast-1',
        'bucket' => 'students',
        'endpoint' => 'http://minio:9000',
    ]

I can access minio web dashboard using http://minio:9000. But while storing an object I'm encountering following errors.

// code to store file
Storage::disk('s3')->put($bucketFolder . $name, file_get_contents($file));

//Exception thrown
Error executing "PutObject" on "http://students.minio:9000/misc/1641374889-1033010763.png"; AWS HTTP error: cURL error 6: Could not resolve host: students.minio (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://students.minio:9000/misc/1641374889-1033010763.png

I don't why students. is being added to the endpoint url.

pandesantos
  • 339
  • 2
  • 13

3 Answers3

4

I got it right by modifying config.php like below. If anyone has other options please suggest.

's3' => [
        'driver' => 's3',
        'key' => '',
        'secret' => '',
        'region' => 'ap-southeast-1',
        'bucket' => 'students',
        'bucket_endpoint' => true, // added
        'endpoint' => 'http://minio:9000/students',
    ]
pandesantos
  • 339
  • 2
  • 13
0

Arrived at similar problem in golang where there is config property S3ForcePathStyle

s3Config := &aws.Config{
    Credentials: credentials.NewStaticCredentials(apiKey, apiSecret, ""),
    Endpoint:         "http://minio:9000",
    Region:           "ap-southeast-1",
    S3ForcePathStyle: aws.Bool(true), // bool pointer
}
primus
  • 30
  • 4
0

This did not work for me:

'bucket_endpoint' => true

Instead this worked:

'use_path_style_endpoint' => true,

I got it from here: Maximum execution time with Laravel and LocalStack

andreasm
  • 36
  • 3