Heric Camargo pushed to branch main at Root / CLI / Mirror Monitor

Commits:

4 changed files:

Changes:

  • Containerfile
    ... ... @@ -15,14 +15,13 @@ COPY . .
    15 15
     # Compilando o binário da API
    
    16 16
     RUN go build -o mirror-monitor ./cmd/api
    
    17 17
     
    
    18
    +
    
    18 19
     # Etapa final:
    
    19
    -FROM debian:bookworm-slim
    
    20
    +FROM alpine:latest
    
    20 21
     
    
    21 22
     # Instalando o rsync e criando usuário não-root:
    
    22
    -RUN apt-get update && \
    
    23
    -    apt-get install -y rsync ca-certificates && \
    
    24
    -    apt-get clean && rm -rf /var/lib/apt/lists/* && \
    
    25
    -    useradd -r -u 1000 -s /bin/false appuser
    
    23
    +RUN apk add --no-cache rsync ca-certificates && \
    
    24
    +    adduser -D -u 1000 -s /sbin/nologin appuser
    
    26 25
     
    
    27 26
     # Copiando o binário compilado:
    
    28 27
     COPY --from=builder /app/mirror-monitor /usr/local/bin/mirror-monitor
    
    ... ... @@ -33,9 +32,5 @@ RUN chmod +x /usr/local/bin/mirror-monitor
    33 32
     # Mudando para usuário não-root
    
    34 33
     USER 1000
    
    35 34
     
    
    36
    -# Exponha a porta, se necessário: 
    
    37
    -#Atenção: se você mudar de porta, esse trecho do código deve-se mudar também!
    
    38
    -EXPOSE 8080
    
    39
    -
    
    40 35
     # Definindo o comando de entrada:
    
    41 36
     CMD ["mirror-monitor"]

  • deploy/k8s/deployment.yaml
    ... ... @@ -24,14 +24,14 @@ spec:
    24 24
             image: mirror-monitor-api:latest
    
    25 25
             imagePullPolicy: IfNotPresent
    
    26 26
             ports:
    
    27
    -        - containerPort: 8080
    
    27
    +        - containerPort: 80
    
    28 28
             env:
    
    29 29
             - name: RSYNC_URL
    
    30 30
               value: "rsync://sagres.c3sl.ufpr.br/"
    
    31 31
             - name: POLLING_INTERVAL_SECONDS
    
    32 32
               value: "300"
    
    33 33
             - name: PORT
    
    34
    -          value: "8080"
    
    34
    +          value: "80"
    
    35 35
             resources:
    
    36 36
               requests:
    
    37 37
                 memory: "64Mi"
    
    ... ... @@ -42,7 +42,7 @@ spec:
    42 42
             livenessProbe:
    
    43 43
               httpGet:
    
    44 44
                 path: /modules
    
    45
    -            port: 8080
    
    45
    +            port: 80
    
    46 46
               initialDelaySeconds: 30
    
    47 47
               periodSeconds: 30
    
    48 48
               timeoutSeconds: 5
    
    ... ... @@ -50,7 +50,7 @@ spec:
    50 50
             readinessProbe:
    
    51 51
               httpGet:
    
    52 52
                 path: /modules
    
    53
    -            port: 8080
    
    53
    +            port: 80
    
    54 54
               initialDelaySeconds: 5
    
    55 55
               periodSeconds: 10
    
    56 56
               timeoutSeconds: 3
    

  • deploy/k8s/ingress.yaml
    ... ... @@ -3,9 +3,6 @@ apiVersion: networking.k8s.io/v1
    3 3
     kind: Ingress
    
    4 4
     metadata:
    
    5 5
       name: mirror-monitor-api-ingress
    
    6
    -  annotations:
    
    7
    -    # Remove the rewrite rule since we want to preserve the API paths
    
    8
    -    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    
    9 6
     spec:
    
    10 7
       rules:
    
    11 8
       - host: mirror-monitor.local
    

  • deploy/k8s/service.yaml
    ... ... @@ -10,4 +10,4 @@ spec:
    10 10
       ports:
    
    11 11
         - name: http
    
    12 12
           port: 80
    
    13
    -      targetPort: 8080  # Match the containerPort in your Deployment
    13
    +      targetPort: 80  # Match the containerPort in your Deployment