Skip to main content

Custom stacks

If you want to use one of the following stacks, check first our step-by-step customization guide:

*MPA stands for Multiple Page Application.

caution

The CodeNOW team has extensively tested the build and deployment process for its predefined scaffolders. By defining your stacks' build and deployment, you become responsible for troubleshooting your custom configuration.

CodeNOW uses Dockerfiles to package application components into Docker images and Helm charts to deploy these components to a Kubernetes cluster. When you are using the predefined stack scaffolders to start coding a component (e.g., Java/Maven/Spring Boot), CodeNOW generates automatically the relevant Dockerfile and Helm charts. You can focus on implementing functional requirements.

You can tell CodeNOW how to build and deploy application components that feature arbitrary stacks of your choice by providing your own Dockerfiles and Helm charts. This serves the following use cases:

  • Your custom stack shares common parts with what is available in CodeNOW by default (e.g., you only want to change the Java language version in the Java/Maven/Spring Boot scaffolder). Create components with the relevant CodeNOW scaffolder; expose the component's default Dockerfile and Helm charts in the component's Git repository; edit those to add the missing configuration for your custom stack. See Edit a component's default Dockerfile and Helm chart.
  • Your custom stack can already be built from an existing Dockerfile. Create components with the Helm 2 Generic scaffolder; configure the deployment descriptor to be the Docker image you want to deploy. Example: you want to deploy an HTTP server, and you do not want to write your own HTTP server; you instead deploy a premade HTTP server container image by configuring the Helm charts. See Create component with custom Helm chart.
  • Your custom stack cannot reuse or must customize existing Dockerfiles. Use the Docker Generic scaffolder when creating components to provide your own Dockerfile and Helm charts. See Create component with custom Dockerfile and Helm chart.

You can then create deployment configurations as usual. For more information on Helm's configuration files, see Helm's Value files documentation article. CodeNOW conveniently exposes a helm-values.yaml configuration file in the /codenow/config repository. Use this file to configure your Helm deployment differently in prod from in dev (cf. Helm charts override).

Edit a component's Dockerfile and Helm chart

You can edit the Dockerfile and Helm charts of scaffolded components with a few clicks.

Prerequisites

  • You have already created an application in CodeNOW.
  • That application has at least one application component whose packaging and deployment you want to customize.
  • That component was created with a standard stack (i.e., not with the Helm Generic nor Docker Generic scaffolders).

Steps

How to edit a component's default Dockerfile and Helm charts

Create component with custom Dockerfile and Helm chart

You can create a component and configure both its Dockerfile and Helm charts. CodeNOW will use your configuration to package your component and deploy it to the relevant Kubernetes cluster. Contrary to other stack scaffolders (e.g., Java/Spring Boot), the Docker Generic scaffolder will not contain a sample working application. The Docker Generic scaffolder thus gives you full freedom in selecting your stack, implementing your component, and configuring its deployment to the Kubernetes cluster.

Prerequisites

  • You already have created an application in CodeNOW.

Steps

How to create a new component and edit its Docker and Helm configuration

Create component with custom Helm chart

You may want to use your own Helm charts but yet reuse CodeNOW's default Dockerfile configuration. CodeNOW's Helm Generic scaffolder allows you to do that. Contrary to other scaffolders (e.g., Java/Spring Boot), the Helm Generic scaffolder does not contain a sample working application. It does contain a sample Helm chart (NGINX Helm chart by Bitnami) that you can modify. Helm charts can be complex. Starting from an existing Helm chart is a time saver.

Prerequisites

  • You already have created an application in CodeNOW.

Steps

How to create a new component and configure its Helm charts

Helm chart override

When you use the Helm Generic or Docker Generic scaffolder to create a component, CodeNOW will create a /codenow/config/helm-values.yaml file in the component's repository. The helm-values file, in Helm's terminology, is a values file that contains configuration parameters. For more information on Helm's values file, see the corresponding documentation.

Every time you create a deployment configuration, you will be able to update the helm-values file used for your target deployment environment. You can thus use different values for dev and prod deployments; or for different versions of the application under deployment. For more information on CodeNOW's deployment configuration files and their use cases, see Deployment configurations.

Prerequisites

You want to override the Helm chart's configuration of a component. You are in either one of the following cases:

Steps

How to use deployment configurations to override Helm configuration values

Tips

Let us know what your custom stack is. We may already be working on the corresponding scaffolders😉.

Helm charts

  • Configuring an application through Helm files is an advanced feature that requires good knowledge of Helm and the related ecosystem. Whenever possible, start from the Helm files used by an existing CodeNOW scaffolder.

Dockerfile

  • Search Docker Hub for reuse opportunities. The community has already made available Dockerfiles for commonly used technologies.

Ports

  • Beware that CodeNOW expects your application to run on port 80. When writing your Dockerfile and running your application, make sure to expose that port (like here, here, or here).

APIs

  • Your application must return an HTTP **200 OK** success status code in response to a GET request to its deployment URL (cf. NodeJS/Express API example).

Deployment configuration files

  • By default, all files in the /codenow/config folder are deployed as is to the /codenow/config repository of the deployed container.
  • This default behavior is implemented by Helm configuration files. You can change it by modifying the Helm files for your component (see Edit a component's Helm chart and Helm charts override).
  • You may customize the deployment folder for the configuration files by updating the Helm files.
  • Applications can access any deployment configuration files used in a CodeNOW deployment in the /codenow/config repository of the deployed container.

Runtime environment variables

  • CodeNOW creates automatically runtime environment variables for connection properties. Use the method provided by your custom stack to access environment variables at runtime (e.g., process.env in NodeJS scripts, os.environ in Python).

Troubleshooting