Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy to lambdas from cdk #111

Open
wants to merge 84 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
ae78469
add files to try and deploy to ECR/ECS
cszczepaniak Mar 21, 2021
277bf7d
run this manually for now
cszczepaniak Mar 21, 2021
c56fbf9
trigger the pipeline to test it
cszczepaniak Mar 21, 2021
b07e262
create a very naive deployment of the application (that uses an in-me…
cszczepaniak Mar 22, 2021
2a7c157
rip out the old aws stuff in favor of cdk
cszczepaniak Mar 22, 2021
5e97e76
don't hardcode the port anymore; revert the change
cszczepaniak Mar 22, 2021
44ac61e
add an example of how we'd grab the image from docker hub
cszczepaniak Mar 22, 2021
aff4c1e
use env vars for this (duh...)
cszczepaniak Mar 22, 2021
1550043
be more parametric with the REST port
cszczepaniak Mar 23, 2021
2dc172f
clean things up a little
joshprzybyszewski Mar 23, 2021
a96c88b
update the stack a bit
joshprzybyszewski Mar 23, 2021
e0b50fb
break out an RDS stack
joshprzybyszewski Mar 23, 2021
ad023d5
clarify rds
joshprzybyszewski Mar 23, 2021
4e3c907
clean up the cf stack in cdk
joshprzybyszewski Mar 24, 2021
9ddee9e
do things better
joshprzybyszewski Mar 24, 2021
19a2867
ok boomer
joshprzybyszewski Mar 24, 2021
1634b6c
clean clean prod prod
joshprzybyszewski Mar 24, 2021
ee95562
boost logging
joshprzybyszewski Mar 24, 2021
8af122f
simplify the secrets:#
joshprzybyszewski Mar 24, 2021
b30215d
get things hooked up a bit better?
joshprzybyszewski Mar 25, 2021
93e8514
don't expose the rds to the world
joshprzybyszewski Mar 25, 2021
54f7897
update the workflow
joshprzybyszewski Mar 25, 2021
488a7bf
update the workflow
joshprzybyszewski Mar 25, 2021
4a1a2f8
improve the workflow by adding nodejs?
joshprzybyszewski Mar 25, 2021
5087d1f
update where the cdk runs
joshprzybyszewski Mar 25, 2021
2965223
also install typescript
joshprzybyszewski Mar 25, 2021
7fe6af4
move it around
joshprzybyszewski Mar 25, 2021
090afa5
move to infrastructure?
joshprzybyszewski Mar 25, 2021
7e9c01f
who knows
joshprzybyszewski Mar 25, 2021
475c035
npm install
joshprzybyszewski Mar 25, 2021
6cb9db9
try some stuff
cszczepaniak Mar 25, 2021
9ea6dbb
install cdk again
cszczepaniak Mar 25, 2021
5e48c7d
when in doubt, sudo
cszczepaniak Mar 25, 2021
2997865
clean up actions
cszczepaniak Mar 25, 2021
676e5de
remove dep
cszczepaniak Mar 25, 2021
d452d78
point our hz to the lb
cszczepaniak Mar 25, 2021
634ca83
add a prettier config
cszczepaniak Mar 25, 2021
51e4f9c
configure prettier and run it
cszczepaniak Mar 25, 2021
366af61
don't run on PRs
cszczepaniak Mar 25, 2021
5255cdd
lookup by domain name
cszczepaniak Mar 25, 2021
5692cf0
lookup by ID again
cszczepaniak Mar 25, 2021
24ac75d
do it like the internet says
cszczepaniak Mar 25, 2021
6fc0b8b
tag as master even though it's not
joshprzybyszewski Mar 25, 2021
4353f06
remove tags
joshprzybyszewski Mar 25, 2021
7ed1eb0
break out the DNS stack
cszczepaniak Mar 25, 2021
392161f
MAKE THIS COMMIT EASY TO FIND because i'm changing the entire folder …
cszczepaniak Mar 25, 2021
2ad4fa6
fix typo
cszczepaniak Mar 25, 2021
dac1964
fix yaml syntax:
cszczepaniak Mar 25, 2021
556f5cd
point docker to the right place
cszczepaniak Mar 25, 2021
8e82f12
point codecov to the right place
cszczepaniak Mar 25, 2021
98b99d0
fix golangci-lint
cszczepaniak Mar 25, 2021
ccd2730
bump docker action to v2
cszczepaniak Mar 25, 2021
1aad9da
fix warnings
cszczepaniak Mar 25, 2021
fe3fffa
ignore cdk output
cszczepaniak Mar 25, 2021
63e8e6a
configure the environment
cszczepaniak Mar 25, 2021
76a06a1
use docker password
cszczepaniak Mar 25, 2021
a60adf4
revert the file structure
cszczepaniak Mar 26, 2021
515d589
specify environment explicitly
cszczepaniak Mar 26, 2021
f44187f
quick readme fix
cszczepaniak Mar 26, 2021
a8a8c26
ignore cdk.context.json; it's generated
cszczepaniak Mar 26, 2021
7ff5d08
Merge branch 'deployServerToECS' of github.com:joshprzybyszewski/crib…
joshprzybyszewski Oct 10, 2021
2a49e5c
start filling out what's gonna need to be there
joshprzybyszewski Oct 10, 2021
1c072bc
I have no idea what i'm doing
joshprzybyszewski Oct 10, 2021
771bbbc
add a make command
joshprzybyszewski Oct 10, 2021
26786bc
Merge branch 'master' of github.com:joshprzybyszewski/cribbage into d…
joshprzybyszewski Nov 15, 2021
2b0df14
this seems to work better
joshprzybyszewski Nov 15, 2021
dad85d7
make things that are starting to make sense?
joshprzybyszewski Nov 16, 2021
1a83716
I think this works
joshprzybyszewski Nov 16, 2021
5bbd675
kill unused code
joshprzybyszewski Nov 16, 2021
a9e74b8
get most of the api gateway, route53, and stuff hooked up
joshprzybyszewski Nov 16, 2021
351dec6
suggestions
joshprzybyszewski Nov 16, 2021
268715b
add a backdoor for lambdas
joshprzybyszewski Nov 27, 2021
9bd1825
use us-east-1 to gain access to the EDGE
joshprzybyszewski Nov 27, 2021
510f7cc
the s3 bucket is blocked by default
joshprzybyszewski Nov 27, 2021
14d1277
grant access
joshprzybyszewski Nov 27, 2021
f239f84
point it at the lambda
joshprzybyszewski Nov 27, 2021
363533a
do things more better with https
joshprzybyszewski Nov 28, 2021
d09a293
add CORS handling
joshprzybyszewski Nov 28, 2021
95d401f
rename DDBid -> gamesV1
joshprzybyszewski Nov 28, 2021
9a43eb8
Merge branch 'improveThings' of github.com:joshprzybyszewski/cribbage…
joshprzybyszewski Nov 29, 2021
c7dba84
fix logical merge conflicts
joshprzybyszewski Nov 29, 2021
24db49a
use new ID
joshprzybyszewski Nov 29, 2021
bb8d666
Merge branch 'master' of github.com:joshprzybyszewski/cribbage into d…
joshprzybyszewski Nov 29, 2021
5897325
resolve logical merge conflicts
joshprzybyszewski Nov 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/deploy-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Deploy to AWS

on:
pull_request: # for now, trigger this on PR so I can test it before merging
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:badpokerface:

push:
branches:
- master

env:
AWS_REGION: us-east-2

defaults:
run:
shell: bash

jobs:
dockerimage:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this? We're not using a docker image, right?

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Check out code

- uses: docker/build-push-action@v1
name: Build and Push Docker image
with:
repository: joshprzybyszewski/cribbage
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tag_with_ref: true
add_git_labels: true
tag_with_sha: false
cache_froms: joshprzybyszewski/cribbage:master

deploy:
needs: dockerimage
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Install CDK and Stack Dependencies
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Maybe in a future improvement, we could split our frontend/backend CDK stacks and conditionally deploy them in our github actions based on the files touched in a given PR

run: |
sudo npm i -g aws-cdk
cd infrastructure
npm install

- name: Synth CDK
run: |
cd infrastructure
cdk synth
env:
AWS_REGION: ${{ env.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Deploy CDK
run: |
cd infrastructure
cdk deploy --require-approval never "*"
if: github.ref == 'refs/heads/master'
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
17 changes: 0 additions & 17 deletions .github/workflows/go_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,3 @@ jobs:
# env_vars: OS,PYTHON
# name: codecov-umbrella
fail_ci_if_error: true
dockerimage:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Check out code

- uses: docker/build-push-action@v1
name: Build and Push Docker image
with:
repository: joshprzybyszewski/cribbage
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tag_with_ref: true
add_git_labels: true
tag_with_sha: false
cache_froms: joshprzybyszewski/cribbage:latest
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ serve: ## Sets up the server locally with default options
go run -tags=prod main.go --dsn_user="$(DSN_USER)" --dsn_password="$(DSN_PW)" --dsn_host="$(DSN_HOST)"

.PHONY: lambda
lambda:
lambda: ## Builds the app so that we can serve it in a lambda
GOOS=linux CGO_ENABLED=0 go build -o cribbage-lambda -tags=prod main.go
zip cribbage-lambda.zip cribbage-lambda
rm cribbage-lambda
# chmod +r cribbage-lambda.zip

.PHONY: dockerbuild
dockerbuild: ## Builds the docker image
Expand All @@ -65,3 +66,7 @@ wasm: ## Builds the wasm output for the gowasm client
.PHONY: localstack
localstack: ## Runs the app as a local stack in docker-compose
docker-compose up -d cribbage-server

.PHONY: cdk
cdk: ## tries to deploy your app
cd infrastructure && cdk deploy --all
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ make serve
make goclient
```

- From here, you should be directed through the game using [survey](https://github.com/AlecAivazis/survey).
- From here, you should be directed through the game using [survey](https://github.com/AlecAivazis/survey).

Happy Playing!

Expand Down
Loading