You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: posts/2023-10-07-the-stack-part-1.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,6 +92,7 @@ Now that we are ready, a high-level overview of the steps we will be taking are:
92
92
The first screen you'll meet wants you to review various infomration and pricing as well as choose a few defaults. We are going to change some of the values:
93
93
94
94
-**Region deny setting**: Choose `Enabled` for this. We want to make sure that Control Tower is governing our accounts and resources.
95
+
- We will need `us-east-1` for certain "global" resources, so we'll add that to the list of allowed regions along with your desired region.
@@ -532,7 +533,7 @@ Push your project to GitHub. You now have access to the workflows and can trigge
532
533
If you haven't done it already, let's run the `Deployment: Bootstrap` workflow first, to set up CDK on all accounts. Alternatively, jump to the section [Manual alternative: Bootstrapping our Accounts](#manual-alternative-bootstrapping-our-accounts) for how to do this manually.
533
534
534
535
<div style="text-align:center;">
535
-
<a href="/resources/images/the-stack-part-2-trigger-bootstrap-workflow.png" target="_blank" rel="noopener noreferrer"><img src="/resources/images/the-stack-part-2-trigger-bootstrap-workflow.thumbnail.png" loading="lazy" alt="Manually trigger the bootstrap workflow" title="Manually trigger the bootstrap workflow" width="80%%" /></a>
536
+
<a href="/resources/images/the-stack-part-2-trigger-bootstrap-workflow.png" target="_blank" rel="noopener noreferrer"><img src="/resources/images/the-stack-part-2-trigger-bootstrap-workflow.thumbnail.png" loading="lazy" alt="Manually trigger the bootstrap workflow" title="Manually trigger the bootstrap workflow" width="80%" /></a>
536
537
</div>
537
538
538
539
Next up, before we initiate the deployment it's recommended to be logged into your Domain Registrar that controls the DNS of your domain, so that you can quickly update your name servers to point to the Hosted Zone that we will be creating. This is necessary to DNS validate our ACM certificates.
@@ -611,6 +612,81 @@ $ DOMAIN="app.example.com" bun run cdk deploy --concurrency 4 'Cloud' 'Cloud/**'
611
612
The `DOMAIN` environment variable is required here, since we need to know what domain we should use for the Hosted Zone.
612
613
613
614
615
+
## Bonus: Just
616
+
617
+
It might seem overkill right now, but we will eventually have many different commands across many folder locations in our mono-repo setup. To make this a bit easier to work with, we can use the tool [Just](https://github.com/casey/just) to help us out.
618
+
619
+
From `just`'s README:
620
+
621
+
> `just` is a handy way to save and run project-specific commands
622
+
623
+
From [the installation instructions](https://github.com/casey/just#packages) we can install it via:
624
+
625
+
```bash
626
+
# macOS:
627
+
$ brew install just
628
+
# Linux with prebuilt-mpr (https://docs.makedeb.org/prebuilt-mpr/getting-started/#setting-up-the-repository):
629
+
$ sudo apt install just
630
+
# Prebuilt binaries (assuming $HOME/.local/bin is in your $PATH):
This allows us to set up a `justfile` in the root of our project, which we can then use to define shortcuts to our commands. For example, we can define a shortcut to run our CDK commands:
635
+
636
+
```makefile
637
+
# Display help information.
638
+
help:
639
+
@ just --list
640
+
641
+
# Setup dependencies and tooling for <project>, e.g. `just setup deployment`.
642
+
setup project:
643
+
just _setup-{{project}}
644
+
645
+
_setup-deployment:
646
+
#!/usr/bin/env bash
647
+
set -euxo pipefail
648
+
cd deployment
649
+
bun install
650
+
651
+
# Deploy the specified <stack>, e.g. `just deploy Cloud`, defaulting to --all.
652
+
deploy stack='--all':
653
+
#!/usr/bin/env bash
654
+
set -euxo pipefail
655
+
cd deployment
656
+
bun run cdk deploy --concurrency 4 --require-approval never {{ if stack == "--all" { "--all" } else { stack } }}
657
+
658
+
# Run tests for <project>, e.g. `just test deployment`.
659
+
test project:
660
+
just _test-{{project}}
661
+
662
+
_test-deployment:
663
+
#!/usr/bin/env bash
664
+
set -euxo pipefail
665
+
cd deployment
666
+
bun test
667
+
668
+
_test-synth:
669
+
#!/usr/bin/env bash
670
+
set -euxo pipefail
671
+
cd deployment
672
+
bun run cdk synth --all
673
+
```
674
+
675
+
We can now run our commands via `just`:
676
+
677
+
```bash
678
+
# Setup our dependencies:
679
+
$ just setup deployment
680
+
# Run tests:
681
+
$ just test deployment
682
+
# Synthesize our CDK stack:
683
+
$ just test synth
684
+
# Deploy our CDK stack:
685
+
$ just deploy # or just deploy Cloud
686
+
```
687
+
688
+
689
+
614
690
## Next Steps
615
691
616
692
Next up is to add our first Frontend! Follow along in Part 3 of the series (will be posted soon).
0 commit comments