Skip to content

Commit

Permalink
Update with the contents of Chapter 6
Browse files Browse the repository at this point in the history
  • Loading branch information
7pairs committed Aug 29, 2019
1 parent 83f7605 commit 2826dd1
Show file tree
Hide file tree
Showing 14 changed files with 643 additions and 0 deletions.
423 changes: 423 additions & 0 deletions etc/06.00_pipeline.json

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions etc/06.03_bucket-policy-staging.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadForGetBucketObjects",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::<REPLACE YOUR BUCKET NAME!!!!!>/*"
}
]
}
13 changes: 13 additions & 0 deletions etc/06.07_deploy-assume-role-policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "codepipeline.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
36 changes: 36 additions & 0 deletions etc/06.08_deploy-policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"codecommit:CancelUploadArchive",
"codecommit:GetBranch",
"codecommit:GetCommit",
"codecommit:GetUploadArchiveStatus",
"codecommit:UploadArchive"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"codebuild:BatchGetBuilds",
"codebuild:StartBuild"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"s3:GetObject",
"s3:GetObjectVersion",
"s3:GetBucketVersioning",
"s3:CreateBucket",
"s3:PutObject",
"s3:PutBucketVersioning"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
13 changes: 13 additions & 0 deletions etc/06.09_build-assume-role-policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "codebuild.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
25 changes: 25 additions & 0 deletions etc/06.10_build-policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:GetObject",
"s3:GetObjectVersion",
"s3:PutObject",
"s3:ListAllMyBuckets",
"s3:ListBucket"
],
"Resource": "arn:aws:s3:::*",
"Effect": "Allow"
},
{
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
62 changes: 62 additions & 0 deletions etc/06.11_pipeline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"pipeline": {
"roleArn": "<REPLACE YOUR ROLE ARN!!!!!>",
"stages": [
{
"name": "Source",
"actions": [
{
"inputArtifacts": [],
"name": "Source",
"actionTypeId": {
"category": "Source",
"owner": "AWS",
"version": "1",
"provider": "CodeCommit"
},
"outputArtifacts": [
{
"name": "SourceRepo"
}
],
"configuration": {
"BranchName": "master",
"RepositoryName": "<REPLACE YOUR REPOSITORY NAME!!!!!>"
},
"runOrder": 1
}
]
},
{
"name": "Build",
"actions": [
{
"inputArtifacts": [
{
"name": "SourceRepo"
}
],
"name": "CodeBuild",
"actionTypeId": {
"category": "Build",
"owner": "AWS",
"version": "1",
"provider": "CodeBuild"
},
"outputArtifacts": [],
"configuration": {
"ProjectName": "hobopy-frontend-build"
},
"runOrder": 1
}
]
}
],
"artifactStore": {
"type": "S3",
"location": "<REPLACE YOUR BUCKET NAME!!!!!>"
},
"name": "hobopy-frontend-pipeline",
"version": 1
}
}
19 changes: 19 additions & 0 deletions etc/06.12_project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "<REPLACE YOUR REPOSITORY NAME!!!!!>",
"description": "ほぼPyフロントエンドのビルド",
"source": {
"type": "CODEPIPELINE"
},
"artifacts": {
"type": "CODEPIPELINE"
},
"cache": {
"type": "NO_CACHE"
},
"serviceRole": "<REPLACE YOUR ROLE ARN!!!!!>",
"environment": {
"type": "LINUX_CONTAINER",
"image": "aws/codebuild/standard:2.0",
"computeType": "BUILD_GENERAL1_SMALL"
}
}
2 changes: 2 additions & 0 deletions hobopy-backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.chalice/deployments/
.chalice/venv/
__pycache__/

14 changes: 14 additions & 0 deletions hobopy-backend/buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 0.1
phases:
install:
commands:
- sudo pip install --upgrade awscli
- aws --version
- sudo pip install 'chalice>=1.9.0,<1.10.0'
- sudo pip install -r requirements.txt
- chalice package /tmp/packaged --stage prod
- aws cloudformation package --template-file /tmp/packaged/sam.json --s3-bucket ${APP_S3_BUCKET} --output-template-file transformed.yaml
artifacts:
type: zip
files:
- transformed.yaml
2 changes: 2 additions & 0 deletions hobopy-frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__target__/
deploy/
15 changes: 15 additions & 0 deletions hobopy-frontend/buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 0.2
phases:
install:
runtime-versions:
python: 3.7
java: openjdk11
commands:
- pip install --upgrade awscli
- pip install -r requirements.txt
- mv const-staging.py const.py
- transcrypt -b hobopy-frontend
- mkdir -p deploy/__target__
- cp -p index.html deploy/
- cp -p __target__/*.js deploy/__target__/
- aws s3 sync deploy s3://hobopy-frontend-staging
2 changes: 2 additions & 0 deletions hobopy-frontend/const-staging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ToDo: ステージング環境のAPIのURLに変更してください。
BASE_URL = 'https://stagingapi.execute-api.ap-northeast-1.amazonaws.com/api/'
5 changes: 5 additions & 0 deletions hobopy-frontend/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mypy==0.720
mypy-extensions==0.4.1
Transcrypt==3.7.16
typed-ast==1.4.0
typing-extensions==3.7.4

0 comments on commit 2826dd1

Please sign in to comment.