Giter VIP home page Giter VIP logo

nextjs-devsecops's Introduction

NextJs Repo + Pipelines

NextJs has been all the hype as of late - Most folks set up environment-specific pipelines as well as store K8s Configuration under parent environment folders, which leads to bloated code processes that do not conform to best practices.

Simplifying the process

A repository, Helm Charts, Kubernetes cluster and multi-branch pipelines are an excellent way to tackle this problem statement - allowing you to work with a minified approach to fast-paced deployment strategies.

Stack Used

  • Jenkins: This OSS CI/CD tool helps reducing dependence on a cloud provider's Build and Release tools (eg: AWS CodeDeploy, Azure DevOps), and lets you migrate providers if needed with very less overhead work required.
  • Node: (LTS), NextJS
  • Docker: Image Build tool.
  • Helm: This templating tool helps managing releases, and negates the need for Environment-specific folders with Kubernetes configuration.
  • A Kubernetes cluster: Feel free to use kind/minikube to provision one locally, or use provision one on the respective cloud provider.

Setup Process

  • Cluster NA/NS Creation
    • Setup Namespaces and Service accounts for your environments.
    • Attach correct RBAC policies to the service accounts
  • EFK setup (Logging and Monitoring)
    • Create n Persistent Volumes for Elasticsearch to use as part of it's stateful volume claim.
    • Apply the files under ./pipelines/Kubernetes/Normal/EFK/elastic to set up ES.
    • Setup fluentd as a daemonset to forward container logs to elasticsearch.
    • Install Kibana to visualize logs - hit 'Discover' and add logstash* as an index.
  • Ingress Nginx
    • Apply ./pipelines/Kubernetes/Normal/Ingress-Nginx/deploy-tls-termination.yaml if you're using AWS, otherwise install it via helm and make changes for your provider - you need to expose the service using an external loadbalancer.
    • Create ExternalNames for your frontend services.
    • Apply the ingress to take care of DNS/Routing to services in different namespaces.
  • Jenkins
    • Create a multibranch pipeline with the repository details, and include the path to the JENKINSFILE.
    • Setup any other credentials that might be needed (eg: Artifactory/Dockerhub/ECR etc)
    • Wait for the branches to be registered post-scan, and trigger a build on the required branch.

To-Do

  • Pre and Post Deployment Checks
  • Docker-compose file with mounts for easy local development (supports hot reloads)
  • Include Dynamic Sonarqube runs/Quality Gate checks
  • Impliment a SAST tool to scan Static code
  • Use a SCA tool to scan OSS dependencies
  • Include Image scanning for vulnerabilities
  • Impliment a DAST tool to run on the deployed Front-end.

nextjs-devsecops's People

Contributors

pyronewbic avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.