> ## Documentation Index
> Fetch the complete documentation index at: https://docs-v2.ard.co/llms.txt
> Use this file to discover all available pages before exploring further.

# AWS3 Nodes Certificate Deployment

> Build and deploy Docker images with updated SSL certificates for AWS3 MinIO services

AWS3 nodes require building a new nginx Docker image with updated SSL certificates and deploying via Docker stack.

<Note>
  Complete the [SSL Certificate Renewal](/infrastructure/ssl-renewal) process before building the Docker image.
</Note>

## Prerequisites

Before starting the deployment process, ensure you have:

* Access to the infrastructure repository with certificate files
* Docker installed locally
* SSH access to AWS3 node servers
* Certificate files from the renewal process

## Build Process

<Steps>
  <Step title="Prepare Certificate Files">
    Ensure you have the certificate files from the renewal process:

    * `certs/letsencrypt/devops.arabiaweather.com/fullchain.crt`
    * `certs/letsencrypt/devops.arabiaweather.com/privkey.pem`
  </Step>

  <Step title="Create Dockerfile">
    Create a Dockerfile to build the new nginx image with updated certificates:

    ```dockerfile theme={null}
    # Dockerfile to build new nginx image with updated SSL certificates

    FROM registry.docker.devops.arabiaweather.com/aws3-nginx:v2024.10.31-0

    # Copy SSL certificates from local certs directory
    # Using devops.arabiaweather.com certificates
    COPY certs/letsencrypt/devops.arabiaweather.com/fullchain.crt /ssl/chained.crt
    COPY certs/letsencrypt/devops.arabiaweather.com/privkey.pem /ssl/private.key

    # Ensure proper permissions on the private key
    RUN chmod 600 /ssl/private.key
    ```

    <Note>
      Update the base image tag (`v2024.10.31-0`) to the current version you're building from.
    </Note>
  </Step>

  <Step title="Build Docker Image">
    Build the new image locally:

    ```bash theme={null}
    docker build -t registry.docker.devops.arabiaweather.com/aws3-nginx:<new-tag> .
    ```

    Replace `<new-tag>` with an appropriate version tag (e.g., `v2025.01.15-0`).
  </Step>

  <Step title="Push Image to Registry">
    Push the built image to the Docker registry:

    ```bash theme={null}
    docker push registry.docker.devops.arabiaweather.com/aws3-nginx:<new-tag>
    ```
  </Step>

  <Step title="Deploy to AWS3 Nodes">
    SSH to the AWS3 node server (e.g., `node01`):

    ```bash theme={null}
    ssh root@node01
    ```

    Navigate to the service stack directory:

    ```bash theme={null}
    cd /data/service-stack
    ```

    Edit the `current.yml` file to update the image tag:

    ```bash theme={null}
    vi current.yml
    ```

    Update the image reference to use the new tag you built.
  </Step>

  <Step title="Deploy Docker Stack">
    Deploy the updated stack:

    ```bash theme={null}
    docker stack deploy -c current.yml --with-registry-auth minio
    ```

    This will update both services:

    * `minio_nginx` - Nginx service with updated certificates
    * `minio_server` - MinIO server service
  </Step>

  <Step title="Verify Deployment">
    Check the service status:

    ```bash theme={null}
    docker service ps minio_nginx
    docker service ps minio_server
    ```

    Verify that the services are running with the new image.
  </Step>
</Steps>

<Warning>
  The Docker stack deployment will cause a brief service interruption. Monitor the service status to ensure it restarts successfully.
</Warning>

## Verification Checklist

After deploying the Docker stack:

* [ ] Docker image built with new certificates
* [ ] Image pushed to registry successfully
* [ ] Docker stack deployed without errors
* [ ] minio\_nginx service running with new image
* [ ] minio\_server service running
* [ ] Services accessible with new certificates
