This application is a very basic application, that provides a ready-to-use project setup for the Mira accelerator.
The successful deployment of this project will create an S3 bucket with web hosting enabled and a single index.html file in it, which will output a 'hello world' message.
This sample app is recommended primarily for evaluation purposes, and project owners who want the benefits of Mira CI orchestration but wish to make a clean start with their project.
-
Generate your own project repository from this repo mira-sample-s3-webhosting
⚠️ Remember to make your new repository 🕵🏻♀️ Private as you store potentially sensitive information in the Mira configuration files. -
Clone your newly created repository
-
Ensure that you are using Node.js v12 (v14 should work too, but is untested here):
% node --version v12.21.0
or, if using [nvm]:
% nvm use Now using node v12.21.0 (npm v6.14.11)
-
Install the required dependencies
Make sure you use the supported version of the CDK (1.89.0) and all the required dependencies are included in your package.json file. See the Mira documentation for the full list.
Note: It is a known constraint of CDK that the usage of its version number must be exact. Range operators for the version will cause your sample to break, e.g.
^1.89.0
is not the same as1.89.0
. -
Build
npm run build
-
Set up your config file
cp config/default.sample.json config/default.json
-
Adjust
config/default.json
with your settings- Update the app and dev sections with your desired values e.g.:
"app": { "prefix": "big-company", "name": "super-app" }, "dev": { "target": "default" }
- Update the
accounts
section to at least include settings for yourdefault
(name specified as a target indev
section) deployment e.g.:"accounts": { "default": { "env": { "account": "11111111111", "region": "eu-west-1" }, "profile": "mira-dev" } }
- Update the app and dev sections with your desired values e.g.:
-
If you are working as part of a team, create a
config/dev.json
file and provide your own app settings e.g.:"app": { "prefix": "john", "name": "super-app" }
Note:
config/dev.json
file is specific to your personal setup and should not be tracked in GIT. -
Bootstrap AWS CDK on the target AWS account and region, i.e.:
cdk bootstrap aws://YOUR_NUMBER/YOUR_REGION --profile YOUR_PROFILE
Note: If CDK is already bootstrapped, you can skip this step.
-
Deploy
npm run deploy
Note: The default tags will be associated to that stack: StackName, CreatedBy (Owner) and CostCenter (If defined).
At this step you should have your development environment deployed and ready to use.
-
(Optional) Setup CI
See the quickstart section of the Mira documentation for details.
Note: If also setting up CI, then be aware that, by default, repository mirroring is disabled. Go to
.github/workflows/mirror.yml
and follow the comment there.
Run npx mira docs
and navigate to http://localhost:3000/ for more information about Mira.
Note: The default port may be already taken; if the above website is not available then please check your terminal logs for the correct address.
infra/src/index.ts
- your stack definition.infra/src/permissions.ts
- your stack with IAM permissions needed to deploy the app with CI.infra/src/buildspec.yaml
- Build specification reference for CodeBuild.config/default.sample.json
- example configuration file (rename to default.json to use)config/dev.json
- local development configuration file that overrides default.json.