From bc4b20241d280026030989826c1868ee7342ebeb Mon Sep 17 00:00:00 2001 From: Bill Monkman Date: Tue, 24 Aug 2021 15:11:09 -0700 Subject: [PATCH 1/2] enhancement: Change the referenced names of the modules to reflect the upcoming name change. A few improvements and consolidations to docs. --- .goreleaser.yml | 3 + README.md | 179 +----------------- .../docs/getting-started/prerequisites.md | 35 +++- doc-site/docs/getting-started/zero-apply.md | 9 +- doc-site/docs/getting-started/zero-create.md | 4 +- doc-site/docs/getting-started/zero-init.md | 8 +- doc-site/src/components/HomepageTrustedBy.js | 4 +- .../projectconfig/project_config_test.go | 18 +- internal/registry/registry.go | 12 +- 9 files changed, 73 insertions(+), 199 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 43456ed90..6328b158e 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -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 diff --git a/README.md b/README.md index d05978ceb..2edda4802 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. - -
- If using CircleCI as your build pipeline ... - - - 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. -
- -### 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: - -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: -✔ 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 @@ -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) | ___ @@ -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. -[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/ diff --git a/doc-site/docs/getting-started/prerequisites.md b/doc-site/docs/getting-started/prerequisites.md index f99054be6..2168d0165 100644 --- a/doc-site/docs/getting-started/prerequisites.md +++ b/doc-site/docs/getting-started/prerequisites.md @@ -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. + +
+ If using CircleCI as your build pipeline... +
    +
  • + Grant CircleCi Organization access to your repositories to allow pulling the code during the build pipeline. +
  • +
  • + You will need to create a CircleCi access token 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. +
  • +
+
+ + ### `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. @@ -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 diff --git a/doc-site/docs/getting-started/zero-apply.md b/doc-site/docs/getting-started/zero-apply.md index 850ba8248..7b2f0b2af 100644 --- a/doc-site/docs/getting-started/zero-apply.md +++ b/doc-site/docs/getting-started/zero-apply.md @@ -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 @@ -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 diff --git a/doc-site/docs/getting-started/zero-create.md b/doc-site/docs/getting-started/zero-create.md index d06c4faef..01b2b9aef 100644 --- a/doc-site/docs/getting-started/zero-create.md +++ b/doc-site/docs/getting-started/zero-create.md @@ -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. -``` \ No newline at end of file +``` + +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. diff --git a/doc-site/docs/getting-started/zero-init.md b/doc-site/docs/getting-started/zero-init.md index daffa5275..461b31e5c 100644 --- a/doc-site/docs/getting-started/zero-init.md +++ b/doc-site/docs/getting-started/zero-init.md @@ -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 -``` \ No newline at end of file +``` + +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`. diff --git a/doc-site/src/components/HomepageTrustedBy.js b/doc-site/src/components/HomepageTrustedBy.js index be1eb9b66..04a65bea6 100644 --- a/doc-site/src/components/HomepageTrustedBy.js +++ b/doc-site/src/components/HomepageTrustedBy.js @@ -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", @@ -39,4 +39,4 @@ export default function TrustedByCarousel() {

Trusted By

-} \ No newline at end of file +} diff --git a/internal/config/projectconfig/project_config_test.go b/internal/config/projectconfig/project_config_test.go index 2614f5716..8e585b6b2 100644 --- a/internal/config/projectconfig/project_config_test.go +++ b/internal/config/projectconfig/project_config_test.go @@ -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{}), } } @@ -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 ` } diff --git a/internal/registry/registry.go b/internal/registry/registry.go index 6d3452990..1631342b9 100644 --- a/internal/registry/registry.go +++ b/internal/registry/registry.go @@ -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", }, }, } From 159bfaef86511836630acf79cc9256bea324cd63 Mon Sep 17 00:00:00 2001 From: Bill Monkman Date: Tue, 24 Aug 2021 16:21:40 -0700 Subject: [PATCH 2/2] Update README.md Co-authored-by: David Cheung --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2edda4802..14c1c2a7e 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ ___ ## Getting Started -(See the getting started guide at the Zero docs site.)[https://getzero.dev/docs/zero/getting-started/installation] +[See the getting started guide at the Zero docs site.](https://getzero.dev/docs/zero/getting-started/installation) ### Building blocks of Zero