Skip to content

#n 11#2

Merged
emirenesakalin merged 16 commits intodevfrom
#n-11
Sep 28, 2025
Merged

#n 11#2
emirenesakalin merged 16 commits intodevfrom
#n-11

Conversation

@emirenesakalin
Copy link
Contributor

No description provided.

emirenesakalin and others added 6 commits September 19, 2025 17:42
Adds Dockerfile and docker-compose.yml for containerizing the application.
This allows for easier deployment and environment consistency.
Also adds .dockerignore to exclude unnecessary files during image building.
Introduces a frontend application built with React and Vite to the Docker Compose setup.

This change adds a new Dockerfile with multi-stage builds for frontend development and production, optimized for performance and deployment.
It also updates the docker-compose.yml file to include the frontend service, which depends on the backend service.
Database added to compose.yml and mapbox access token is now secret with postgres user and password
Action versions are updated
Caching strategy is added
Adds base Kubernetes manifests for the backend and frontend applications.

This includes deployment and service definitions, as well as kustomization files
for base, development, and staging environments. The deployments use secrets
for sensitive configuration data and define image names that can be
overridden in the overlays.
Implements CD workflows for the dev and staging environments.

This change automates the deployment process to Kubernetes clusters upon pushing to the `dev` and `main` branches respectively.

It configures Kustomize, sets up kubeconfig, creates secrets, and deploys the application with appropriate image tags.

It also splits the CI workflow to build and push frontend and backend
Docker images separately, specifying target runtime environments in Dockerfile.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR sets up Docker containerization and Kubernetes deployments with CI/CD pipelines for the Navio application. It also moves the Mapbox access token from hardcoded values to environment variables for security.

  • Adds Docker containerization for both frontend and backend services
  • Creates Kubernetes manifests with dev and staging overlay environments
  • Implements CI/CD pipelines for automated builds and deployments
  • Removes hardcoded Mapbox API key and uses environment variables

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
kubernetes/overlays/staging/namespace.yaml Defines staging namespace for Kubernetes deployment
kubernetes/overlays/staging/kustomization.yaml Kustomize configuration for staging environment
kubernetes/overlays/dev/namespace.yaml Defines dev namespace for Kubernetes deployment
kubernetes/overlays/dev/kustomization.yaml Kustomize configuration for dev environment
kubernetes/base/kustomization.yaml Base Kustomize configuration
kubernetes/base/deployment.yaml Kubernetes deployment and service definitions
frontend/src/components/WorldMap.tsx Removes hardcoded Mapbox API key
frontend/package.json Adds serve dependency for production deployment
docker-compose.yml Docker Compose setup for local development
Dockerfile Multi-stage Docker build for frontend and backend
.github/workflows/ci.yml Enhanced CI pipeline with Docker image builds
.github/workflows/cd.yml CD pipeline for dev and staging deployments
.env.example Environment variable template
.dockerignore Docker build exclusions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('/package-lock.json') }}
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache key path is incorrect. It should be '**/package-lock.json' to match the package-lock.json files in the repository structure, not /package-lock.json which looks for the file at the root.

Suggested change
key: ${{ runner.os }}-node-${{ hashFiles('/package-lock.json') }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

Copilot uses AI. Check for mistakes.
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('/*.csproj') }}
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache key path is incorrect. It should be '**/*.csproj' to match all .csproj files in the repository structure, not '/*.csproj' which only looks in the root directory.

Suggested change
key: ${{ runner.os }}-nuget-${{ hashFiles('/*.csproj') }}
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +6
bases:
- ../../base
namespace: navio-staging
resources:
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bases field is deprecated in Kustomize. Use resources instead to reference the base configuration.

Suggested change
bases:
- ../../base
namespace: navio-staging
resources:
namespace: navio-staging
resources:
- ../../base

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +6
bases:
- ../../base
namespace: navio-dev
resources:
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bases field is deprecated in Kustomize. Use resources instead to reference the base configuration.

