Skip to content

Commit

Permalink
Merge pull request #40 from ddev/feat/cleanup
Browse files Browse the repository at this point in the history
Addon cleanup
  • Loading branch information
stasadev committed May 14, 2024
2 parents 3f7e76e + 5d5d177 commit 29f3d3c
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/cron_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: "Daily tests"
on:
pull_request:
push:
branches: [main]
branches:
- master

schedule:
- cron: "25 08 * * *"
Expand Down
3 changes: 2 additions & 1 deletion .minioImageBuild/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# ddev-generated
#ddev-generated

FROM minio/minio:latest

COPY ddev-entrypoint.sh /usr/bin/ddev-entrypoint.sh
Expand Down
3 changes: 2 additions & 1 deletion .minioImageBuild/ddev-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh
# ddev-generated
#ddev-generated

mkdir -p ~/.minio/certs/CAs
cp -ar /mnt/ddev-global-cache/mkcert/* ~/.minio/certs/CAs

Expand Down
73 changes: 65 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

# ddev-minio - use MinIO object storage in DDEV

![GitHub release (with filter)](https://img.shields.io/github/v/release/oblakstudio/ddev-minio)
[![Daily tests](https://github.com/oblakstudio/ddev-minio/actions/workflows/cron_tests.yml/badge.svg)](https://github.com/oblakstudio/ddev-minio/actions/workflows/cron_tests.yml)
![GitHub release (with filter)](https://img.shields.io/github/v/release/ddev/ddev-minio)
[![Daily tests](https://github.com/ddev/ddev-minio/actions/workflows/cron_tests.yml/badge.svg)](https://github.com/ddev/ddev-minio/actions/workflows/cron_tests.yml)
[![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)
![project is maintained](https://img.shields.io/maintenance/yes/2024.svg)

Expand All @@ -13,24 +13,81 @@ This repository provides MinIO add-on to [DDEV](https://ddev.readthedocs.io).

It's based on [MinIO official image](https://hub.docker.com/r/minio/minio) and [DDEV custom compose files](https://ddev.readthedocs.io/en/stable/users/extend/custom-compose-files/)

## Installation

```bash
$ ddev get ddev/ddev-minio
$ ddev restart
```

## Configuration

### MinIO bucket
### MinIO console

Login to MinIO console `https://<project>.ddev.site:9090` login with credentials `ddevminio:ddevminio` and create a bucket.

### Composer package
### File access

Project docker instances can access MinIO api via `http://minio:10101`

DDEV Router is configured to proxy the requests to `https://<project>.ddev.site:10101` to MinIO S3 Api.

Example URLs for accessing files are

| Bucket | File path | Internal URL | External URL |
|----------|------------------------|--------------------------------------------------|-----------------------------------------------------------------|
| `photos` | `vacation/seaside.jpg` | `http://minio:10101/photos/vacation/seaside.jpg` | `https://<project>.ddev.site:10101/photos/vacation/seaside.jpg` |
| `music` | `tron/derezzed.mp3` | `http://minio:10101/music/tron/derezzed.mp3` | `https://<project>.ddev.site:10101/music/tron/derezzed.mp3` |

## Connecting from PHP

Your project will most likely require the [AWS PHP SDK](https://packagist.org/packages/aws/aws-sdk-php). You can install it like this
### Installation

Since MinIO is S3 compatible you can use [AWS PHP SDK](https://packagist.org/packages/aws/aws-sdk-php). Install it with composer:

```bash
$ ddev composer require aws/aws-sdk-php
```
Project docker instances can access MinIO api via `http://minio:10101`

### Public access
### Basic usage

DDEV Router is configured to proxy the requests to `https://<project>.ddev.site:10101` to MinIO S3 Api.
```php
<?php

require __DIR__ . '/vendor/autoload.php';

$s3 = new \Aws\S3\S3Client([
'endpoint' => 'http://minio:10101',
'credentials' => [
'key' => 'ddevminio',
'secret' => 'ddevminio',
],
'region' => 'us-east-1',
'version' => 'latest',
'use_path_style_endpoint' => true,
]);

$bucketName = 'ddev-minio';

if (!$s3->doesBucketExist($bucketName)) {
$s3->createBucket([
'Bucket' => $bucketName,
]);
}

$s3->putObject([
'Bucket' => $bucketName,
'Key' => 'ddev-test',
'Body' => 'DDEV Minio is working!',
]);

$object = $s3->getObject([
'Bucket' => $bucketName,
'Key' => 'ddev-test',
]);

echo $object['Body'];
```

## Commands

Expand Down

0 comments on commit 29f3d3c

Please sign in to comment.