Skip to content

Commit

Permalink
Add Minio
Browse files Browse the repository at this point in the history
  • Loading branch information
davestephens committed Jul 15, 2023
1 parent f6b7642 commit bf4d7f9
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ If you have a spare domain name you can configure applications to be accessible
* [Minecraft Server](https://www.minecraft.net/) - Server edition of the popular building and exploring game
* [MiniDLNA](https://sourceforge.net/projects/minidlna/) - simple media server which is fully compliant with DLNA/UPnP-AV clients
* [Miniflux](https://miniflux.app/) - An RSS news reader
* [Minio](https://min.io/) - MinIO is a high-performance, S3 compatible object store
* [Mosquitto](https://mosquitto.org) - An open source MQTT broker
* [Mumble](https://www.mumble.info) - Open source, low latency, high quality voice chat
* [Mylar](https://github.com/evilhero/mylar) - An automated Comic Book downloader (cbr/cbz) for use with SABnzbd, NZBGet and torrents
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@
tags:
- miniflux

- role: minio
tags:
- minio

- role: mosquitto
tags:
- mosquitto
Expand Down
25 changes: 25 additions & 0 deletions roles/minio/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
# enable or disable the application
minio_enabled: false
minio_available_externally: false

# directories
minio_data_directory: "{{ docker_home }}/minio"

# env
minio_admin_username: admin
minio_admin_password: supersecure

# network
minio_hostname: "minio"
minio_network_name: "minio"
minio_api_port: "9000"
minio_console_port: "9009"

# docker
minio_container_name: "minio"
minio_image_name: "minio/minio"
minio_image_version: "latest"

# specs
minio_memory: "1g"
6 changes: 6 additions & 0 deletions roles/minio/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
minio_enabled: true
10 changes: 10 additions & 0 deletions roles/minio/molecule/default/side_effect.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Stop
hosts: all
become: true
tasks:
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
ansible.builtin.include_role:
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
vars:
minio_enabled: false
18 changes: 18 additions & 0 deletions roles/minio/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- ansible.builtin.include_vars:
file: ../../defaults/main.yml

- name: Get minio container state
community.docker.docker_container:
name: "{{ minio_container_name }}"
register: result

- name: Check if minio containers are running
ansible.builtin.assert:
that:
- result.container['State']['Status'] == "running"
- result.container['State']['Restarting'] == false
18 changes: 18 additions & 0 deletions roles/minio/molecule/default/verify_stopped.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- ansible.builtin.include_vars:
file: ../../defaults/main.yml

- name: Try and stop and remove minio
community.docker.docker_container:
name: "{{ minio_container_name }}"
state: absent
register: result

- name: Check if minio is stopped
ansible.builtin.assert:
that:
- not result.changed
42 changes: 42 additions & 0 deletions roles/minio/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
- name: Start Minio
block:
- name: Create Minio Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ minio_data_directory }}/data"


- name: Create minio Docker Container
community.docker.docker_container:
name: "{{ minio_container_name }}"
image: "{{ minio_image_name }}:{{ minio_image_version }}"
pull: true
ports:
- "{{ minio_api_port }}:9000"
- "{{ minio_console_port }}:{{ minio_console_port }}"
command: 'server /data --console-address ":{{ minio_console_port }}"'
env:
MINIO_ROOT_USER: "{{ minio_admin_username }}"
MINIO_ROOT_PASSWORD: "{{ minio_admin_password }}"
MINIO_PROMETHEUS_AUTH_TYPE: public
restart_policy: unless-stopped
memory: "{{ minio_memory }}"
labels:
traefik.enable: "{{ minio_available_externally | string }}"
traefik.http.routers.minio.rule: "Host(`{{ minio_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.minio.tls.certresolver: "letsencrypt"
traefik.http.routers.minio.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.minio.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.minio.loadbalancer.server.port: "9000"
when: minio_enabled is true

- name: Stop minio
block:
- name: Stop minio
community.docker.docker_container:
name: "{{ minio_container_name }}"
state: absent
when: minio_enabled is false
15 changes: 15 additions & 0 deletions website/docs/applications/system-tools/minio.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: "Minioo"
---

Homepage: <https://min.io/>

Docker Container: [Minio](https://hub.docker.com/r/minio/minio)

MinIO is a High Performance Object Storage released under GNU Affero General Public License v3.0. It is API compatible with Amazon S3 cloud storage service. Use MinIO to build high performance infrastructure for machine learning, analytics and application data workloads.

## Usage

Set `minio_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.

The Minio web interface can be found at <http://ansible_nas_host_or_ip:9009>.

0 comments on commit bf4d7f9

Please sign in to comment.