Skip to content

Commit c92ac43

Browse files
committed
feat: adding API gateway
feat: adding API gateway
1 parent 66a2084 commit c92ac43

6 files changed

Lines changed: 22 additions & 38 deletions

File tree

.github/workflows/build-container.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
with:
9999
context: .
100100
platforms: linux/amd64,linux/arm64
101-
push: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feature/redirect-url' || (github.event.inputs.push_image == 'true') }}
101+
push: ${{ github.ref == 'refs/heads/main' || (github.event.inputs.push_image == 'true') }}
102102
tags: ${{ steps.meta.outputs.tags }}
103103
labels: ${{ steps.meta.outputs.labels }}
104104
build-args: |

Caddyfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,17 @@
2020
# Step 2: Initialize TX variable
2121
SecAction "id:2,phase:1,pass,nolog,setvar:tx.bucket_ops=0"
2222
23-
# Example rule: Block DELETE on /minio/admin
24-
SecRule REQUEST_URI "@beginsWith /minio/admin" "id:1001,phase:1,deny,status:403,msg:'MinIO Admin API Access Blocked'"
23+
# Allow WebSocket connections for MinIO console
24+
#SecRule REQUEST_URI "@beginsWith /ws/" "id:1000,phase:1,pass,msg:'Allow WebSocket connections'"
25+
SecRule REQUEST_HEADERS:Upgrade "@streq websocket" "id:1001,phase:1,pass,msg:'Allow WebSocket upgrade requests'"
26+
27+
# Example rule: Block DELETE on /minio/admin (except WebSocket connections)
28+
SecRule REQUEST_URI "@beginsWith /minio/admin" "id:1002,phase:1,deny,status:403,msg:'MinIO Admin API Access Blocked',chain"
29+
SecRule REQUEST_HEADERS:Upgrade "!@streq websocket"
2530
2631
# Rate limiting example
27-
SecRule REQUEST_METHOD "@rx ^(PUT|POST|DELETE)$" "id:1002,phase:1,pass,msg:'Bucket operation',setvar:tx.bucket_ops=+1,expirevar:tx.bucket_ops=60"
28-
SecRule TX:bucket_ops "@gt 50" "id:1003,phase:1,deny,status:429,msg:'Bucket operation rate limit exceeded'"
32+
SecRule REQUEST_METHOD "@rx ^(PUT|POST|DELETE)$" "id:1003,phase:1,pass,msg:'Bucket operation',setvar:tx.bucket_ops=+1,expirevar:tx.bucket_ops=60"
33+
SecRule TX:bucket_ops "@gt 50" "id:1004,phase:1,deny,status:429,msg:'Bucket operation rate limit exceeded'dd"
2934
`
3035
}
3136

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ RUN mkdir -p /etc/caddy /var/lib/caddy /var/log/caddy && \
2828
chown -R caddy:caddy /etc/caddy /var/lib/caddy /var/log/caddy
2929

3030
# Copy Caddyfile template
31-
# COPY Caddyfile /etc/caddy/Caddyfile
31+
COPY Caddyfile /etc/caddy/Caddyfile
3232

3333
# Install curl for health checks
3434
RUN apk add --no-cache curl

main.tf

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ resource "azurerm_subnet" "aci_subnet" {
2929
name = "aci-delegation"
3030

3131
service_delegation {
32-
name = "Microsoft.ContainerInstance/containerGroups"
33-
actions = ["Microsoft.Network/virtualNetworks/subnets/join/action"]
32+
name = "Microsoft.ContainerInstance/containerGroups"
33+
actions = [
34+
"Microsoft.Network/virtualNetworks/subnets/action"]
3435
}
3536
}
3637
}
@@ -274,8 +275,13 @@ resource "azurerm_container_group" "minio_aci_container_group" {
274275
environment_variables = {
275276
MINIO_ROOT_USER = var.minio_root_user
276277
MINIO_ROOT_PASSWORD = var.minio_root_password
277-
MINIO_BROWSER_REDIRECT_URL = "https://${azurerm_public_ip.agw_pip.fqdn}"
278+
MINIO_BROWSER_REDIRECT_URL = "https://testminio.westeurope.cloudapp.azure.com"
279+
MINIO_BROWSER = "on"
280+
MINIO_CONSOLE_WEBROOT = "/"
281+
MINIO_CONSOLE_ORIGINS = "http://localhost:9001,https://testminio.westeurope.cloudapp.azure.com"
282+
278283
}
284+
279285
volume {
280286
name = "minio-volume"
281287
mount_path = "/data"
@@ -316,10 +322,7 @@ resource "azurerm_container_group" "minio_aci_container_group" {
316322
port = 8081
317323
protocol = "TCP"
318324
}
319-
environment_variables = {
320-
MINIO_UI_BACKEND = "localhost:9001"
321-
MINIO_API_BACKEND = "localhost:9000"
322-
}
325+
323326
liveness_probe {
324327
http_get {
325328
path = "/health"

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ output "public_ip" {
2020

2121
output "mc_alias_command" {
2222
description = "MinIO client setup command"
23-
value = "mc alias set myminio https://${azurerm_container_group.minio_aci_container_group.fqdn}:8443 --insecure"
23+
value = "mc alias set myminio https://${azurerm_public_ip.agw_pip.fqdn}:8443 --insecure"
2424
}
2525

2626
output "storage_account_name" {

variables.tf

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,6 @@ variable "minio_root_password" {
3131
}
3232
}
3333

34-
variable "cert_password" {
35-
type = string
36-
sensitive = true
37-
nullable = false
38-
description = "Password for the SSL certificate"
39-
validation {
40-
condition = length(var.cert_password) > 0
41-
error_message = "Certificate password cannot be empty."
42-
}
43-
}
44-
4534
variable "storage_share_size" {
4635
default = 100
4736
type = number
@@ -68,19 +57,6 @@ variable "public_url_domain_name" {
6857
description = "Domain name for the public URL (e.g., 'miniotest' creates 'miniotest.westeurope.azurecontainer.io')"
6958
}
7059

71-
# Container configurations
72-
variable "ssl_cert_file" {
73-
type = string
74-
default = "server.crt"
75-
description = "Name of the SSL certificate file"
76-
}
77-
78-
variable "ssl_key_file" {
79-
type = string
80-
default = "server.key"
81-
description = "Name of the SSL private key file"
82-
}
83-
8460
variable "minio_image" {
8561
type = string
8662
default = "quay.io/minio/minio:RELEASE.2025-04-22T22-12-26Z"

0 commit comments

Comments
 (0)