Skip to main content

NSX Application Project

Creates a new NS application project, provisioned with everything needed for NSX infrastructure.

  • Expansion resource: net.democritus.initializer:nsx-application-initializer@4.32.0
  • Command: nsinit application / nsinit app
  • Example project: Bitbucket

Overview

The NSX application project initializer is an initializer bundle which is used to create new NS application projects with additional integrations for tooling and infrastructure used at NSX.

This initializer can provision a very comprehensive setup for a new application project containing the following:

  • An application model with the base-components, as well as an empty component to add elements to. This includes expansion settings for the default stack and sql-expanders, with an initial data xml file for the sql-expanders with all data needed to run the application from the database. The initial data also contains profiles for admin and user users, where admin profile users have full access to the entire application and user profile users have full access only to the new component added, not the base-components. One user admin is also created with a randomly generated strong password, which is stored in the .credentials file temporarily.
  • A Maven project to expand the application.
  • Some typical project files are generated, such as README.md and CHANGELOG.md as stub files to be filled out by the user. Also an EditorConfig file with a basic setup for clean editing of the files in the repository is generated.
  • A complete Docker setup with support for Flyway to import the initial data script generated by the sql-expanders. This also includes a docker-compose file with a PostgreSQL database and an additional extension docker-compose file for local deployment.
  • Support for the Jenkins CI/CD platform with a Jenkinsfile that performs model-validation, expanding and building. It also integrates with SonarQube for automated code quality tracking.
  • Integration with Amazon Web Services (AWS) through Terraform deployment scripts, providing a comprehensive infrastructure with a PostgreSQL database running in the Relational Database Service (RDS) and the application deployed with auto-scaling and load-balancing on the Fargate Serverless Compute Engine, managed through the Elastic Container Service (ECS).
  • Development/demo scripts that offer rejuvenate operations (harvest/expand), building and deploying locally with Docker or remotely on AWS.
  • Initialization of a local git repository for the project, with an initial commit containing everything that should be committed to the repository.

Generated files

  • applications directory with the Application/ApplicationInstance model with the name of the root directory as their name.
  • components directory with the component model with dependencies on the base components and name example.
  • scripts directory with demo/development scripts when --scripts is used.
  • terraform/aws directory with AWS (Amazon Web Services) deployment scripts for Terraform when --aws is used.
  • conf/expansionSettings.xml file with the expansion settings for the project, such as the nsx-default-stack expansion resource which contains all expanders needed to generate a JEE application.
  • pom-expansion.xml file to expand the project.
  • .credentials file is a temporary file containing the generated user credentials for the application in JSON format. This should never be committed to the git repository.
  • .gitignore file to ignore any known files that should not be committed to a Git repository.
  • .editorconfig file with some basic standard rules for formatting code in files.
  • README.md file to provide some basic information about the project.
  • CHANGELOG.md file to document changes to the project.
  • Jenkinsfile file with basic configuration to expand and build the project in Jenkins.
  • A local git repository with a first commit containing all generated files.

Parameters

For an overview, run nsinit app -h.

OptionDescription
-h,
--help
Returns the help with an overview of all commands.
--app,
--application
Used to specify a name for the application, rather than using the output directory name as the default.
--appinst,
--application-instance
Used to specify a name for the application instance, rather than using the application name as the default.
--[no-]awsGenerate a Terraform project for deployment to AWS (Amazon Web Services). Default: false
--comp,
--component
Used to specify the name for the main component of the application.
--groupid,
--group-id
The groupId for the pom-expansion.xml Maven project file.
--docker-imageThe name for the Docker image that is generated for the application in Jenkins and the development scripts.
--[no-]base-componentsGenerate the project with dependencies on the base components. Default: true
--[no-]jenkinsGenerate a Jenkinsfile. Default: true
--[no-]sonarAdd SonarQube integration to the generated project. Implied no Jenkinsfile is generated. Default: true
--[no-]model-validationAdd model validation integration to the generated project. Implied no Jenkinsfile is generated. Default: true.
--[no-]gitInitialize a local git repository and generate a .gitignore file. Default: true
--[no-]scriptsGenerate demo/development scripts in the scripts folder. Default: false
--[no-]experimentalGenerate experimental features. Default: false
-DAllows you to set any argument or flag defined for the project type, even those that are implicit. For an argument, the key should be prefixed by arg. and for a flag with flag.. E.g.: -Darg.applicationInstance=test-app
-o,
--output
The directory where the project should be generated, rather than the current directory.
-y,
--yes-to-all
Disables the interactive mode and accepts defaults for all settings that were not specified as arguments.
-f,
--force
Forces the creation of the project, even when the output directory is not empty.

Example

nsinit app -y -o the-best-application --app bestApp --appinst bestAppInst --comp myAppComponent --groupid com.example

Resulting project:

the-best-application/
├── applications
│   └── bestApp
│   ├── harvest
│   │   └── pom.xml.harvest
│   ├── init-data
│   │   └── bestApp-data.xml
│   └── model
│   ├── bestApp.xml
│   └── instances
│   └── bestappinst.xml
├── CHANGELOG.md
├── components
│   └── myAppComponent
│   ├── ext
│   │   └── logic-ext
│   │   └── common
│   │   └── resources
│   │   └── account.ns.properties
│   └── model
│   └── myAppComponent.xml
├── conf
│   ├── expansionSettings.xml
│   └── validation.xml
├── .credentials
├── docker
│   ├── app-conf
│   │   └── .gitkeep
│   ├── conf
│   │   └── tomee.xml
│   ├── deploy
│   │   └── .gitkeep
│   ├── docker-compose.local.yml
│   ├── docker-compose.yml
│   ├── Dockerfile
│   ├── .env
│   ├── .gitignore
│   ├── lib
│   │   └── pom-extra-libraries.xml
│   ├── prepare.sh
│   └── sql
│   └── .gitkeep
├── .editorconfig
├── .git
├── .gitignore
├── Jenkinsfile
├── package.json
├── pom.xml
├── README.md
├── renovate.json
├── scripts
│   ├── rejuvenate_deploy_local.nss
│   ├── rejuvenate_docker.nss
│   ├── rejuvenate.nss
│   ├── release.nss
│   ├── _set_env.nss
│   ├── _setup_docker.nss
│   ├── _set_version.nss
│   ├── set_version.nss
│   ├── start_docker.nss
│   └── stop_docker.nss
└── settings
├── businessLogicSettings
│   └── tomee_postgres_hibernate.xml
├── globalOptionSettings
│   └── 3_0_modern.xml
├── presentationSettings
│   └── 3_1_future.xml
└── technicalInfrastructure
└── java_21.xml

AWS deployment

To use the AWS deployment scripts generated with the --aws option, there are two prerequisites to be installed:

  • AWS CLI v2
    • Windows:
      • Installer: Download
      • On commandline: C:\> msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi
      • Chocolatey: choco install awscli -y
    • Linux:
      • Installer:
        curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
        unzip awscliv2.zip
        sudo ./aws/install
      • PIP: pip install awscli --upgrade
    • MacOS:
  • Terraform
    • Windows:
      • Installer: Download
      • Chocolatey: choco install terraform -y
    • Linux:
      • Installer: Download
      • Aptitude:
        curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
        sudo apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
        sudo apt install terraform
      • YUM:
        sudo yum install -y yum-utils
        sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/$release/hashicorp.repo
        sudo yum install terraform
    • MacOS: