Skip to main content

Project Setup Structure

In the getting started section, we have already taken a look at the default setup of an NS application using the project setup expanders. In this section we take a deeper look at directories containing expanded files and some expanded files themselves to get an idea of where to look for certain files.

docker

The docker directory contains files related to docker many of which are expanded by the project-expanders. Each environment defined will expand a docker-compose file with the various services that are part of that environment.

Artifacts created by the softwareProject (this is explained in more detail later when describing the model) are required to have a directory within the docker directory. The name of the directory is based on the name of the artifact. Below is an example of the docker directory with two artifacts with the names backendImage and gatewayImage. Each folder of an artifact needs a Dockerfile. Other files necessary for building the image should be put in the folder as well.

docker/
├── backend-image/
│ ├── ...
│ ├── Dockerfile
│ └── sql/
│ ├── BASE/
│ │ ├── V1.1__init_database.sql
│ │ └── V1.2__app_init_data.sql
│ └── MIGRATIONS/
│ ├── 1.1.0/
│ ├── 1.2.0/
│ └── NEXT/
│ └── V2.5__migration-name.sql
├── gateway-image/
│ ├── ...
│ └── Dockerfile
└── docker-compose.default.yaml
...

SQL Migrations Setup

In the example above, the backendImage artifact is of the jee-application-image type. It's sql directory follows a specific setup where in the BASE directory are the sql files that represent the baseline of the database. The MIGRATIONS directory contains the sql migrations per release. The NEXT directory contains the sql migrations for the next release.

This SQL Migrations Setup is optional and not required, although certain options depend on it.

Option
project.artifact.moveSqlOnRelease Artifact

Move the sql files of this artifact on release.

Using the example above, when creating a 1.3.0 release, the V2.5__migration-name.sql file will be moved from the NEXT directory to a new 1.3.0 directory.

Prerequisite

This option requires the SQL Migration Setup to be used.

<options>
<project.artifact.moveSqlOnRelease/>
</options>

scripts

scripts/
├── ...
├── expand.nss
├── harvest.nss
├── rejuvenate_nsproject_setup.nss
├── release.nss
├── set_version.nss
├── start_default_services.nss
└── stop_default_services.nss

These scripts are utility scripts. Depending on the model of your project setup you will have more or less scripts than depicted above.

Option
project.gitFlow.disable Project

Indicate that the project does not follow the Git Flow development flow. Has an effect on the expanded scripts and Jenkinsfile.

Warning

Using Git Flow is highly recommended. Only use this option if absolutely necessary, otherwise follow the best practices of Git Flow.

<options>
<project.gitFlow.disable/>
</options>

Custom scripts

It is perfectly valid to add custom scripts next to the expanded scripts.

Best practice

It is a best practice to keep NSScript scripts self-contained (no file imports).

root

Some files are expanded at the root level.

  • .cleanExpand
  • Jenkinsfile