Merge pull request #28 from rstudio/chore-staging

add staging env
This commit is contained in:
Steve Nolen 2019-08-16 12:08:35 -04:00 committed by GitHub
commit 52e3795f27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 2598 additions and 488 deletions

2
Jenkinsfile vendored
View file

@ -35,7 +35,7 @@ pipeline {
branch 'master' branch 'master'
} }
steps { steps {
sh 'make serverless-deploy' sh 'make serverless-deploy.production'
} }
} }
} }

View file

@ -33,7 +33,7 @@ fetch-serverless-custom-file:
rebuild-all: deps fetch-serverless-custom-file rebuild-all: deps fetch-serverless-custom-file
$(SLS_BINARY) invoke stepf -n rBuilds -d '{"force": true}' $(SLS_BINARY) invoke stepf -n rBuilds -d '{"force": true}'
serverless-deploy: deps fetch-serverless-custom-file serverless-deploy.%: deps fetch-serverless-custom-file
$(SLS_BINARY) deploy --stage dev $(SLS_BINARY) deploy --stage $*
.PHONY: deps docker-build docker-push docker-down docker-build-package docker-shell-package-env ecr-login fetch-serverless-custom-file serverless-deploy .PHONY: deps docker-build docker-push docker-down docker-build-package docker-shell-package-env ecr-login fetch-serverless-custom-file serverless-deploy

3057
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -4,6 +4,7 @@
"version": "0.1.0", "version": "0.1.0",
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"serverless": "^1.42.3",
"serverless-pseudo-parameters": "^2.2.0", "serverless-pseudo-parameters": "^2.2.0",
"serverless-python-requirements": "^4.2.5", "serverless-python-requirements": "^4.2.5",
"serverless-step-functions": "^1.8.0" "serverless-step-functions": "^1.8.0"

View file

@ -71,8 +71,19 @@ rBuildsEcsTaskIamRole:
Action: Action:
- s3:* - s3:*
Resource: Resource:
- arn:aws:s3:::${self:custom.s3Bucket} - arn:aws:s3:::${self:custom.${self:provider.stage}.s3Bucket}
- arn:aws:s3:::${self:custom.s3Bucket}/* - arn:aws:s3:::${self:custom.${self:provider.stage}.s3Bucket}/*
rBuildsEcsLaunchTemplate:
Type: AWS::EC2::LaunchTemplate
Properties:
LaunchTemplateName: r-builds-${self:provider.stage}-batch-managed-ecs-larger-volume
LaunchTemplateData:
BlockDeviceMappings:
- DeviceName: /dev/xvdcz
Ebs:
VolumeType: gp2
VolumeSize: 64
rBuildsBatchComputeEnvironment: rBuildsBatchComputeEnvironment:
Type: AWS::Batch::ComputeEnvironment Type: AWS::Batch::ComputeEnvironment
@ -82,12 +93,15 @@ rBuildsBatchComputeEnvironment:
ServiceRole: ServiceRole:
"Fn::GetAtt": [ rBuildsBatchIamRole, Arn ] "Fn::GetAtt": [ rBuildsBatchIamRole, Arn ]
ComputeResources: ComputeResources:
LaunchTemplate:
LaunchTemplateId:
Ref: rBuildsEcsLaunchTemplate
SpotIamFleetRole: SpotIamFleetRole:
"Fn::GetAtt": [ rBuildsSpotFleetIamRole, Arn ] "Fn::GetAtt": [ rBuildsSpotFleetIamRole, Arn ]
SecurityGroupIds: ${self:custom.securityGroupIds} SecurityGroupIds: ${self:custom.securityGroupIds}
Subnets: ${self:custom.subnets} Subnets: ${self:custom.subnets}
Type: SPOT Type: SPOT
BidPercentage: 40 BidPercentage: 60
InstanceRole: InstanceRole:
"Fn::GetAtt": [ rBuildsIamInstanceProfile, Arn ] "Fn::GetAtt": [ rBuildsIamInstanceProfile, Arn ]
InstanceTypes: InstanceTypes:
@ -231,6 +245,7 @@ rBuildsEventRule:
Properties: Properties:
Description: Check for New R Versions Description: Check for New R Versions
ScheduleExpression: rate(1 hour) ScheduleExpression: rate(1 hour)
State: ${self:custom.${self:provider.stage}.eventRuleState}
Targets: Targets:
- Id: rbuilds - Id: rbuilds
Input: '{}' Input: '{}'

View file

@ -1,6 +1,7 @@
rBuilds: rBuilds:
Comment: "R Builds" Comment: "R Builds"
id: RBuildsStepFunction id: RBuildsStepFunction
name: r-builds-${self:provider.stage}
definition: definition:
StartAt: QueueBuilds StartAt: QueueBuilds
States: States:

View file

@ -7,17 +7,19 @@ plugins:
custom: ${file(./serverless-custom.yml)} custom: ${file(./serverless-custom.yml)}
package: package:
exclude: exclude:
- integration/** - integration/**
- builder/** - builder/**
- docs/** - docs/**
- node_modules/**
provider: provider:
name: aws name: aws
runtime: python3.6 runtime: python3.6
stage: ${opt:stage, self:custom.defaultStage}
deploymentBucket: deploymentBucket:
name: ${self:custom.deploymentBucket} name: ${self:custom.deploymentBucket}
stackTags: ${self:custom.stackTags} stackTags: ${self:custom.${self:provider.stage}.stackTags}
iamRoleStatements: iamRoleStatements:
- Effect: Allow - Effect: Allow
Action: Action:
@ -27,10 +29,10 @@ provider:
Action: Action:
- "s3:*" - "s3:*"
Resource: Resource:
- arn:aws:s3:::${self:custom.s3Bucket} - arn:aws:s3:::${self:custom.${self:provider.stage}.s3Bucket}
- arn:aws:s3:::${self:custom.s3Bucket}/* - arn:aws:s3:::${self:custom.${self:provider.stage}.s3Bucket}/*
environment: environment:
S3_BUCKET: ${self:custom.s3Bucket} S3_BUCKET: ${self:custom.${self:provider.stage}.s3Bucket}
JOB_QUEUE_ARN: JOB_QUEUE_ARN:
Ref: rBuildsBatchJobQueue Ref: rBuildsBatchJobQueue
JOB_DEFINITION_ARN_ubuntu_1604: JOB_DEFINITION_ARN_ubuntu_1604: