Skip to content

Commit 8fa5336

Browse files
authored
Documentation website (#387)
* fix tencentcloud unpublished version * doc-site: initial doc site setup * doc-site: react landing page * doc-site: github actions deploy site * doc-site: static docs and assets * fix images closing tag * doc-site: added page to navigate between modules * doc-site: packaged common elements
1 parent da5ba4e commit 8fa5336

File tree

94 files changed

+23385
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+23385
-3
lines changed

.github/workflows/doc-site.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
## The is a combination of sites where
2+
## Zero serves on the root of the domain /
3+
## and module serves on /docs/modules/<path>/
4+
# from the same S3 bucket
5+
6+
name: "Build Documentation Site"
7+
on:
8+
push:
9+
branches:
10+
- main
11+
- doc-site
12+
paths:
13+
- doc-site/**
14+
15+
env:
16+
region: us-west-2
17+
s3_sync_path_to_exclude: docs/modules/*
18+
s3_sync_path: ""
19+
BUILD_DOMAIN: staging.getzero.dev
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v2
25+
- name: Setup node.js
26+
uses: actions/setup-node@v1
27+
with:
28+
node-version: 14.x
29+
# - name: Documentaiton site folder
30+
# run: cd doc-site
31+
- name: Install Dependencies
32+
working-directory: doc-site
33+
run: npm install
34+
- name: Build website
35+
working-directory: doc-site
36+
run: |
37+
npm run build
38+
pwd
39+
ls -la
40+
- name: Upload build artifact to Github
41+
uses: actions/upload-artifact@v2
42+
with:
43+
name: build-artifact
44+
path: doc-site/build
45+
46+
deploy:
47+
name: Deploy
48+
runs-on: ubuntu-latest
49+
needs: build
50+
51+
steps:
52+
# Once github action supports nested composite actions (anything `uses` is a composite action)
53+
# Therefore we cannot reuse the code as a separate composite action until it supports it,
54+
# current the deploy logic is in this file twice because of it
55+
## https://github.com/actions/runner/issues/862
56+
- uses: actions/checkout@v2
57+
- name: Configure AWS credentials for S3 sync
58+
uses: aws-actions/configure-aws-credentials@v1
59+
with:
60+
aws-access-key-id: ${{ secrets.ZERO_DOC_SITE_AWS_ACCESS_KEY_ID }}
61+
aws-secret-access-key: ${{ secrets.ZERO_DOC_SITE_AWS_SECRET_ACCESS_KEY }}
62+
aws-region: ${{ env.region }}
63+
- name: Download build artifact from Github
64+
uses: actions/download-artifact@v1
65+
with:
66+
name: build-artifact
67+
path: build/
68+
- name: Sync with S3
69+
shell: bash
70+
run: |
71+
cd build
72+
aws s3 sync . "s3://${{ secrets.ZERO_DOC_SITE_BUCKET_NAME }}${{ env.s3_sync_path }}" --exclude "${{ env.s3_sync_path_to_exclude }}" --delete
73+
- name: Invalidate Cloudfront
74+
shell: bash
75+
run: |
76+
export DIST_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Aliases.Items[?@=='${{ secrets.ZERO_DOC_SITE_BUCKET_NAME }}']].Id | [0]" | tr -d '"')
77+
aws cloudfront create-invalidation --distribution-id ${DIST_ID} --paths "/*"

doc-site/.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*
21+
22+
# to test theme color for elements locally
23+
docs/about/color-test.md*

doc-site/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Website
2+
3+
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
4+
5+
## Installation
6+
7+
```console
8+
yarn install
9+
```
10+
11+
## Local Development
12+
13+
```console
14+
yarn start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
## Build
20+
21+
```console
22+
yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
## Deployment
28+
29+
```console
30+
GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
31+
```
32+
33+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

doc-site/babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3+
};

doc-site/docs/about/opensource.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: Opensource
3+
sidebar_label: Opensource
4+
sidebar_position: 2
5+
---
6+
7+
8+
## Contributing to Zero
9+
10+
Zero welcomes collaboration from the community; you can open new issues in our GitHub repo, Submit PRs' for bug fixes or browse through the tickets currently open to see what you can contribute too.
11+
12+
We use Zenhub to show us the entire project across all repositories, so if you are interested in seeing that or participating, you can can [check out our workspace](https://app.zenhub.com/workspaces/commit-zero-5da8decc7046a60001c6db44/board?repos=203630543,247773730,257676371,258369081,291818252,293942410,285931648,317656612)

doc-site/docs/about/overview.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
title: Overview
3+
sidebar_label: Overview
4+
sidebar_position: 1
5+
---
6+
7+
8+
## What is Zero
9+
10+
Zero is an open source tool which makes it quick and easy for startup technical founders and developers to build everything they need to launch and grow high-quality SaaS applications faster and more cost-effectively.
11+
12+
Zero sets up everything you need so you can immediately start building your product.
13+
14+
Zero was created by [Commit](https://commit.dev).
15+
## Why is Zero good for startups
16+
17+
As a technical founder or the first technical hire at a startup, your sole focus is to build the logic for your application and get it into customers’ hands as quickly and reliably as possible. Yet you immediately face multiple hurdles before even writing the first line of code. You’re forced to make many tech trade-offs, leading to decision fatigue. You waste countless hours building boilerplate SaaS features not adding direct value to your customers. You spend precious time picking up unfamiliar tech, make wrong choices that result in costly refactoring or rebuilding in the future, and are unaware of tools and best practices that would speed up your product iteration.
18+
19+
Zero was built by a team of engineers with many years of experience in building and scaling startups. We have faced all the problems you will and want to provide a way for new startups to avoid all those pitfalls. We also want to help you learn about the tech choices we made so your team can become proficient in some of the great tools we have included. The system you get starts small but allows you to scale well into the future when you need to.
20+
21+
Everything built by Zero is yours. After using Zero to generate your infrastructure, backend, and frontend, all the code is checked into your source control repositories and becomes the basis for your new system. We provide constant updates and new modules that you can pull in on an ongoing basis, but you can also feel free to customize as much as you like with no strings attached. If you do happen to make a change to core functionality and feel like contributing it back to the project, we'd love that too!
22+
23+
It's easy to get started, the only thing you'll need is an AWS account. Just enter your AWS CLI tokens or choose your existing profile during the setup process and everything is built for you automatically using infrastructure-as-code so you can see exactly what's happening and easily modify it if necessary.
24+
25+
[Read about the day-to-day experience of using a system set up using Zero][real-world-usage]
26+
27+
28+
## Why is Zero Reliable, Scalable, Performant, and Secure
29+
30+
Reliability: Your infrastructure will be set up in multiple availability zones making it highly available and fault tolerant. All production workloads will run with multiple instances by default, using AWS ELB and Nginx to load balance traffic. All infrastructure is represented with code using [HashiCorp Terraform][terraform] so your environments are reproducible, auditable, and easy to configure.
31+
32+
Scalability: Your services will be running in Kubernetes, with the EKS nodes running in an AWS [Auto Scaling Group][asg]. Both the application workloads and cluster size are ready to scale whenever the need arises. Your frontend assets will be stored in S3 and served from AWS' Cloudfront CDN which operates at global scale.
33+
34+
Security: Properly configured access-control to resources/security groups, using secret storage systems (AWS Secret Manager, Kubernetes secrets), and following best practices provides great security out of the box. Our practices are built on top of multiple security audits and penetration tests. Automatic certificate management using [Let's Encrypt][letsencrypt], database encryption, VPN support, and more means your traffic will always be encrypted. Built-in application features like user authentication help you bullet-proof your application by using existing, tested tools rather than reinventing the wheel when it comes to features like user management and auth.
35+
36+
37+
## What do you get out of the box?
38+
[Read about why we made these technology choices and where they are most applicable.][technology-choices]
39+
40+
[Check out some resources for learning more about these technologies.][learning-resources]
41+
42+
### Infrastructure
43+
- Fully configured infrastructure-as-code AWS environment including:
44+
- VPCs per environment (staging, production) with pre-configured subnets, security groups, etc.
45+
- EKS Kubernetes cluster per environment, pre-configured with helpful tools like cert-manager, external-dns, nginx-ingress-controller
46+
- RDS database for your application (Postgres or MySQL)
47+
- S3 buckets and Cloudfront distributions to serve your assets
48+
- Logging and Metrics collected automatically using either Cloudwatch or Prometheus + Grafana, Elasticsearch + Kibana
49+
- VPN using [Wireguard][wireguard] (Optional)
50+
- User management and Identity / Access Proxy using Ory [Kratos][kratos] and [Oathkeeper][oathkeeper] (Optional)
51+
- Tooling to make it easy to set up secure access for your dev team
52+
- Local/Cloud Hybrid developer environment using Telepresence (Optional)
53+
54+
### Backend
55+
- Golang or Node.js example project automatically set up, Dockerized, and deployed to your new Kubernetes cluster
56+
- CI pipeline built with [CircleCI][circleci] or GitHub Actions. Just merge a PR and a deploy will start. Your code will be built and tested, deployed to staging, then prompt you to push to production
57+
- File upload / download support using signed Cloudfront URLs (Optional)
58+
- Email support using [SendGrid][sendgrid] or AWS SES (Optional)
59+
- Notification support for sending and receiving messages in your application (web, mobile, SMS, Email, etc.) (Optional) (In Progress)
60+
- User management integration with Kratos and Oathkeeper - No need to handle login, signup, authentication yourself (Optional)
61+
62+
### Frontend
63+
- React example project automatically set up, deployed and served securely to your customers
64+
- CI pipeline built with CircleCI or GitHub Actions. Just merge a PR and a deploy will start. Your code will be built and tested, deployed to staging, then prompt you to push to production
65+
- File upload / download support using signed Cloudfront URLs (Optional)
66+
- User management integration with Kratos - Just style the example login / signup flow to look the way you want (Optional)
67+
- Static site example project using Gatsby to easily make a landing page, also set up with a CI Pipeline using CircleCI (Optional)
68+
69+
<!-- internal links -->
70+
[real-world-usage]: ./real-world-usage
71+
[technology-choices]: ./technology-choices
72+
[learning-resources]: ../reference/learning-resources
73+
<!-- links -->
74+
75+
76+
[git]: https://git-scm.com
77+
[kubectl]: https://kubernetes.io/docs/tasks/tools/install-kubectl/
78+
[terraform]:https://www.terraform.io/downloads.html
79+
[jq]: https://github.com/stedolan/jq
80+
[AWS CLI]: https://aws.amazon.com/cli/
81+
[acw]: https://aws.amazon.com/cloudwatch/
82+
[vpc]: https://aws.amazon.com/vpc/
83+
[iam]: https://aws.amazon.com/iam/
84+
[asg]: https://aws.amazon.com/autoscaling/
85+
[zero binary]: https://github.com/commitdev/zero/releases/
86+
[Wget]: https://stackoverflow.com/questions/33886917/how-to-install-wget-in-macos
87+
[and more]: https://github.com/commitdev/zero-aws-eks-stack/blob/master/docs/resources.md
88+
[terraform]: https://terraform.io
89+
[letsencrypt]: https://letsencrypt.org/
90+
[kratos]: https://www.ory.sh/kratos/
91+
[oathkeeper]: https://www.ory.sh/oathkeeper/
92+
[wireguard]: https://wireguard.com/
93+
[circleci]: https://circleci.com/
94+
[sendgrid]: https://sendgrid.com/
95+
[launchdarkly]: https://launchdarkly.com/
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: Real-world Usage Scenarios
3+
sidebar_label: Real-world Usage
4+
sidebar_position: 4
5+
---
6+
7+
## Developing and deploying application changes
8+
1. Clone your git repository.
9+
2. Make a branch, start working on your code.
10+
3. If using the Telepresence dev experience, run the `start-dev-env.sh` script to allow you to use the hybrid cloud environment as you work, to run and test your code in a realistic environment.
11+
3. Commit your finished code, make a PR, have it reviewed. Lightweight tests will run against your branch and prevent merging if they fail.
12+
4. Merge your branch to the main branch. A build will start automatically.
13+
5. The pipeline will build an artifact, run tests, deploy your change to staging, then wait for your input to deploy to production.
14+
15+
## Debugging a problem on production
16+
1. Check the logs of your service:
17+
- If using cloudwatch, log into the AWS console and go to the [Logs Insights tool](https://us-west-2.console.aws.amazon.com/cloudwatch/home#logsV2:logs-insights). Choose the log group for your production environment ending in `/application` and hit the "Run query" button.
18+
- If using kibana, make sure you are on the VPN and open the Kibana URL in your browser. Click the "Discover" tab and try searching for logs based on the name of your service.
19+
- Alternatively, watch the logs in realtime via the CLI using the command `kubectl logs -f -l app=<your service name>` or `stern <your service name>`
20+
2. Check the state of your application pods. Look for strange events or errors from the pods:
21+
```shell
22+
$ kubectl get pods
23+
$ kubectl get events
24+
$ kubectl describe pods
25+
```
26+
3. Exec into your application pod. From here you can check connectivity with `ping` or `nc`, or inspect anything else application-specific.
27+
```shell
28+
$ kubectl get pods
29+
NAME READY STATUS RESTARTS AGE
30+
your-service-6c5f6b56b7-2w447 1/1 Running 0 30m49s
31+
$ kubectl exec -it your-service-6c5f6b56b7-2w447 sh
32+
```
33+
34+
35+
## Adding support for a new subdomain or site
36+
1. Check the currently configured ingresses in your cluster:
37+
```shell
38+
$ kubectl get ingress -A
39+
NAMESPACE NAME CLASS HOSTS ADDRESS PORTS AGE
40+
your-service your-service <none> api.your-service.dev abcd1234-1234.us-west-2.elb.amazonaws.com 80, 443 130d
41+
```
42+
2. If this is for a new service entirely, make sure there is an ingress defined in the `kubernetes/` directory of your repo. If you want to add a new domain pointing to an existing service, just go into the file `kubernetes/overlays/<environment>/ingress.yml` and add a section to `spec:` and `tls:`, specifying your new domain.
43+
- `spec` is where you can define the hostname, any special path rules, and which service you want traffic to be sent to
44+
- if your hostname is in the `tls` section, a TLS certificate will automatically be provisioned for it using Let's Encrypt
45+
3. A number of things will happen once this is deployed to the cluster:
46+
- Routing rules will be created to let traffic in to the cluster and send it to the service based on the hostname and path
47+
- An AWS load balancer will be created if one doesn't already exist and it will be pointed to the cluster
48+
- In the case of a subdomain, a DNS record will be automatically created for you
49+
- A certificate will be provisioned using Let's Encrypt for the domain you specified

doc-site/docs/about/roadmap.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Roadmap
3+
sidebar_label: Roadmap
4+
sidebar_position: 5
5+
---
6+
7+
:::info
8+
Coming soon
9+
:::

0 commit comments

Comments
 (0)