add microservice definitions to repo

This commit is contained in:
keyan 2024-01-30 18:23:46 -06:00
parent 61c64646b5
commit 31cdf572fb
5 changed files with 162 additions and 0 deletions

1
copilot/.workspace Normal file
View File

@ -0,0 +1 @@
application: stackernews

View File

@ -0,0 +1,56 @@
# The manifest for the "capture" service.
# Read the full specification for the "Load Balanced Web Service" type at:
# https://aws.github.io/copilot-cli/docs/manifest/lb-web-service/
# Your service name will be used in naming your resources like log groups, ECS services, etc.
name: capture
type: Load Balanced Web Service
# Distribute traffic to your service.
http:
# Requests to this path will be forwarded to your service.
# To match all requests you can use the "/" path.
path: '/'
# You can specify a custom health check path. The default is "/".
# healthcheck: '/'
# Configuration for your containers and service.
image:
# Docker build arguments. For additional overrides: https://aws.github.io/copilot-cli/docs/manifest/lb-web-service/#image-build
build: capture/Dockerfile
# Port exposed through your container to route traffic to it.
port: 5678
cpu: 1024 # Number of CPU units for the task.
memory: 2048 # Amount of memory in MiB used by the task.
platform: linux/x86_64 # See https://aws.github.io/copilot-cli/docs/manifest/lb-web-service/#platform
count:
range:
min: 1 # Minimum number of tasks to run for the service.
max: 3 # Maximum number of tasks to run for the service.
cooldown:
in: 60s # Number of seconds to wait before scaling up.
out: 60s # Number of seconds to wait before scaling down.
cpu_percentage: 50 # Percentage of CPU to target for autoscaling.
memory_percentage: 60 # Percentage of memory to target for autoscaling.
exec: true # Enable running commands in your container.
network:
connect: true # Enable Service Connect for intra-environment traffic between services.
# storage:
# readonly_fs: true # Limit to read-only access to mounted root filesystems.
# Optional fields for more advanced use-cases.
#
variables: # Pass environment variables as key value pairs.
CAPTURE_URL: https://stacker.news/
#secrets: # Pass secrets from AWS Systems Manager (SSM) Parameter Store.
# GITHUB_TOKEN: GITHUB_TOKEN # The key is the name of the environment variable, the value is the name of the SSM parameter.
# You can override any of the values defined above by environment.
#environments:
# test:
# count: 2 # Number of tasks to run for the "test" environment.
# deployment: # The deployment strategy for the "test" environment.
# rolling: 'recreate' # Stops existing tasks before new ones are started for faster deployments.

View File

@ -0,0 +1,21 @@
# The manifest for the "capture" environment.
# Read the full specification for the "Environment" type at:
# https://aws.github.io/copilot-cli/docs/manifest/environment/
# Your environment name will be used in naming your resources like VPC, cluster, etc.
name: capture
type: Environment
# Import your own VPC and subnets or configure how they should be created.
# network:
# vpc:
# id:
# Configure the load balancers in your environment, once created.
# http:
# public:
# private:
# Configure observability for your environment resources.
observability:
container_insights: false

View File

@ -0,0 +1,21 @@
# The manifest for the "imgproxy" environment.
# Read the full specification for the "Environment" type at:
# https://aws.github.io/copilot-cli/docs/manifest/environment/
# Your environment name will be used in naming your resources like VPC, cluster, etc.
name: imgproxy
type: Environment
# Import your own VPC and subnets or configure how they should be created.
# network:
# vpc:
# id:
# Configure the load balancers in your environment, once created.
# http:
# public:
# private:
# Configure observability for your environment resources.
observability:
container_insights: true

View File

@ -0,0 +1,63 @@
# The manifest for the "imgproxy" service.
# Read the full specification for the "Load Balanced Web Service" type at:
# https://aws.github.io/copilot-cli/docs/manifest/lb-web-service/
# Your service name will be used in naming your resources like log groups, ECS services, etc.
name: imgproxy
type: Load Balanced Web Service
# Distribute traffic to your service.
http:
# Requests to this path will be forwarded to your service.
# To match all requests you can use the "/" path.
path: '/'
# You can specify a custom health check path. The default is "/".
healthcheck: '/health'
# Configuration for your containers and service.
image:
location: ${PRIVATE_REPO}/imgproxy:v3.21.0-ml-amd64
# Port exposed through your container to route traffic to it.
port: 8080
cpu: 2048 # 2 vCPUs see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-cpu-memory-error.html
memory: 4096
count:
range:
min: 1 # Minimum number of tasks to run for the service.
max: 4 # Maximum number of tasks to run for the service.
cooldown:
in: 60s # Number of seconds to wait before scaling up.
out: 60s # Number of seconds to wait before scaling down.
cpu_percentage: 50 # Percentage of CPU to target for autoscaling.
memory_percentage: 60 # Percentage of memory to target for autoscaling.
exec: true # Enable running commands in your container.
network:
connect: true # Enable Service Connect for intra-environment traffic between services.
# storage:
# readonly_fs: true # Limit to read-only access to mounted root filesystems.
# Optional fields for more advanced use-cases.
variables: # Pass environment variables as key value pairs.
IMGPROXY_ENABLE_WEBP_DETECTION: 1
IMGPROXY_ENABLE_AVIF_DETECTION: 1
IMGPROXY_MAX_ANIMATION_FRAMES: 2000
IMGPROXY_MAX_SRC_RESOLUTION: 50
IMGPROXY_MAX_ANIMATION_FRAME_RESOLUTION: 200
IMGPROXY_READ_TIMEOUT: 10
IMGPROXY_WRITE_TIMEOUT: 10
IMGPROXY_DOWNLOAD_TIMEOUT: 9
IMGPROXY_WORKERS: 4
secrets: # Pass secrets from AWS Systems Manager (SSM) Parameter Store.
IMGPROXY_KEY: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/imgproxy_key
IMGPROXY_SALT: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/imgproxy_salt
IMGPROXY_LICENSE_KEY: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/imgproxy_license_key
# You can override any of the values defined above by environment.
#environments:
# test:
# count: 2 # Number of tasks to run for the "test" environment.
# deployment: # The deployment strategy for the "test" environment.
# rolling: 'recreate' # Stops existing tasks before new ones are started for faster deployments.