Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

86c0t11yc - Extract Minio from monitoring package into an independent package #330

Merged
merged 6 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ packages:
- database-postgres
- reprocess-mediator
- fhir-ig-importer
- datalake

profiles:
- name: cdr-dw
Expand All @@ -47,6 +48,7 @@ profiles:
- kafka-unbundler-consumer
- fhir-ig-importer
- reprocess-mediator
- datalake
envFiles:
- cdr-dw.env

Expand Down
82 changes: 82 additions & 0 deletions datalake/docker-compose.cluster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
version: "3.9"

services:
minio-01:
deploy:
placement:
constraints:
- "node.labels.name==${MINIO_01_PLACEMENT}"

drizzentic marked this conversation as resolved.
Show resolved Hide resolved
minio-02:
image: ${MINIO_IMAGE}
entrypoint: sh
command: -c 'mkdir -p /data1/loki /data2/loki && minio server --console-address ":9001" http://minio-0{1...4}/data{1...2}'
environment:
MINIO_ROOT_USER: ${MO_SECURITY_ADMIN_USER}
MINIO_ROOT_PASSWORD: ${MO_SECURITY_ADMIN_PASSWORD}
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ]
interval: 30s
timeout: 20s
retries: 3
hostname: minio-02
volumes:
- minio-02-data1:/data1
- minio-02-data2:/data2
deploy:
placement:
constraints:
- "node.labels.name==${MINIO_02_PLACEMENT}"
replicas: 1

drizzentic marked this conversation as resolved.
Show resolved Hide resolved
minio-03:
image: ${MINIO_IMAGE}
entrypoint: sh
command: -c 'mkdir -p /data1/loki /data2/loki && minio server --console-address ":9001" http://minio-0{1...4}/data{1...2}'
environment:
MINIO_ROOT_USER: ${MO_SECURITY_ADMIN_USER}
MINIO_ROOT_PASSWORD: ${MO_SECURITY_ADMIN_PASSWORD}
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ]
interval: 30s
timeout: 20s
retries: 3
hostname: minio-03
volumes:
- minio-03-data1:/data1
- minio-03-data2:/data2
deploy:
placement:
constraints:
- "node.labels.name==${MINIO_03_PLACEMENT}"
replicas: 1

minio-04:
image: ${MINIO_IMAGE}
entrypoint: sh
command: -c 'mkdir -p /data1/loki /data2/loki && minio server --console-address ":9001" http://minio-0{1...4}/data{1...2}'
environment:
MINIO_ROOT_USER: ${MO_SECURITY_ADMIN_USER}
MINIO_ROOT_PASSWORD: ${MO_SECURITY_ADMIN_PASSWORD}
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ]
interval: 30s
timeout: 20s
retries: 3
hostname: minio-04
volumes:
- minio-04-data1:/data1
- minio-04-data2:/data2
deploy:
placement:
constraints:
- "node.labels.name==${MINIO_04_PLACEMENT}"
replicas: 1

volumes:
minio-02-data1:
minio-02-data2:
minio-03-data1:
minio-03-data2:
minio-04-data1:
minio-04-data2:
drizzentic marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 12 additions & 0 deletions datalake/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.9'

services:
minio-01:
drizzentic marked this conversation as resolved.
Show resolved Hide resolved
ports:
- target: 9001
published: 9005
mode: host

- target: 9090
published: 9000
mode: host
drizzentic marked this conversation as resolved.
Show resolved Hide resolved
40 changes: 40 additions & 0 deletions datalake/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: '3.9'

services:
minio-01:
image: ${MINIO_IMAGE}
entrypoint: sh
command: -c 'mkdir -p /data1/loki /data2/loki && minio server --console-address ":9001" http://minio-0{1...${NUM_MINIO_SERVERS}}/data{1...2}'
drizzentic marked this conversation as resolved.
Show resolved Hide resolved
environment:
MINIO_ROOT_USER: ${MO_SECURITY_ADMIN_USER}
MINIO_ROOT_PASSWORD: ${MO_SECURITY_ADMIN_PASSWORD}
MINIO_BROWSER_REDIRECT_URL: ${MINIO_BROWSER_REDIRECT_URL}
MINIO_SERVER_URL: http://localhost:9000
drizzentic marked this conversation as resolved.
Show resolved Hide resolved
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ]
interval: 30s
timeout: 20s
retries: 3
hostname: minio-01
volumes:
- minio-01-data1:/data1
- minio-01-data2:/data2
deploy:
replicas: 1
labels:
- traefik.enable=true
- traefik.docker.network=reverse-proxy-traefik_public
- traefik.http.routers.minio.rule=${DOMAIN_NAME_HOST_TRAEFIK} && PathPrefix(`/minio`)
- traefik.http.services.minio.loadbalancer.server.port=9001
- traefik.http.middlewares.minio-stripprefix.stripprefix.prefixes=/minio
- traefik.http.routers.minio.middlewares=minio-stripprefix
networks:
public:
networks:
public:
name: minio_public
external: true

