diff --git a/.github/workflows/switch.yml b/.github/workflows/switch.yml index 20e1fbd23..703333510 100644 --- a/.github/workflows/switch.yml +++ b/.github/workflows/switch.yml @@ -59,7 +59,7 @@ jobs: [ { "identifier": "switch-staging", - "branch": "develop", + "branch": "set_min_buffer_on_mod_twilio_stream", "image_tag": "staging", "ecs_service": "switch-staging", "ecs_cluster": "somleng-switch-staging" @@ -135,9 +135,6 @@ jobs: run: | components/freeswitch/bin/export_tts_voices > components/freeswitch/conf/autoload_configs/tts_voices.xml - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -161,7 +158,7 @@ jobs: build-args: signalwire_token=${{ secrets.SIGNALWIRE_TOKEN }} push: true - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 cache-from: type=gha,scope=${{ matrix.identifier }}-freeswitch cache-to: type=gha,mode=max,scope=${{ matrix.identifier }}-freeswitch tags: | @@ -174,7 +171,7 @@ jobs: with: context: components/freeswitch_event_logger push: true - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 cache-from: type=gha,scope=${{ matrix.identifier }}-freeswitch-event-logger cache-to: type=gha,mode=max,scope=${{ matrix.identifier }}-freeswitch-event-logger tags: | @@ -187,7 +184,7 @@ jobs: with: context: components/app push: true - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 cache-from: type=gha,scope=${{ matrix.identifier }} cache-to: type=gha,mode=max,scope=${{ matrix.identifier }} tags: | diff --git a/components/freeswitch/Dockerfile b/components/freeswitch/Dockerfile index 372d19d3d..d9d4b7013 100644 --- a/components/freeswitch/Dockerfile +++ b/components/freeswitch/Dockerfile @@ -1,4 +1,4 @@ -FROM public.ecr.aws/debian/debian:bookworm-slim as freeswitch-build +FROM public.ecr.aws/docker/library/debian:bookworm-slim as freeswitch-build ARG signalwire_token RUN apt update && apt install --no-install-recommends -yq cmake gcc g++ make cmake build-essential git libssl-dev libspeex-dev libspeexdsp-dev @@ -6,6 +6,7 @@ RUN apt update && apt install --no-install-recommends -yq cmake gcc g++ make cma RUN apt-get update && apt-get install --no-install-recommends -yq gnupg2 wget ca-certificates lsb-release && \ wget --http-user=signalwire --http-password=${signalwire_token} -O /usr/share/keyrings/signalwire-freeswitch-repo.gpg https://freeswitch.signalwire.com/repo/deb/debian-release/signalwire-freeswitch-repo.gpg && \ echo "machine freeswitch.signalwire.com login signalwire password ${signalwire_token}" > /etc/apt/auth.conf && \ + chmod 600 /etc/apt/auth.conf && \ echo "deb [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/debian-release/ `lsb_release -sc` main" > /etc/apt/sources.list.d/freeswitch.list && \ echo "deb-src [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/debian-release/ `lsb_release -sc` main" >> /etc/apt/sources.list.d/freeswitch.list && \ apt-get update --allow-releaseinfo-change && \ @@ -20,15 +21,16 @@ RUN cmake .. RUN make RUN make install -FROM public.ecr.aws/aws-cli/aws-cli as aws-cli +FROM public.ecr.aws/aws-cli/aws-cli:latest as aws-cli -FROM public.ecr.aws/debian/debian:bookworm-slim +FROM public.ecr.aws/docker/library/debian:bookworm-slim ARG signalwire_token RUN apt-get update && apt-get install --no-install-recommends -yq libssl-dev libspeex-dev libspeexdsp-dev gnupg2 wget ca-certificates lsb-release && \ wget --http-user=signalwire --http-password=${signalwire_token} -O /usr/share/keyrings/signalwire-freeswitch-repo.gpg https://freeswitch.signalwire.com/repo/deb/debian-release/signalwire-freeswitch-repo.gpg && \ echo "machine freeswitch.signalwire.com login signalwire password ${signalwire_token}" > /etc/apt/auth.conf && \ + chmod 600 /etc/apt/auth.conf && \ echo "deb [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/debian-release/ `lsb_release -sc` main" > /etc/apt/sources.list.d/freeswitch.list && \ echo "deb-src [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/debian-release/ `lsb_release -sc` main" >> /etc/apt/sources.list.d/freeswitch.list && \ apt-get update --allow-releaseinfo-change && \ diff --git a/components/gateway/Dockerfile b/components/gateway/Dockerfile index 4e01de624..726aa9e04 100644 --- a/components/gateway/Dockerfile +++ b/components/gateway/Dockerfile @@ -1,12 +1,12 @@ # https://apt.opensips.org/packages.php?os=bookworm -FROM public.ecr.aws/debian/debian:bookworm-slim AS bootstrap +FROM public.ecr.aws/docker/library/debian:bookworm-slim AS bootstrap USER root ENV DEBIAN_FRONTEND noninteractive -ARG OPENSIPS_VERSION=3.3 +ARG OPENSIPS_VERSION=3.4 ARG OPENSIPS_BUILD=releases RUN apt-get -y update -qq && apt-get -y install gnupg2 ca-certificates curl && \ @@ -30,13 +30,13 @@ CMD ["create_db"] # Build -FROM public.ecr.aws/debian/debian:bookworm-slim AS build +FROM public.ecr.aws/docker/library/debian:bookworm-slim AS build USER root ENV DEBIAN_FRONTEND noninteractive -ARG OPENSIPS_VERSION=3.3 +ARG OPENSIPS_VERSION=3.4 ARG OPENSIPS_BUILD=releases RUN apt-get -y update -qq && apt-get -y install gnupg2 ca-certificates iproute2 curl netcat-traditional jq && \ diff --git a/components/media_proxy/Dockerfile b/components/media_proxy/Dockerfile index 3b981a9d2..5a149fcd4 100644 --- a/components/media_proxy/Dockerfile +++ b/components/media_proxy/Dockerfile @@ -1,4 +1,4 @@ -FROM public.ecr.aws/debian/debian:bookworm-slim +FROM public.ecr.aws/docker/library/debian:bookworm-slim USER root diff --git a/docker-compose.yml b/docker-compose.yml index faa65ff45..8c554725b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -91,7 +91,6 @@ services: build: context: components/freeswitch image: freeswitch:latest - platform: linux/amd64 extra_hosts: - "host.docker.internal:host-gateway" environment: @@ -128,7 +127,6 @@ services: build: context: components/app image: switch-app:latest - platform: linux/amd64 depends_on: redis: condition: service_healthy diff --git a/infrastructure/core/codebuild.tf b/infrastructure/core/codebuild.tf index cc36d2c40..612daa0d4 100644 --- a/infrastructure/core/codebuild.tf +++ b/infrastructure/core/codebuild.tf @@ -22,7 +22,7 @@ resource "aws_iam_role" "codebuild" { data "aws_iam_policy_document" "codebuild" { statement { - effect = "Allow" + effect = "Allow" resources = [ "arn:aws:logs:*:*:log-group:/aws/codebuild/${local.codebuild_identifier}*", @@ -48,7 +48,7 @@ resource "aws_iam_role_policy_attachment" "codebuild_ecr_public" { } resource "aws_codebuild_project" "amd64" { - name = "${local.codebuild_identifier}-amd64" + name = "${local.codebuild_identifier}-amd64" service_role = aws_iam_role.codebuild.arn @@ -62,20 +62,20 @@ resource "aws_codebuild_project" "amd64" { } environment { - compute_type = "BUILD_GENERAL1_SMALL" - image = "aws/codebuild/amazonlinux2-x86_64-standard:5.0" - type = "LINUX_CONTAINER" + compute_type = "BUILD_GENERAL1_SMALL" + image = "aws/codebuild/amazonlinux2-x86_64-standard:5.0" + type = "LINUX_CONTAINER" privileged_mode = true } source { - type = "GITHUB" + type = "GITHUB" location = "https://github.com/somleng/somleng-switch.git" } } resource "aws_codebuild_project" "arm64" { - name = "${local.codebuild_identifier}-arm64" + name = "${local.codebuild_identifier}-arm64" service_role = aws_iam_role.codebuild.arn @@ -89,14 +89,14 @@ resource "aws_codebuild_project" "arm64" { } environment { - compute_type = "BUILD_GENERAL1_SMALL" - image = "aws/codebuild/amazonlinux2-aarch64-standard:3.0" - type = "ARM_CONTAINER" + compute_type = "BUILD_GENERAL1_SMALL" + image = "aws/codebuild/amazonlinux2-aarch64-standard:3.0" + type = "ARM_CONTAINER" privileged_mode = true } source { - type = "GITHUB" + type = "GITHUB" location = "https://github.com/somleng/somleng-switch.git" } } diff --git a/infrastructure/modules/somleng_switch/switch.tf b/infrastructure/modules/somleng_switch/switch.tf index 2c8eb3bfe..0afb8e99a 100644 --- a/infrastructure/modules/somleng_switch/switch.tf +++ b/infrastructure/modules/somleng_switch/switch.tf @@ -9,6 +9,8 @@ module "switch_container_instances" { app_identifier = var.switch_identifier vpc = var.vpc + architecture = "arm64" + instance_type = "t4g.small" instance_subnets = var.vpc.private_subnets cluster_name = aws_ecs_cluster.cluster.name max_capacity = var.switch_max_tasks * 2