You've already forked microservices
mirror of
https://github.com/ebosas/microservices.git
synced 2025-08-24 20:08:55 +02:00
Separate pipelines for each service
This commit is contained in:
@@ -1,16 +0,0 @@
|
|||||||
version: 0.2
|
|
||||||
phases:
|
|
||||||
pre_build:
|
|
||||||
commands:
|
|
||||||
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
|
|
||||||
- TAG=$(echo $GIT_COMMIT_ID | head -c 8)
|
|
||||||
- IMAGE_URI=$REPO_URI:$TAG
|
|
||||||
build:
|
|
||||||
commands:
|
|
||||||
- docker build -t $IMAGE_URI -f server.Dockerfile .
|
|
||||||
post_build:
|
|
||||||
commands:
|
|
||||||
- docker push $IMAGE_URI
|
|
||||||
- printf '{"ImageUri":"%s"}' $IMAGE_URI > build.json
|
|
||||||
artifacts:
|
|
||||||
files: build.json
|
|
@@ -1,22 +0,0 @@
|
|||||||
version: 0.2
|
|
||||||
phases:
|
|
||||||
pre_build:
|
|
||||||
commands:
|
|
||||||
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
|
|
||||||
- TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | head -c 8)
|
|
||||||
- IMAGE_SERVER_URI=$REPO_SERVER_URI:$TAG
|
|
||||||
- IMAGE_CACHE_URI=$REPO_CACHE_URI:$TAG
|
|
||||||
- IMAGE_DB_URI=$REPO_DB_URI:$TAG
|
|
||||||
build:
|
|
||||||
commands:
|
|
||||||
- docker build -t $IMAGE_SERVER_URI -f server.Dockerfile .
|
|
||||||
- docker build -t $IMAGE_CACHE_URI -f cache.Dockerfile .
|
|
||||||
- docker build -t $IMAGE_DB_URI -f database.Dockerfile .
|
|
||||||
post_build:
|
|
||||||
commands:
|
|
||||||
- docker push $IMAGE_SERVER_URI
|
|
||||||
- docker push $IMAGE_CACHE_URI
|
|
||||||
- docker push $IMAGE_DB_URI
|
|
||||||
- printf '{"ImageServerUri":"%s", "ImageCacheUri":"%s", "ImageDatabaseUri":"%s"}' $IMAGE_SERVER_URI $IMAGE_CACHE_URI $IMAGE_DB_URI > build.json
|
|
||||||
artifacts:
|
|
||||||
files: build.json
|
|
@@ -170,15 +170,31 @@ Resources:
|
|||||||
Properties:
|
Properties:
|
||||||
Artifacts:
|
Artifacts:
|
||||||
Type: CODEPIPELINE
|
Type: CODEPIPELINE
|
||||||
ServiceRole: !Ref CodeBuildServiceRole
|
Source:
|
||||||
|
Type: CODEPIPELINE
|
||||||
|
BuildSpec: |
|
||||||
|
version: 0.2
|
||||||
|
phases:
|
||||||
|
pre_build:
|
||||||
|
commands:
|
||||||
|
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
|
||||||
|
- TAG=$(echo $GIT_COMMIT_ID | head -c 8)
|
||||||
|
- IMAGE_URI=$REPO_URI:$TAG
|
||||||
|
build:
|
||||||
|
commands:
|
||||||
|
- docker build -t $IMAGE_URI -f server.Dockerfile .
|
||||||
|
post_build:
|
||||||
|
commands:
|
||||||
|
- docker push $IMAGE_URI
|
||||||
|
- printf '{"ImageUri":"%s"}' $IMAGE_URI > build.json
|
||||||
|
artifacts:
|
||||||
|
files: build.json
|
||||||
Environment:
|
Environment:
|
||||||
ComputeType: BUILD_GENERAL1_SMALL
|
ComputeType: BUILD_GENERAL1_SMALL
|
||||||
Image: aws/codebuild/standard:5.0
|
Image: aws/codebuild/standard:5.0
|
||||||
Type: LINUX_CONTAINER
|
Type: LINUX_CONTAINER
|
||||||
PrivilegedMode: true
|
PrivilegedMode: true
|
||||||
Source:
|
ServiceRole: !Ref CodeBuildServiceRole
|
||||||
Type: CODEPIPELINE
|
|
||||||
BuildSpec: deployments/buildspec/service.yml
|
|
||||||
|
|
||||||
# Create three pipelines for the three services
|
# Create three pipelines for the three services
|
||||||
# Server pipeline
|
# Server pipeline
|
||||||
|
@@ -19,14 +19,20 @@ Resources:
|
|||||||
# Create ECR respositories to hold built docker images
|
# Create ECR respositories to hold built docker images
|
||||||
ServerRepository:
|
ServerRepository:
|
||||||
Type: AWS::ECR::Repository
|
Type: AWS::ECR::Repository
|
||||||
|
DeletionPolicy: Retain
|
||||||
|
UpdateReplacePolicy: Retain
|
||||||
Properties:
|
Properties:
|
||||||
RepositoryName: !Sub ${EnvironmentName}-server
|
RepositoryName: !Sub ${EnvironmentName}-server
|
||||||
CacheRepository:
|
CacheRepository:
|
||||||
Type: AWS::ECR::Repository
|
Type: AWS::ECR::Repository
|
||||||
|
DeletionPolicy: Retain
|
||||||
|
UpdateReplacePolicy: Retain
|
||||||
Properties:
|
Properties:
|
||||||
RepositoryName: !Sub ${EnvironmentName}-cache
|
RepositoryName: !Sub ${EnvironmentName}-cache
|
||||||
DatabaseRepository:
|
DatabaseRepository:
|
||||||
Type: AWS::ECR::Repository
|
Type: AWS::ECR::Repository
|
||||||
|
DeletionPolicy: Retain
|
||||||
|
UpdateReplacePolicy: Retain
|
||||||
Properties:
|
Properties:
|
||||||
RepositoryName: !Sub ${EnvironmentName}-database
|
RepositoryName: !Sub ${EnvironmentName}-database
|
||||||
|
|
||||||
@@ -161,6 +167,8 @@ Resources:
|
|||||||
# While the build is in progress we need a place to store artifacts
|
# While the build is in progress we need a place to store artifacts
|
||||||
ArtifactBucket:
|
ArtifactBucket:
|
||||||
Type: AWS::S3::Bucket
|
Type: AWS::S3::Bucket
|
||||||
|
DeletionPolicy: Retain
|
||||||
|
UpdateReplacePolicy: Retain
|
||||||
Properties:
|
Properties:
|
||||||
BucketName: !Sub ${EnvironmentName}-${AWS::AccountId}
|
BucketName: !Sub ${EnvironmentName}-${AWS::AccountId}
|
||||||
|
|
||||||
@@ -170,15 +178,37 @@ Resources:
|
|||||||
Properties:
|
Properties:
|
||||||
Artifacts:
|
Artifacts:
|
||||||
Type: CODEPIPELINE
|
Type: CODEPIPELINE
|
||||||
ServiceRole: !Ref CodeBuildServiceRole
|
Source:
|
||||||
|
Type: CODEPIPELINE
|
||||||
|
BuildSpec: |
|
||||||
|
version: 0.2
|
||||||
|
phases:
|
||||||
|
pre_build:
|
||||||
|
commands:
|
||||||
|
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
|
||||||
|
- TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | head -c 8)
|
||||||
|
- IMAGE_SERVER_URI=$REPO_SERVER_URI:$TAG
|
||||||
|
- IMAGE_CACHE_URI=$REPO_CACHE_URI:$TAG
|
||||||
|
- IMAGE_DB_URI=$REPO_DB_URI:$TAG
|
||||||
|
build:
|
||||||
|
commands:
|
||||||
|
- docker build -t $IMAGE_SERVER_URI -f server.Dockerfile .
|
||||||
|
- docker build -t $IMAGE_CACHE_URI -f cache.Dockerfile .
|
||||||
|
- docker build -t $IMAGE_DB_URI -f database.Dockerfile .
|
||||||
|
post_build:
|
||||||
|
commands:
|
||||||
|
- docker push $IMAGE_SERVER_URI
|
||||||
|
- docker push $IMAGE_CACHE_URI
|
||||||
|
- docker push $IMAGE_DB_URI
|
||||||
|
- printf '{"ImageServerUri":"%s", "ImageCacheUri":"%s", "ImageDatabaseUri":"%s"}' $IMAGE_SERVER_URI $IMAGE_CACHE_URI $IMAGE_DB_URI > build.json
|
||||||
|
artifacts:
|
||||||
|
files: build.json
|
||||||
Environment:
|
Environment:
|
||||||
ComputeType: BUILD_GENERAL1_SMALL
|
ComputeType: BUILD_GENERAL1_SMALL
|
||||||
Image: aws/codebuild/standard:5.0
|
Image: aws/codebuild/standard:5.0
|
||||||
Type: LINUX_CONTAINER
|
Type: LINUX_CONTAINER
|
||||||
PrivilegedMode: true
|
PrivilegedMode: true
|
||||||
Source:
|
ServiceRole: !Ref CodeBuildServiceRole
|
||||||
Type: CODEPIPELINE
|
|
||||||
BuildSpec: deployments/buildspec/services-all.yml
|
|
||||||
|
|
||||||
# This pipeline defines the steps to build, deploy, and release the application
|
# This pipeline defines the steps to build, deploy, and release the application
|
||||||
Pipeline:
|
Pipeline:
|
||||||
|
@@ -151,7 +151,7 @@ Resources:
|
|||||||
RabbitURLParameter:
|
RabbitURLParameter:
|
||||||
Type: AWS::SSM::Parameter
|
Type: AWS::SSM::Parameter
|
||||||
Properties:
|
Properties:
|
||||||
Name: !Sub /microservices/${EnvironmentName}/rabbiturl
|
Name: /Microservices/RabbitUrl
|
||||||
Type: String
|
Type: String
|
||||||
Description: A connection string for RabbitMQ
|
Description: A connection string for RabbitMQ
|
||||||
Value:
|
Value:
|
||||||
@@ -162,7 +162,7 @@ Resources:
|
|||||||
PostgresURLParameter:
|
PostgresURLParameter:
|
||||||
Type: AWS::SSM::Parameter
|
Type: AWS::SSM::Parameter
|
||||||
Properties:
|
Properties:
|
||||||
Name: !Sub /microservices/${EnvironmentName}/postgresurl
|
Name: /Microservices/PostgresUrl
|
||||||
Type: String
|
Type: String
|
||||||
Description: A connection string for Postgres
|
Description: A connection string for Postgres
|
||||||
Value:
|
Value:
|
||||||
@@ -173,7 +173,7 @@ Resources:
|
|||||||
RedisURLParameter:
|
RedisURLParameter:
|
||||||
Type: AWS::SSM::Parameter
|
Type: AWS::SSM::Parameter
|
||||||
Properties:
|
Properties:
|
||||||
Name: !Sub /microservices/${EnvironmentName}/redisurl
|
Name: /Microservices/RedisUrl
|
||||||
Type: String
|
Type: String
|
||||||
Description: A connection string for Redis
|
Description: A connection string for Redis
|
||||||
Value: !Sub ${Redis.RedisEndpoint.Address}:${Redis.RedisEndpoint.Port}
|
Value: !Sub ${Redis.RedisEndpoint.Address}:${Redis.RedisEndpoint.Port}
|
||||||
|
@@ -68,9 +68,9 @@ Resources:
|
|||||||
awslogs-stream-prefix: !Ref 'ServiceName'
|
awslogs-stream-prefix: !Ref 'ServiceName'
|
||||||
Environment:
|
Environment:
|
||||||
- Name: RABBIT_URL
|
- Name: RABBIT_URL
|
||||||
Value: !Sub '{{resolve:ssm:/microservices/${EnvironmentName}/rabbiturl}}'
|
Value: '{{resolve:ssm:/Microservices/RabbitUrl}}'
|
||||||
- Name: REDIS_URL
|
- Name: REDIS_URL
|
||||||
Value: !Sub '{{resolve:ssm:/microservices/${EnvironmentName}/redisurl}}'
|
Value: '{{resolve:ssm:/Microservices/RedisUrl}}'
|
||||||
|
|
||||||
# The service. The service is a resource which allows you to run multiple
|
# The service. The service is a resource which allows you to run multiple
|
||||||
# copies of a type of task, and gather up their logs and metrics, as well
|
# copies of a type of task, and gather up their logs and metrics, as well
|
||||||
|
@@ -68,9 +68,9 @@ Resources:
|
|||||||
awslogs-stream-prefix: !Ref 'ServiceName'
|
awslogs-stream-prefix: !Ref 'ServiceName'
|
||||||
Environment:
|
Environment:
|
||||||
- Name: RABBIT_URL
|
- Name: RABBIT_URL
|
||||||
Value: !Sub '{{resolve:ssm:/microservices/${EnvironmentName}/rabbiturl}}'
|
Value: '{{resolve:ssm:/Microservices/RabbitUrl}}'
|
||||||
- Name: POSTGRES_URL
|
- Name: POSTGRES_URL
|
||||||
Value: !Sub '{{resolve:ssm:/microservices/${EnvironmentName}/postgresurl}}'
|
Value: '{{resolve:ssm:/Microservices/PostgresUrl}}'
|
||||||
|
|
||||||
# The service. The service is a resource which allows you to run multiple
|
# The service. The service is a resource which allows you to run multiple
|
||||||
# copies of a type of task, and gather up their logs and metrics, as well
|
# copies of a type of task, and gather up their logs and metrics, as well
|
||||||
|
@@ -86,9 +86,9 @@ Resources:
|
|||||||
awslogs-stream-prefix: !Ref 'ServiceName'
|
awslogs-stream-prefix: !Ref 'ServiceName'
|
||||||
Environment:
|
Environment:
|
||||||
- Name: RABBIT_URL
|
- Name: RABBIT_URL
|
||||||
Value: !Sub '{{resolve:ssm:/microservices/${EnvironmentName}/rabbiturl}}'
|
Value: '{{resolve:ssm:/Microservices/RabbitUrl}}'
|
||||||
- Name: REDIS_URL
|
- Name: REDIS_URL
|
||||||
Value: !Sub '{{resolve:ssm:/microservices/${EnvironmentName}/redisurl}}'
|
Value: '{{resolve:ssm:/Microservices/RedisUrl}}'
|
||||||
- Name: SERVER_ADDR
|
- Name: SERVER_ADDR
|
||||||
Value: 0.0.0.0:80
|
Value: 0.0.0.0:80
|
||||||
|
|
||||||
|
@@ -73,9 +73,9 @@ Resources:
|
|||||||
awslogs-stream-prefix: !Ref 'ServiceName'
|
awslogs-stream-prefix: !Ref 'ServiceName'
|
||||||
Environment:
|
Environment:
|
||||||
- Name: RABBIT_URL
|
- Name: RABBIT_URL
|
||||||
Value: !Sub '{{resolve:ssm:/microservices/${EnvironmentName}/rabbiturl}}'
|
Value: '{{resolve:ssm:/Microservices/RabbitUrl}}'
|
||||||
- Name: REDIS_URL
|
- Name: REDIS_URL
|
||||||
Value: !Sub '{{resolve:ssm:/microservices/${EnvironmentName}/redisurl}}'
|
Value: '{{resolve:ssm:/Microservices/RedisUrl}}'
|
||||||
|
|
||||||
# The service. The service is a resource which allows you to run multiple
|
# The service. The service is a resource which allows you to run multiple
|
||||||
# copies of a type of task, and gather up their logs and metrics, as well
|
# copies of a type of task, and gather up their logs and metrics, as well
|
||||||
|
@@ -73,9 +73,9 @@ Resources:
|
|||||||
awslogs-stream-prefix: !Ref 'ServiceName'
|
awslogs-stream-prefix: !Ref 'ServiceName'
|
||||||
Environment:
|
Environment:
|
||||||
- Name: RABBIT_URL
|
- Name: RABBIT_URL
|
||||||
Value: !Sub '{{resolve:ssm:/microservices/${EnvironmentName}/rabbiturl}}'
|
Value: '{{resolve:ssm:/Microservices/RabbitUrl}}'
|
||||||
- Name: POSTGRES_URL
|
- Name: POSTGRES_URL
|
||||||
Value: !Sub '{{resolve:ssm:/microservices/${EnvironmentName}/postgresurl}}'
|
Value: '{{resolve:ssm:/Microservices/PostgresUrl}}'
|
||||||
|
|
||||||
# The service. The service is a resource which allows you to run multiple
|
# The service. The service is a resource which allows you to run multiple
|
||||||
# copies of a type of task, and gather up their logs and metrics, as well
|
# copies of a type of task, and gather up their logs and metrics, as well
|
||||||
|
@@ -91,9 +91,9 @@ Resources:
|
|||||||
awslogs-stream-prefix: !Ref 'ServiceName'
|
awslogs-stream-prefix: !Ref 'ServiceName'
|
||||||
Environment:
|
Environment:
|
||||||
- Name: RABBIT_URL
|
- Name: RABBIT_URL
|
||||||
Value: !Sub '{{resolve:ssm:/microservices/${EnvironmentName}/rabbiturl}}'
|
Value: '{{resolve:ssm:/Microservices/RabbitUrl}}'
|
||||||
- Name: REDIS_URL
|
- Name: REDIS_URL
|
||||||
Value: !Sub '{{resolve:ssm:/microservices/${EnvironmentName}/redisurl}}'
|
Value: '{{resolve:ssm:/Microservices/RedisUrl}}'
|
||||||
- Name: SERVER_ADDR
|
- Name: SERVER_ADDR
|
||||||
Value: 0.0.0.0:80
|
Value: 0.0.0.0:80
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user