volumes:
minio-01-data1:
minio-01-data2:
21 changes: 21 additions & 0 deletions datalake/package-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"id": "datalake",
"name": "datalake",
"description": "Object storage for raw unstructured data, compatible with the s3 API",
"type": "infrastructure",
"version": "0.0.1",
"dependencies": [],
"environmentVariables": {
"NUM_MINIO_SERVERS": 1,
"MO_SECURITY_ADMIN_USER": "admin",
"MO_SECURITY_ADMIN_PASSWORD": "dev_password_only",
drizzentic marked this conversation as resolved.
Show resolved Hide resolved
"MO_RETENTION_TIME": "15d",
"MINIO_BROWSER_REDIRECT_URL": "http://localhost:9001",
"DOMAIN_NAME_HOST_TRAEFIK": "localhost",
drizzentic marked this conversation as resolved.
Show resolved Hide resolved
"MINIO_01_PLACEMENT": "minio-01",
"MINIO_02_PLACEMENT": "minio-02",
"MINIO_03_PLACEMENT": "minio-03",
"MINIO_04_PLACEMENT": "minio-04",
"MINIO_IMAGE": "minio/minio:RELEASE.2024-10-13T13-34-11Z.fips"
}
}
79 changes: 79 additions & 0 deletions datalake/swarm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash

declare ACTION=""
declare MODE=""
declare COMPOSE_FILE_PATH=""
declare UTILS_PATH=""
declare STACK="datalake"

function init_vars() {
ACTION=$1
MODE=$2

COMPOSE_FILE_PATH=$(
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
pwd -P
)

UTILS_PATH="${COMPOSE_FILE_PATH}/../utils"

readonly ACTION
readonly MODE
readonly COMPOSE_FILE_PATH
readonly UTILS_PATH
readonly STACK
}
drizzentic marked this conversation as resolved.
Show resolved Hide resolved

# shellcheck disable=SC1091
function import_sources() {
source "${UTILS_PATH}/docker-utils.sh"
source "${UTILS_PATH}/log.sh"
}
drizzentic marked this conversation as resolved.
Show resolved Hide resolved

function initialize_package() {
local package_dev_compose_filename=""
local minio_cluster_compose_filename=""
if [[ "${CLUSTERED_MODE}" == "true" ]]; then
minio_cluster_compose_filename="docker-compose.cluster.yml"
export NUM_MINIO_SERVERS=4
else
export NUM_MINIO_SERVERS=1
fi
if [[ "${MODE}" == "dev" ]]; then
log info "Running package in DEV mode"
package_dev_compose_filename="docker-compose.dev.yml"
else
log info "Running package in PROD mode"
fi

(
docker::deploy_service "$STACK" "${COMPOSE_FILE_PATH}" "docker-compose.yml" "$package_dev_compose_filename" "$minio_cluster_compose_filename"
) || {
log error "Failed to deploy package"
exit 1
}
}
drizzentic marked this conversation as resolved.
Show resolved Hide resolved

function destroy_package() {
docker::stack_destroy "$STACK"
}
drizzentic marked this conversation as resolved.
Show resolved Hide resolved

main() {
init_vars "$@"
import_sources

if [[ "${ACTION}" == "init" ]] || [[ "${ACTION}" == "up" ]]; then
log info "Running package in Single node mode"
initialize_package
elif [[ "${ACTION}" == "down" ]]; then
log info "Scaling down package"
docker::scale_services "$STACK" 0
elif [[ "${ACTION}" == "destroy" ]]; then
log info "Destroying package"
destroy_package
else
log error "Valid options are: init, up, down, or destroy"
fi
}

main "$@"
77 changes: 0 additions & 77 deletions monitoring/docker-compose.cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,83 +32,6 @@ services:
public:
default:

minio-01:
deploy:
placement:
constraints:
- "node.labels.name==${MINIO_01_PLACEMENT}"

minio-02:
image: ${MINIO_IMAGE}
entrypoint: sh
command: -c 'mkdir -p /data1/loki /data2/loki && minio server --console-address ":9001" http://minio-0{1...4}/data{1...2}'
environment:
MINIO_ROOT_USER: ${MO_SECURITY_ADMIN_USER}
MINIO_ROOT_PASSWORD: ${MO_SECURITY_ADMIN_PASSWORD}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
hostname: minio-02
volumes:
- minio-02-data1:/data1
- minio-02-data2:/data2
deploy:
placement:
constraints:
- "node.labels.name==${MINIO_02_PLACEMENT}"
replicas: 1

minio-03:
image: ${MINIO_IMAGE}
entrypoint: sh
command: -c 'mkdir -p /data1/loki /data2/loki && minio server --console-address ":9001" http://minio-0{1...4}/data{1...2}'
environment:
MINIO_ROOT_USER: ${MO_SECURITY_ADMIN_USER}
MINIO_ROOT_PASSWORD: ${MO_SECURITY_ADMIN_PASSWORD}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
hostname: minio-03
volumes:
- minio-03-data1:/data1
- minio-03-data2:/data2
deploy:
placement:
constraints:
- "node.labels.name==${MINIO_03_PLACEMENT}"
replicas: 1

minio-04:
image: ${MINIO_IMAGE}
entrypoint: sh
command: -c 'mkdir -p /data1/loki /data2/loki && minio server --console-address ":9001" http://minio-0{1...4}/data{1...2}'
environment:
MINIO_ROOT_USER: ${MO_SECURITY_ADMIN_USER}
MINIO_ROOT_PASSWORD: ${MO_SECURITY_ADMIN_PASSWORD}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
hostname: minio-04
volumes:
- minio-04-data1:/data1
- minio-04-data2:/data2
deploy:
placement:
constraints:
- "node.labels.name==${MINIO_04_PLACEMENT}"
replicas: 1

volumes:
prometheus_data_backup:
minio-02-data1:
minio-02-data2:
minio-03-data1:
minio-03-data2:
minio-04-data1:
minio-04-data2:
6 changes: 0 additions & 6 deletions monitoring/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,3 @@ services:
- target: 3100
published: 3100
mode: host

minio-01:
ports:
- target: 9001
published: 9005
mode: host
Loading
Loading