Minio Server
Elixir wrapper around Minio. It starts the minio server alongside your elixir application.
# Config can be used directly with :ex_aws/:ex_aws_s3
s3_config = [
access_key_id: "minio_key",
secret_access_key: "minio_secret",
scheme: "http://",
region: "local",
host: "127.0.0.1",
port: 9000,
# Minio specific
minio_path: "data" # Defaults to ./minio in your mix project
]
# In a supervisor
children = [
{MinioServer, s3_config}
]
# or manually
{:ok, _} = MinioServer.start_link(s3_config)
Minio binary
The minio binary is not included in the package to save on space. But you can easily download them using a mix task:
mix minio_server.download
# or directly
mix minio_server.download --arch darwin-amd64 --version latest
Livecycle Configuration
Minio does support lifecycle configuration, which I'm using to expire abandoned
uploads / multipart chunks. There's an open PR
to add the API to :ex_aws_s3, but until this is merged it'll also be available
with MinioServer.S3Api.put_bucket_lifecycle(bucket, rules), if you have :ex_aws in
your dependencies.
Example
Setup of a new bucket with temp/ folder.
config = s3()
{:ok, _} =
ExAws.S3.put_bucket("default", Keyword.fetch!(config, :region))
|> ExAws.request(config)
livecycle_rules = [
%{
id: "temp-folder-cleanup",
enabled: true,
filter: %{
prefix: "temp/"
},
actions: %{
expiration: %{
trigger: {:days, 1},
expired_object_delete_marker: true
},
abort_incomplete_multipart_upload: %{
trigger: {:days, 1}
}
}
}
]
{:ok, _} =
MinioServer.S3Api.put_bucket_lifecycle("default", livecycle_rules)
|> ExAws.request(config)
Installation
If available in Hex, the package can be installed
by adding minio_server to your list of dependencies in mix.exs:
def deps do
[
{:minio_server, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/minio_server.