Suggested change
bases:
- ../../base
namespace: navio-dev
resources:
namespace: navio-dev
resources:
- ../../base

Copilot uses AI. Check for mistakes.
Updates cache keys in CI workflow to include subdirectories.

Corrects kustomization files by relocating the base resource inclusion, ensuring resources from the base are correctly included.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +8 to +9
- name: navio-backend-image
- name: navio-frontend-image
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The images configuration is incomplete. Each image entry needs a 'newTag' field to specify the image tag that Kustomize should use when deploying.

Suggested change
- name: navio-backend-image
- name: navio-frontend-image
- name: navio-backend-image
newTag: latest
- name: navio-frontend-image
newTag: latest

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +9
- name: navio-backend-image
- name: navio-frontend-image
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The images configuration is incomplete. Each image entry needs a 'newTag' field to specify the image tag that Kustomize should use when deploying.

Suggested change
- name: navio-backend-image
- name: navio-frontend-image
- name: navio-backend-image
newTag: latest
- name: navio-frontend-image
newTag: latest

Copilot uses AI. Check for mistakes.
file: ./Dockerfile
target: backend-runtime
push: true
tags: ghcr.io/emirefe/navio-backend:${{ github.ref_name }}-${{ github.sha }}
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent repository owner reference. Line 121 uses 'emirefe' directly while line 132 uses '${{ github.repository_owner }}'. Use the variable for consistency.

Suggested change
tags: ghcr.io/emirefe/navio-backend:${{ github.ref_name }}-${{ github.sha }}
tags: ghcr.io/${{ github.repository_owner }}/navio-backend:${{ github.ref_name }}-${{ github.sha }}

Copilot uses AI. Check for mistakes.

- name: Deploy to Kubernetes
run: |
BACKEND_IMAGE_TAG="ghcr.io/${{ github.repository_owner }}/navio-backend:${{ github.ref_name }}-${{ github.sha }}"
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The image tag construction doesn't match the CI workflow. The CI workflow pushes 'ghcr.io/emirefe/navio-backend' but this deployment expects 'ghcr.io/${{ github.repository_owner }}/navio-backend', creating a mismatch that will cause deployment failures.

Copilot uses AI. Check for mistakes.
Extends CI/CD pipeline to include 'fix' branches, enabling automated builds, docker image creation, and deployment to the development environment.

Moves deployment steps from a separate workflow into the main CI/CD workflow to streamline the process and ensure consistency.
EgeGermen and others added 8 commits September 20, 2025 21:44
Configures a development environment overlay for Kubernetes.

This includes setting up namespaces, image tags, and image pull policies.
It also adds .exe files to the .gitignore.
Specifies the parent directory as the location for environment variables.

This ensures that environment variables are loaded from the correct location relative to the frontend application.
Updates the frontend deployment to inject the Mapbox access key
from a Kubernetes secret, and removes the envDir config from the
frontend vite config. Updates the frontend image tag in the
development overlay.
Refactors the frontend deployment to use Nginx
as a reverse proxy. This simplifies the Dockerfile
and improves performance by serving static assets
directly and proxying API requests to the backend.

Removes the dedicated frontend-runtime stage.
Updates the docker-compose file to use a dedicated frontend service
based on nginx, rather than a single monolithic nginx service.

The frontend service is configured to expose port 80 and to receive
the Mapbox access key as an environment variable.

The Dockerfile is updated to include a separate frontend-nginx stage and
to copy the built frontend application into the nginx webserver.
The nginx configuration is set to serve static content.
Moves to a single deployment file for easier management.
Removes Kustomize base and overlays in favor of a simpler structure.
Updates Nginx configuration to reflect backend service name change.
Adds environment variables to the deployment using a configMap.
@emirenesakalin emirenesakalin merged commit 0a83f36 into dev Sep 28, 2025
5 checks passed
@emirenesakalin emirenesakalin deleted the #n-11 branch September 28, 2025 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants