Skip to content

Commit

Permalink
Clean Up Local Minio
Browse files Browse the repository at this point in the history
  • Loading branch information
mrnicegyu11 committed Dec 3, 2024
1 parent 36b193b commit cd22e09
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 126 deletions.
44 changes: 6 additions & 38 deletions services/minio/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
.DEFAULT_GOAL := help



# Internal VARIABLES ------------------------------------------------
# STACK_NAME defaults to name of the current directory. Should not to be changed if you follow GitOps operating procedures.
# STACK_NAME defaults to name of the current directory.
STACK_NAME = $(notdir $(shell pwd))
DOCKER_MINIO_ACCESS_KEY = $(shell docker secret inspect --format {{.Spec.Name}} minio_secret_key 2>/dev/null)
DOCKER_MINIO_SECRET_KEY = $(shell docker secret inspect --format {{.Spec.Name}} minio_access_key 2>/dev/null)
Expand All @@ -14,52 +12,22 @@ REPO_BASE_DIR := $(shell git rev-parse --show-toplevel)
include ${REPO_BASE_DIR}/scripts/common.Makefile

.PHONY: up
up: .init .env ${TEMP_COMPOSE} .create-secrets ## Deploys or updates current stack "$(STACK_NAME)" using replicas=X (defaults to 1)
up: .init .env ${TEMP_COMPOSE} .create-secrets
@docker stack deploy --with-registry-auth --prune --compose-file ${TEMP_COMPOSE} $(STACK_NAME)
# "in case you created more than 1 replicas, you need to label the nodes accordingly using"
# "'docker node update --label-add minioX=true' with X being from 1 to number of replicas."

.PHONY: up-letsencrypt-http
up-letsencrypt-http: .init .env ${TEMP_COMPOSE}-letsencrypt-http .create-secrets ## Deploys minio stack using let's encrypt http challenge
@docker stack deploy --with-registry-auth --prune --compose-file ${TEMP_COMPOSE}-letsencrypt-http ${STACK_NAME}
# "in case you created more than 1 replicas, you need to label the nodes accordingly using"
# "'docker node update --label-add minioX=true' with X being from 1 to number of replicas."

.PHONY: up-letsencrypt-dns
up-letsencrypt-dns: .init .env ${TEMP_COMPOSE}-letsencrypt-dns .create-secrets ## Deploys minio stack using let's encrypt dns challenge
@docker stack deploy --with-registry-auth --prune --compose-file ${TEMP_COMPOSE}-letsencrypt-dns ${STACK_NAME}
# "in case you created more than 1 replicas, you need to label the nodes accordingly using"
# "'docker node update --label-add minioX=true' with X being from 1 to number of replicas."

.PHONY: up-dalco
up-dalco: up ## Deploys minio stack for Dalco Cluster
up-dalco: up

.PHONY: up-master
up-master: up ## Deploys minio stack for Master Cluster
up-master: up

.PHONY: up-local
up-local: up

