Skip to content

Commit

Permalink
enhancement: Change the referenced names of the modules to reflect th…
Browse files Browse the repository at this point in the history
…e upcoming name change. A few improvements and consolidations to docs. (#407)

* enhancement: Change the referenced names of the modules to reflect the upcoming name change. A few improvements and consolidations to docs.

* Update README.md

Co-authored-by: David Cheung <[email protected]>

Co-authored-by: David Cheung <[email protected]>
  • Loading branch information
bmonkman and davidcheung authored Aug 25, 2021
1 parent 5a694f7 commit a50a7be
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 199 deletions.
3 changes: 3 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ builds:
- CGO_ENABLED=0
ldflags:
- -X github.com/commitdev/zero/version.AppVersion={{.Version}} -X github.com/commitdev/zero/version.AppBuild={{.ShortCommit}}
goarch:
- amd64
- 386
archives:
- replacements:
darwin: Darwin
Expand Down
179 changes: 5 additions & 174 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,42 +71,7 @@ ___

## Getting Started

### How to Install and Configure Zero

There are multiple ways to install Zero:

- Install Zero using your systems package manager.

```
# MacOS
brew tap commitdev/zero
brew install zero
```

- Install Zero by downloading the binary.

Download the latest [Zero binary] for your systems architecture. Unzip your downloaded package and copy the Zero binary to the desired location and add it to your system PATH.

Zero currently supports:
| System | Support| Package Manager |
|---------|:-----:|:------:|
| MacOS || `brew` |
| Linux || `deb, rpm, apk` |
| Windows || n/a |

### Prerequisites

In order to use Zero, run the `zero check` command on your system to find out which other tools / dependencies you might need to install.

![zero-check](./docs/img/zero-check.png)

[AWS CLI], [Kubectl], [Terraform], [jq], [Git], [Wget]

You need to [register a new domain](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-register.html) / [host a registered domain](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/MigratingDNS.html) you will use to access your infrastructure on [Amazon Route 53](https://aws.amazon.com/route53/).

> We recommended you have two domains - one for staging and another for production. For example, mydomain.com and mydomain-staging.com. This will lead to environments that are more similar, rather than trying to use a subdomain like staging.mydomain.com for staging which may cause issues in your app later on.
___
[See the getting started guide at the Zero docs site.](https://getzero.dev/docs/zero/getting-started/installation)

### Building blocks of Zero

Expand All @@ -120,134 +85,6 @@ Also declares dependency used to determine the order of execution with other mod

See [`zero-module.yml` reference](./docs/module-definition.md) for details.
___
## Using zero to spin up your own stack

Using Zero to spin up your infrastructure and application is easy and straightforward. Using just a few commands, you can configure and deploy your very own scalable, high-performance, production-ready infrastructure.

A few caveats before getting started:

- For Zero to provision resources, you will need to be authenticated with AWS [(authenticate with aws-cli)](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html#cli-configure-files-methods).

- It is recommended practice to [create a GitHub org](https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/creating-a-new-organization-from-scratch) where your code is going to live. If you choose, after creating your codebases, Zero will automatically create repositories and check in your code for you. You will need to [create a Personal Access Token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) to enable this.

<details>
<summary>If using CircleCI as your build pipeline ...</summary>

- Grant [CircleCi Organization access](https://github.com/settings/connections/applications/78a2ba87f071c28e65bb) to your repositories to allow pulling the code during the build pipeline.

- You will need to [create a CircleCi access token](https://circleci.com/docs/2.0/managing-api-tokens/) and enter it during the setup process; you should store your generated tokens securely.

- For your CI build to work, you need to opt into the use of third-party orbs. You can find this in your CircleCi Org Setting > Security > Allow Uncertified Orbs.
</details>

### zero init

The `zero init` command creates a new project and outputs an infrastructure configuration file with user input prompted responses into a file. -> 📁 `YOUR_PROJECT_NAME/zero-project.yml`

```shell
# To create and customize a new project you run
$ zero init

## Sample project initialization
✔ Project Name: myapp-infra
🎉 Initializing project
✔ EKS + Go + React + Gatsby
✔ Should the created projects be checked into github automatically? (y/n): y
✔ What's the root of the github org to create repositories in?: github.com/myapp-org
✔ Existing AWS Profiles
✔ default
Github personal access token: used for creating repositories for your project
Requires the following permissions: [repo::public_repo, admin::orgread:org]
The token can be created at https://github.com/settings/tokens
✔ Github Personal Access Token with access to the above organization: <MY_GITHUB_ORG_ACCESS_TOKEN>
CircleCI api token: used for setting up CI/CD for your project
The token can be created at https://app.circleci.com/settings/user/tokens
✔ Circleci api key for CI/CD: <MY_CIRCLE_CI_ACCESS_TOKEN>
✔ us-west-2
✔ Production Root Host Name (e.g. mydomain.com) - this must be the root of the chosen domain, not a subdomain.: commitzero.com
✔ Production Frontend Host Name (e.g. app.): app.
✔ Production Backend Host Name (e.g. api.): api.
✔ Staging Root Host Name (e.g. mydomain-staging.com) - this must be the root of the chosen domain, not a subdomain.: commitzero-stage.com
✔ Staging Frontend Host Name (e.g. app.): app.
✔ Staging Backend Host Name (e.g. api.): api.
✔ What do you want to call the zero-aws-eks-stack project?: infrastructure
✔ What do you want to call the zero-deployable-backend project?: backend-service
✔ What do you want to call the zero-deployable-react-frontend project?: frontend
```
### zero create
The `zero create` command renders the infrastructure modules you've configured into your project folder and pushes your code to GitHub.

```shell
# Template the selected modules and configuration specified in zero-project.yml and push to the repository.
$ cd zero-init # change your working dir to YOUR_PROJECT_NAME
$ zero create
## Sample Output
🕰 Fetching Modules
📝 Rendering Modules
Finished templating : backend-service/.circleci/README.md
✅ Finished templating : backend-service/.circleci/config.yml
✅ Finished templating : backend-service/.gitignore
...
...
✅ Finished templating : infrastructure/terraform/modules/vpc/versions.tf
⬆ Done Rendering - committing repositories to version control.
✅ Repository created: github.com/myapp-org/infrastructure
✅ Repository created: github.com/myapp-org/backend-service
✅ Repository created: github.com/myapp-org/frontend
✅ Done - run zero apply to create any required infrastructure or execute any other remote commands to prepare your environments.
```

### zero apply

The `zero apply` command takes the templated modules generated based on your input and spins up a scalable & performant infrastructure for you!

_Note that this can take 20 minutes or more depending on your choices, as it is waiting for all the provisioned infrastructure to be created_
```shell
$ zero apply
# Sample Output
Choose the environments to apply. This will create infrastructure, CI pipelines, etc.
At this point, real things will be generated that may cost money!
Only a single environment may be suitable for an initial test, but for a real system we suggest setting up both staging and production environments.
✔ Production
🎉 Bootstrapping project zero-init. Please use the zero-project.yml file to modify the project as needed.
Cloud provider: AWS
Runtime platform: Kubernetes
Infrastructure executor: Terraform
...
...
✅ Done.
Your projects and infrastructure have been successfully created. Here are some useful links and commands to get you started:
zero-aws-eks-stack:
- Repository URL: github.com/myapp-org/infrastructure
- To see your kubernetes clusters, run: 'kubectl config get-contexts'
- To switch to a cluster, use the following commands:
- for production use: kubectl config use-context arn:aws:eks:us-west-2:123456789:cluster/myapp-infra-production-us-west-2
- To inspect the selected cluster, run 'kubectl get node,service,deployment,pods'
zero-deployable-react-frontend:
- Repository URL: github.com/myapp-org/frontend
- Deployment Pipeline URL: https://app.circleci.com/pipelines/github/myapp-org/frontend
- Production Landing Page: app.commitzero.com
zero-deployable-backend:
- Repository URL: github.com/myapp-org/backend-service
- Deployment Pipeline URL: https://app.circleci.com/pipelines/github/myapp-org/backend-service
- Production API: api.commitzero.com
```

***Your stack is now up and running, follow the links in your terminal to visit your application 🎉***


## Zero Default Stack
Expand All @@ -258,10 +95,10 @@ The core zero modules currently available are:
| Project | URL |
|---|---|
| AWS Infrastructure | [https://github.com/commitdev/zero-aws-eks-stack](https://github.com/commitdev/zero-aws-eks-stack) |
| Backend (Go) | [https://github.com/commitdev/zero-deployable-backend](https://github.com/commitdev/zero-deployable-backend) |
| Backend (Node.js) | [https://github.com/commitdev/zero-deployable-node-backend](https://github.com/commitdev/zero-deployable-node-backend) |
| Frontend (React) | [https://github.com/commitdev/zero-deployable-react-frontend](https://github.com/commitdev/zero-deployable-react-frontend) |
| Static Site (Gatsby) | [https://github.com/commitdev/zero-deployable-landing-page](https://github.com/commitdev/zero-deployable-landing-page) |
| Backend (Go) | [https://github.com/commitdev/zero-backend-go](https://github.com/commitdev/zero-backend-go) |
| Backend (Node.js) | [https://github.com/commitdev/zero-backend-node](https://github.com/commitdev/zero-backend-node) |
| Frontend (React) | [https://github.com/commitdev/zero-frontend-react](https://github.com/commitdev/zero-frontend-react) |
| Static Site (Gatsby) | [https://github.com/commitdev/zero-static-site-gatsby](https://github.com/commitdev/zero-static-site-gatsby) |

___

Expand Down Expand Up @@ -313,17 +150,11 @@ Why is my deployed application not yet accessible?
- It takes about 20 - 35 mins for your deployed application to be globally available through AWS CloudFront CDN.

<!-- links -->
[git]: https://git-scm.com
[kubectl]: https://kubernetes.io/docs/tasks/tools/install-kubectl/
[terraform]:https://www.terraform.io/downloads.html
[jq]: https://github.com/stedolan/jq
[AWS CLI]: https://aws.amazon.com/cli/
[acw]: https://aws.amazon.com/cloudwatch/
[vpc]: https://aws.amazon.com/vpc/
[iam]: https://aws.amazon.com/iam/
[asg]: https://aws.amazon.com/autoscaling/
[zero binary]: https://github.com/commitdev/zero/releases/
[Wget]: https://stackoverflow.com/questions/33886917/how-to-install-wget-in-macos
[and more]: https://github.com/commitdev/zero-aws-eks-stack/blob/master/docs/resources.md
[terraform]: https://terraform.io
[letsencrypt]: https://letsencrypt.org/
Expand Down
35 changes: 34 additions & 1 deletion doc-site/docs/getting-started/prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,31 @@ sidebar_label: Prerequisites
sidebar_position: 2
---


Using Zero to spin up your infrastructure and application is easy and straightforward. Using just a few commands, you can configure and deploy your very own scalable, high-performance, production-ready infrastructure.

A few caveats before getting started:

- For Zero to provision resources, you will need to be [authenticated with the AWS CLI tool ](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html#cli-configure-files-methods).

- It is recommended practice to [create a GitHub org](https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/creating-a-new-organization-from-scratch) where your code is going to live. If you choose, after creating your codebases, Zero will automatically create repositories and check in your code for you. You will need to [create a Personal Access Token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) to enable this.

<details>
<summary>If using CircleCI as your build pipeline...</summary>
<ul>
<li>
Grant <a href="https://github.com/settings/connections/applications/78a2ba87f071c28e65bb">CircleCi Organization access</a> to your repositories to allow pulling the code during the build pipeline.
</li>
<li>
You will need to <a href="https://circleci.com/docs/2.0/managing-api-tokens/">create a CircleCi access token</a> and enter it during the setup process; you should store your generated tokens securely.
</li>
<li>
For your CI build to work, you need to opt into the use of third-party orbs. You can find this in your CircleCi Org Setting &gt; Security &gt; Allow Uncertified Orbs.
</li>
</ul>
</details>


### `zero check`
In order to use Zero, run the `zero check` command on your system to find out which other tools / dependencies you might need to install.

Expand All @@ -13,5 +38,13 @@ In order to use Zero, run the `zero check` command on your system to find out wh

You need to [register a new domain](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-register.html) / [host a registered domain](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/MigratingDNS.html) you will use to access your infrastructure on [Amazon Route 53](https://aws.amazon.com/route53/).

> We recommended you have two domains - one for staging and another for production. For example, mydomain.com and mydomain-staging.com. This will lead to environments that are more similar, rather than trying to use a subdomain like staging.mydomain.com for staging which may cause issues in your app later on.
:::tip
We recommended you have two domains - one for staging and another for production. For example, mydomain.com and mydomain-staging.com. This will lead to environments that are more similar, rather than trying to use a subdomain like staging.mydomain.com for staging which may cause issues in your app later on.
:::

[AWS CLI]: https://aws.amazon.com/cli/
[git]: https://git-scm.com
[kubectl]: https://kubernetes.io/docs/tasks/tools/install-kubectl/
[terraform]:https://www.terraform.io/downloads.html
[jq]: https://github.com/stedolan/jq
[Wget]: https://stackoverflow.com/questions/33886917/how-to-install-wget-in-macos
9 changes: 6 additions & 3 deletions doc-site/docs/getting-started/zero-apply.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ sidebar_position: 5

The `zero apply` command takes the templated modules generated based on your input and spins up a scalable & performant infrastructure for you!

_Note that this can take 20 minutes or more depending on your choices, as it is waiting for all the provisioned infrastructure to be created_
:::note
This can take 20 minutes or more depending on your choices, as it must wait for all the provisioned infrastructure to be created
:::

```shell
$ zero apply

Expand All @@ -33,12 +36,12 @@ zero-aws-eks-stack:
- for production use: kubectl config use-context arn:aws:eks:us-west-2:123456789:cluster/myapp-infra-production-us-west-2

- To inspect the selected cluster, run 'kubectl get node,service,deployment,pods'
zero-deployable-react-frontend:
zero-frontend-react:
- Repository URL: github.com/myapp-org/frontend
- Deployment Pipeline URL: https://app.circleci.com/pipelines/github/myapp-org/frontend
- Production Landing Page: app.commitzero.com

zero-deployable-backend:
zero-backend-go:
- Repository URL: github.com/myapp-org/backend-service
- Deployment Pipeline URL: https://app.circleci.com/pipelines/github/myapp-org/backend-service
- Production API: api.commitzero.com
Expand Down
4 changes: 3 additions & 1 deletion doc-site/docs/getting-started/zero-create.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ $ zero create
✅ Done - run zero apply to create any required infrastructure or execute any other remote commands to prepare your environments.


```
```

After this step you will be able to examine the created repositories before proceeding to `zero apply`. If you chose not to have zero create a repository for you, you can still use the `zero apply` command to create the infrastructure but you will need to check these repositories into your version control system of choice.
8 changes: 5 additions & 3 deletions doc-site/docs/getting-started/zero-init.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ The token can be created at https://app.circleci.com/settings/user/tokens
✔ Staging Frontend Host Name (e.g. app.): app.
✔ Staging Backend Host Name (e.g. api.): api.
✔ What do you want to call the zero-aws-eks-stack project?: infrastructure
✔ What do you want to call the zero-deployable-backend project?: backend-service
✔ What do you want to call the zero-deployable-react-frontend project?: frontend
✔ What do you want to call the zero-backend-go project?: backend-service
✔ What do you want to call the zero-frontend-react project?: frontend
```
```
After this step you will be able to examine the `zero-project.yml` file to ensure your settings are correct before proceeding to `zero create`.
4 changes: 2 additions & 2 deletions doc-site/src/components/HomepageTrustedBy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const trustedByData = [
},
{
img: "img/partners/atlasone.png",
src: "https://atlasone.ca/",
src: "https://www.atlasone.ca/",
},
{
img: "img/partners/placeholder.png",
Expand All @@ -39,4 +39,4 @@ export default function TrustedByCarousel() {
<h3 className={styles.title}>Trusted By</h3>
<Carousel data={trustedByData} />
</div>
}
}
18 changes: 9 additions & 9 deletions internal/config/projectconfig/project_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ func TestLoadConfig(t *testing.T) {
func eksGoReactSampleModules() projectconfig.Modules {
parameters := projectconfig.Parameters{"a": "b"}
return projectconfig.Modules{
"aws-eks-stack": projectconfig.NewModule(parameters, "zero-aws-eks-stack", "github.com/something/repo1", "github.com/commitdev/zero-aws-eks-stack", []string{}, []projectconfig.Condition{}),
"deployable-backend": projectconfig.NewModule(parameters, "zero-deployable-backend", "github.com/something/repo2", "github.com/commitdev/zero-deployable-backend", []string{}, []projectconfig.Condition{}),
"deployable-react-frontend": projectconfig.NewModule(parameters, "zero-deployable-react-frontend", "github.com/something/repo3", "github.com/commitdev/zero-deployable-react-frontend", []string{}, []projectconfig.Condition{}),
"aws-eks-stack": projectconfig.NewModule(parameters, "zero-aws-eks-stack", "github.com/something/repo1", "github.com/commitdev/zero-aws-eks-stack", []string{}, []projectconfig.Condition{}),
"backend-go": projectconfig.NewModule(parameters, "zero-backend-go", "github.com/something/repo2", "github.com/commitdev/zero-backend-go", []string{}, []projectconfig.Condition{}),
"frontend-react": projectconfig.NewModule(parameters, "zero-frontend-react", "github.com/something/repo3", "github.com/commitdev/zero-frontend-react", []string{}, []projectconfig.Condition{}),
}
}

Expand All @@ -61,20 +61,20 @@ modules:
dir: zero-aws-eks-stack
repo: github.com/something/repo1
source: github.com/commitdev/zero-aws-eks-stack
deployable-backend:
backend-go:
parameters:
a: b
files:
dir: zero-deployable-backend
dir: zero-backend-go
repo: github.com/something/repo2
source: github.com/commitdev/zero-deployable-backend
deployable-react-frontend:
source: github.com/commitdev/zero-backend-go
frontend-react:
parameters:
a: b
files:
dir: zero-deployable-react-frontend
dir: zero-frontend-react
repo: github.com/something/repo3
source: github.com/commitdev/zero-deployable-react-frontend
source: github.com/commitdev/zero-frontend-react
`
}

Expand Down
12 changes: 6 additions & 6 deletions internal/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ func GetRegistry(path string) Registry {
"EKS + Go + React + Gatsby",
[]string{
path + "/zero-aws-eks-stack",
path + "/zero-deployable-landing-page",
path + "/zero-deployable-backend",
path + "/zero-deployable-react-frontend",
path + "/zero-static-site-gatsby",
path + "/zero-backend-go",
path + "/zero-frontend-react",
},
},
{
"EKS + NodeJS + React + Gatsby",
[]string{
path + "/zero-aws-eks-stack",
path + "/zero-deployable-landing-page",
path + "/zero-deployable-node-backend",
path + "/zero-deployable-react-frontend",
path + "/zero-static-site-gatsby",
path + "/zero-backend-node",
path + "/zero-frontend-react",
},
},
}
Expand Down

0 comments on commit a50a7be

Please sign in to comment.