Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tsertkov/tpl-aws-website
Automated repo with AWS-hosted static website template
https://github.com/tsertkov/tpl-aws-website
aws aws-sam cicd monorepo template-repo website
Last synced: 2 months ago
JSON representation
Automated repo with AWS-hosted static website template
- Host: GitHub
- URL: https://github.com/tsertkov/tpl-aws-website
- Owner: tsertkov
- License: mit
- Created: 2024-05-14T08:59:37.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-08-19T07:52:03.000Z (4 months ago)
- Last Synced: 2024-08-19T09:12:10.944Z (4 months ago)
- Topics: aws, aws-sam, cicd, monorepo, template-repo, website
- Language: Makefile
- Homepage: https://tpl-aws-website.alekswrite.com
- Size: 1.36 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/new?template_name=tpl-aws-website&template_owner=tsertkov)
# tpl-aws-website
A monorepo template for an AWS-hosted static website, complete with infrastructure code and CI/CD automations, multiple environments, optional basic auth protection.
💲 >= **$0.50** 🌟 Monthly AWS cost (**🌐 DNS Zone** + 🔧 *usage*)
## Table of Contents
- [Infrastructure and Flow Diagram](#infrastructure-and-flow-diagram)
- [Monorepo Layout](#monorepo-layout)
- [Usage](#usage)
- [Setup](#setup)
- [Makefile](#makefile)## Infrastructure and Flow Diagram
A high-level infrastructure diagram illustrating service integrations and user flows.
![Infrastructure Diagram](docs/assets/infra-diagram.svg)
Learn more infrastructure details from [the documentation](docs/infrastructure.md).
## Monorepo Layout
- [`fe/`](/fe) - Frontend project
- [`infra/`](/infra) - Infrastructure project
- [`e2etest/`](/e2etest) - End-to-end test project
- [`config.json`](/config.json) - Config file
- [`Makefile`](/Makefile) - Task automationsLearn more about monorepo architecture from [the documentation](docs/monorepo.md).
## Usage
1. [Start new repository](https://github.com/new?template_name=tpl-aws-website&template_owner=tsertkov) from this template.
2. Update config.json as necessary.
3. Go through [Setup](#setup) steps.
4. Edit `fe/src` files, `git add`, `git commit`, `git push`, etc.
5. Vaildate `stg` deployment and run `deploy` workflow for `prd` env.## Setup
### Deploy infrastructure
Start with deploying AWS shared resources and deploy infrastructure for `stg` and `prd` environments.
```sh
make infra-deploy-certificate
make infra-deploy-github-oidc
make infra-deploy ENV=stg
make infra-deploy ENV=prd
```Update `s3bucket` and `cloudfrontId` in `config.json` with values returned in stack outputs.
### CI/CD
To enable the deployment workflow, configure the following Environments and Environment Variables in your GitHub repository settings:
- **Environments:**
- `prd` - Production
- `stg` - Staging
- **Environment variables:**
- `AWS_REGION` - AWS region environment is deployed to
- `AWS_ROLE` - AWS CI/CD Role ARNUse `CDRoleArn` value from `infra-deploy` outputs to update `AWS_ROLE` environment variable for a corresponding environment in repository settings.
## Makefile
Use `make` to run tasks in this project:
```sh
make
# Available targets:
# deploy - Build & deploy infrastructure and frontend
# fe-% - Frontend (fe) targets
# infra-% - Infrastructure (infra) targetsmake fe
# Available targets:
# test - test frontend
# build - build frontend
# deploy - deploy frontendmake infra
# Available targets:
# deploy - deploy infrastructure
# deploy-certificate - deploy ACM certificate
# deploy-github-oidc - deploy GitHub OIDC
# test - test infrastructuremake e2etest
# Available targets:
# run - run e2e tests
# init - init dependencies
# init-test - init test dependencies
# test - run tests
# npm-run-% - run any npm script
# npm-% - run any npm command
```