.PHONY: ${TEMP_COMPOSE}
${TEMP_COMPOSE}: docker-compose.yaml.j2 .venv .env
$(call jinja, $<, tmp.yaml)
@${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env tmp.yaml > $@
@rm tmp.yaml

.PHONY: ${TEMP_COMPOSE}-letsencrypt-http
${TEMP_COMPOSE}-letsencrypt-http: docker-compose.yaml.j2 docker-compose.letsencrypt.http.yaml.j2 .venv .env
$(call jinja, $<, tmp.yaml)
$(call jinja, docker-compose.letsencrypt.http.yaml.j2, tmp-letsencrypt.http.yaml)
@${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env tmp.yaml tmp-letsencrypt.http.yaml > $@
@rm tmp.yaml tmp-letsencrypt.http.yaml

${TEMP_COMPOSE}: docker-compose.yaml .venv .env
@${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env docker-compose.yaml > $@

.PHONY: ${TEMP_COMPOSE}-letsencrypt-dns
${TEMP_COMPOSE}-letsencrypt-dns: docker-compose.yaml.j2 docker-compose.letsencrypt.dns.yaml.j2 .venv .env
$(call jinja, $<, tmp.yaml)
$(call jinja, docker-compose.letsencrypt.dns.yaml.j2, tmp-letsencrypt.dns.yaml)
@${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env tmp.yaml tmp-letsencrypt.dns.yaml > $@
@rm tmp.yaml tmp-letsencrypt.dns.yaml

.create-secrets:
@$(if $(DOCKER_MINIO_ACCESS_KEY), \
Expand Down
27 changes: 0 additions & 27 deletions services/minio/README.md

This file was deleted.

11 changes: 0 additions & 11 deletions services/minio/docker-compose.letsencrypt.dns.yaml.j2

This file was deleted.

11 changes: 0 additions & 11 deletions services/minio/docker-compose.letsencrypt.http.yaml.j2

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
version: '3.7'
services:
{% set num_minios = MINIO_NUM_MINIOS %}
{% set num_partitions = MINIO_NUM_PARTITIONS %}
{% set host_folder = MINIO_HOST_DATA_FOLDER %}
{%- for i in range(num_minios|int) %}
{%- set service_id = i+1 %}
minio{{ service_id|string }}:
minio:
image: minio/minio:RELEASE.2023-06-19T19-52-50Z
init: true
hostname: minio{{ service_id|string }}
volumes: # default uses a named volume, option2 is to use the variable to set specific mount path(s)
{%- for j in range(num_partitions|int) %}
{% if host_folder == 'true' %}
- /data/disk{{ j|string }}/minio:/data{{ j|string }}
{% else %}
- minio{{ service_id|string }}_data_part{{ j|string }}:/data{{ j|string }}
{% endif %}
{%- endfor %}
hostname: minio
volumes:
- minio_data:/data
networks:
- default
- public
Expand All @@ -32,11 +21,6 @@ services:
delay: 10s
max_attempts: 10
window: 60s
{%- if num_minios|int > 1 %}
placement:
constraints:
- {{ "node.labels.minio" ~ service_id|string ~ "==true" }}
{%- endif %}
labels:
- traefik.enable=true
- traefik.docker.network=${PUBLIC_NETWORK}
Expand All @@ -48,23 +32,13 @@ services:
- traefik.http.routers.minio.tls=true
- traefik.http.routers.minio.middlewares=ops_gzip@swarm
command: >
server
{%- for i in range(num_minios|int) %}
{%- for j in range(num_partitions|int) %}
{% if num_minios|int > 1 %}http://minio{{ (i+1)|string }}{% endif %}/data{{ j|string }}
{%- endfor %}
{%- endfor %}
server /data
secrets:
- minio_secret_key
- minio_access_key

{% endfor %}
volumes:
{%- for i in range(num_minios|int) %}
{%- for j in range(num_partitions|int) %}
minio{{ (i+1)|string }}_data_part{{ j|string }}:
{%- endfor %}
{%- endfor %}
minio_data:


networks:
public:
Expand Down
Empty file removed services/minio/secrets/.gitkeep
Empty file.
6 changes: 0 additions & 6 deletions services/minio/template.env
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
# define MINIO Access and Secret keys
MINIO_ACCESS_KEY=${S3_ACCESS_KEY}
MINIO_SECRET_KEY=${S3_SECRET_KEY}
# define the number of MINIO replicas
MINIO_NUM_MINIOS=${MINIO_NUM_MINIOS}
# define the number of partitions each MINIO may be using
MINIO_NUM_PARTITIONS=${MINIO_NUM_PARTITIONS}
# optionally activate the host data folder for each partition (must be /data/diskX/minio on each node where X is the disk number if there is more than one disk per node)
MINIO_HOST_DATA_FOLDER=${MINIO_HOST_DATA_FOLDER}
STORAGE_DOMAIN=${STORAGE_DOMAIN}

0 comments on commit cd22e09

Please sign in to comment.