-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #211 from nimblehq/release/2.0.0
- Loading branch information
Showing
155 changed files
with
3,270 additions
and
1,678 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
To add a new addon or module, follow these steps: | ||
|
||
1. Navigate to the `./src/generators` folder in the project directory. | ||
2. Create a new folder depending on the type of the addon/module you want to add: | ||
- For addons, create a new folder in the `./src/generators/addons` directory. | ||
- For the core Terraform files, create a new folder/file in the `./src/generators/terraform` directory. | ||
|
||
Inside the newly created addon/module folder, you can include the code required to generate the templates. | ||
|
||
3. Navigate to the `./templates` folder at the same level as the `src` folder in the project directory. | ||
4. Add the template folders/files for the addon/module that you are adding inside the corresponding folder in the `./templates` directory. | ||
|
||
> **Note**!\ | ||
> Before adding a new addon/module, it is recommended to check the existing ones for reference. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
To add a new CLI command, create a new folder in the `src/commands` and add the `index.ts` file. | ||
The command documentation can be found [here](https://oclif.io/docs/commands). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
This project uses TypeScript and [OCLIF](https://oclif.io/) to build the CLI, Jest for testing, and ESLint for code formatting and linting. | ||
|
||
## Project structure | ||
|
||
The project has the following main files and folders: | ||
|
||
```bash | ||
├── .github | ||
│ ├── workflows # Contains the Github Action workflows | ||
│ └── wiki # Houses the content for the Wiki of this project. The Wiki will be published automatically upon merging to the `develop` branch. | ||
├── bin # the executable file for the CLI | ||
│ ├── dev # the executable file for the CLI in development mode | ||
│ └── run # the executable file for the CLI in production mode | ||
├── templates # the templates files for the project | ||
│ ├── addons # the templates files for common addons e.g. version control, CI/CD, etc. | ||
│ │ ├── aws # the templates files for AWS modules | ||
│ │ └── versionControl # the templates files for version control | ||
│ └── terraform # the templates folders | ||
│ ├── core # the templates files for the core folder | ||
│ └── shared # the templates files for the shared folder | ||
├── src # the source code of the CLI | ||
│ ├── commands # the commands of the CLI | ||
│ │ ├── generate | ||
│ │ └── installAddon | ||
│ ├── helpers # the helper functions of the CLI | ||
│ │ ├── childProcess.ts | ||
│ │ ├── file.ts | ||
│ │ └── terraform.ts | ||
│ ├── hooks # the hooks of the CLI | ||
│ │ └── postProcess.ts | ||
│ ├── index.ts # the entry point of the CLI | ||
│ └── generators # the code to generate the templates | ||
│ ├── addons # the code to generate the common addons e.g. version control, CI/CD, AWS, etc. | ||
│ └── terraform # the code to generate the main Terraform files e.g. `main.tf`, `variables.tf`, etc. | ||
└── test # the test helpers and configurations | ||
└── matchers # the custom matchers for Jest | ||
├── file.ts | ||
├── index.d.ts | ||
└── index.ts | ||
``` | ||
|
||
> **Note**!\ | ||
> The `./templates` and the `./src/generators` folder are the two main folders that are used to generate the project files | ||
- The `./templates` folder contains the addon's files and folders ready to be directly copy-pasted into the generated project if the related addon has been selected. These files serve as a starting point or "template" for the specific addon. | ||
|
||
- On the other hand, the `./src/generators` folder houses the logic for determining which files need to be copied from this folder into the core project files. It includes instructions on what files should be formed based on the type of addon/module being added (common addons, AWS modules, or standard files). | ||
|
||
In summary, while the `./templates` folder provides the files and folders needed for the addon, the `./src/generators` folder handles the dynamic copying and integration of those files within the core project structure. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
First off, thank you for considering contributing to this project. It's people like you that make this project such a great tool. We appreciate your help! | ||
|
||
The following is a set of guidelines for contributing to this project. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request. | ||
|
||
## Issues and feature requests | ||
|
||
If you encounter any issues or have feature requests, please create an issue on the [GitHub issues](https://github.com/nimblehq/infrastructure-templates/issues) page. Please ensure that a similar issue has not already been created before submitting. | ||
|
||
## Development | ||
|
||
- Please refer to the [[Architecture Overview]] to understand the project's architecture first. | ||
- Then, go through the guidelines under the "Contributing" menu on the right sidebar to set up the Development Environment, understand the way to create new modules, run tests, and publish a new release to NPM. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
## Usage | ||
|
||
The CLI can be installed globally or run directly with `npx`: | ||
|
||
```bash | ||
npm install -g @nimblehq/infra-template | ||
nimble-infra generate {project-name} | ||
|
||
# or | ||
|
||
npx @nimblehq/infra-template generate {project-name} | ||
``` | ||
|
||
The CLI supports the following commands: | ||
- `generate` - to generate a new Terraform project: | ||
|
||
```bash | ||
nimble-infra generate {project-name} | ||
``` | ||
|
||
- `install` - to install a new addon/module to an existing Terraform project: | ||
|
||
```bash | ||
nimble-infra install {addon-name} --project {project-name} | ||
``` | ||
|
||
### Reference as a template | ||
|
||
> **Note**!\ | ||
> This template can be used for reference to add an addon/module to an existing Terraform project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
An infrastructure template for web applications powered by Terraform. | ||
|
||
**Supported cloud:** AWS. We are looking for contributions to implement support for GCP, Heroku, and Azure! | ||
|
||
**Supported flavors:** | ||
- A `Blank` flavor that generates a blank Terraform project. | ||
- The `Complete` flavor generates the following infrastructure: | ||
|
||
![Diagram of the Complete Infrastructure](assets/images/architecture/diagram-complete.svg?raw=true) | ||
[Editable on Lucid Chart](https://lucid.app/lucidchart/803dcda3-e444-4d4f-b88b-432175a91bc5/edit?page=0_0&invitationId=inv_1bd4718b-629c-4991-a22f-134b744b0b36#) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
The following infrastructure diagram was created using Lucidchart. In case further modifications are needed, such as when new modules are added, please duplicate the original diagram found [here](<https://lucid.app/lucidchart/803dcda3-e444-4d4f-b88b-432175a91bc5/edit?viewport_loc=-693%2C65%2C3989%2C1788%2C0_0&invitationId=inv_1bd4718b-629c-4991-a22f-134b744b0b36>) and modify as necessary. | ||
|
||
![Diagram of the Complete Infrastructure](assets/images/architecture/diagram-complete.svg?raw=true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
- This project will be published to NPM automatically when a new release is created in GitHub. Therefore, the package version in `package.json` should be updated before creating a new release. | ||
|
||
- The release should be created in the `main` branch and created with the following format: `{major}.{minor}.{patch}`, e.g. `1.0.0`. | ||
|
||
## Manual publishing | ||
|
||
- To publish the project manually, run the following command: | ||
|
||
```bash | ||
npm run publish | ||
``` | ||
|
||
> **IMPORTANT**!\ | ||
> NPM credentials are required to publish the project. Ensure that the version in `package.json` is updated. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
## Dependencies and Prerequisites | ||
|
||
- [Node.js](https://nodejs.org/en/download/) 12.x or higher - 18.x LTS is recommended | ||
- NPM is preferred to use with this project | ||
|
||
## Install dependencies | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
## Run the CLI locally | ||
|
||
The CLI supports the following commands: | ||
|
||
1. `generate` - to generate a new Terraform project | ||
|
||
```bash | ||
bin/dev generate {project-name} | ||
``` | ||
|
||
2. `install` - to install a new addon/module to an existing Terraform project | ||
|
||
```bash | ||
bin/dev install {addon-name} --project {project-name} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
## Run tests | ||
|
||
```bash | ||
npm run test | ||
``` | ||
|
||
## Run and fix linting | ||
|
||
```bash | ||
npm run lint // to check linting | ||
|
||
npm run lint:fix // to fix linting | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Follow these steps to copy and include supporting modules from the generator: | ||
|
||
1. Open the `./src/generators` directory in your project. | ||
2. Explore the code and structure of the existing addon or module that you want to reference. | ||
|
||
Inside each addon or module folder, you will find the necessary files and directories needed for that specific functionality. | ||
|
||
3. Once you have identified the supporting modules or files you want to include in your own project, mirror the folder structure and file naming conventions of the existing addon or module that you are referencing. | ||
|
||
4. Copy and paste the relevant files from the existing addon or module into your new addon/module folder. | ||
|
||
> **Note**!\ | ||
> Make sure to update any necessary configuration or code inside the copied files to fit your specific requirements. | ||
By following this process, you can use the existing templates as a reference to create your own addons or modules based on the provided structure and functionality. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Developed by [Nimble](https://nimblehq.co/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## Table of Contents | ||
|
||
- [[Home]] | ||
- [[Getting Started]] | ||
|
||
## Architecture | ||
- [[Architecture Overview]] | ||
|
||
## Contributing | ||
- [[Contributing guidelines]] | ||
- [[Set up the Development Environment]] | ||
- [[Add a new CLI command | Add new command]] | ||
- [[Add New Addon or Module | Add new addon module]] | ||
- [[Using The Generator As Reference]] | ||
- [[Testing]] | ||
- [[Modify the Infrastructure Diagram | Modify infra diagram]] | ||
- [[Publishing]] |
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Publish Github Wiki | ||
|
||
on: | ||
push: | ||
paths: | ||
- .github/wiki/** | ||
branches: | ||
- develop | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish: | ||
name: Publish Github Wiki | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: Publish Github Wiki | ||
uses: nimblehq/[email protected] | ||
with: | ||
user_name: nimble-wiki-bot | ||
user_email: [email protected] | ||
user_access_token: ${{ secrets.GH_BOT_PAT }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
nodejs 18.12.1 | ||
terraform 1.5.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,108 +1 @@ | ||
# Contributing guidelines for the project | ||
|
||
First off, thank you for considering contributing to this project. It's people like you that make this project such a great tool. We appreciate your help! | ||
|
||
The following is a set of guidelines for contributing to this project. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request. | ||
|
||
## Introduction | ||
|
||
This project uses TypeScript and [OCLIF](https://oclif.io/) to build the CLI, Jest for testing, and ESLint for code formatting and linting. | ||
|
||
## Issues and feature requests | ||
|
||
If you have any issues or feature requests, please create an issue in the [GitHub issues](https://github.com/nimblehq/infrastructure-templates/issues) page. | ||
|
||
## Development | ||
|
||
### Prerequisites | ||
|
||
- [Node.js](https://nodejs.org/en/download/) 12.x or higher - 18.x LTS is recommended | ||
- NPM is preferred to use with this project | ||
|
||
### Install dependencies | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
### Run the CLI locally | ||
|
||
Run the following command and follow the instructions: | ||
|
||
```bash | ||
bin/dev generate {project-name} | ||
``` | ||
|
||
### Project structure | ||
|
||
The project has the following main folders: | ||
|
||
- `bin` - contains the executable file for the CLI | ||
- `dev` - the executable file for the CLI in development mode | ||
- `run` - the executable file for the CLI in production mode | ||
|
||
- `src` - contains the source code of the CLI | ||
- `index.ts` - the entry point of the CLI | ||
- `commands` - contains the commands of the CLI | ||
- `helpers` - contains the helper functions of the CLI | ||
- `childProcess` - contains the helper functions for child process | ||
- `file` - contains the helper functions for file interaction | ||
- `terraform` - contains the helper functions for Terraform | ||
- `templates` - contains the code to generate the templates | ||
- `addons` - contains the code to generate the common addons e.g. version control, CI/CD, etc. | ||
- `aws` - contains the code to generate the AWS modules e.g. VPC, RDS, etc. | ||
- `core` - contains the code to generate the main Terraform files e.g. `main.tf`, `variables.tf`, etc. | ||
- `skeleton` - contains the skeleton files for the project | ||
- `addons` - contains the skeleton files for common addons e.g. version control, CI/CD, etc. | ||
- `aws` - contains the skeleton files for AWS modules | ||
- `core` - contains the skeleton files for common files e.g. `main.tf`, `variables.tf`, `.gitignore`, etc. | ||
- `test` - contains the test helpers and configurations | ||
|
||
### Add a new command | ||
|
||
To add a new command, create a new folder in the `src/commands` and add the `index.ts` file. | ||
The command documentation can be found [here](https://oclif.io/docs/commands). | ||
|
||
### Add a new addon/module | ||
|
||
To add a new addon/module, you need to create a new folder in the `src/templates` folder depending on the type of the addon/module: | ||
|
||
- For common addons, create a new folder in the `src/templates/addons` folder | ||
- For AWS modules, create a new folder in the `src/templates/aws` folder | ||
- For common files, create a new folder in the `src/templates/core` folder | ||
|
||
Check the existing addons/modules for the reference. | ||
|
||
## Testing | ||
|
||
### Run tests | ||
|
||
```bash | ||
npm run test | ||
``` | ||
|
||
### Run and fix linting | ||
|
||
```bash | ||
npm run lint // to check linting | ||
|
||
npm run lint:fix // to fix linting | ||
``` | ||
|
||
## Publishing | ||
|
||
- This project will be published to NPM automatically when a new release is created in GitHub. Therefore, the package version in `package.json` should be updated before creating a new release. | ||
|
||
- The release should be created in the `main` branch. | ||
|
||
- The release should be created with the following format: `{version}` e.g. `1.0.0` | ||
|
||
### Manual publishing | ||
|
||
- To publish the project manually, run the following command: | ||
|
||
```bash | ||
npm run publish | ||
``` | ||
|
||
**Note:** NPM credentials are required to publish the project. Ensure that the version in `package.json` is updated. | ||
Check out our [contributing guidelines](../../wiki/contributing-guidelines) to get started. |
Oops, something went wrong.