Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[deploy] Allow for arm64 #3400

Draft
wants to merge 80 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
2fa8685
Update installer docs, comments, pw
imnasnainaec Oct 7, 2024
d10e3b1
Merge branch 'master' into installer
imnasnainaec Oct 7, 2024
7b93e42
Remove reference to long-gone script
imnasnainaec Oct 7, 2024
1cae5cf
Starting allowing for arm64
imnasnainaec Oct 7, 2024
9bb2118
Fix _/- error
imnasnainaec Oct 7, 2024
8ad50e7
[Docker] Move away from legacy ENV assigment
imnasnainaec Oct 8, 2024
d9c194e
[build] Clean up --quiet usage
imnasnainaec Oct 8, 2024
d055b66
Clean up comments
imnasnainaec Oct 8, 2024
cde7859
[setup_combine] Add --debug logging
imnasnainaec Oct 8, 2024
70394dd
Fix comments re The Combine
imnasnainaec Oct 8, 2024
2c9cfbd
Merge branch 'master' into installer
imnasnainaec Oct 8, 2024
5e2cadd
Merge branch 'installer' into arm
imnasnainaec Oct 9, 2024
c69987b
Change linux_arch to cpu_arch
imnasnainaec Oct 9, 2024
a6b2aa9
Toxy wants a cracker
imnasnainaec Oct 9, 2024
0cb248e
Allow package_k3s with arm
imnasnainaec Oct 9, 2024
c74138a
Merge branch 'master' into arm
imnasnainaec Oct 10, 2024
95a7237
Use --dependency-update; Add debugging; Remove junk dirs
imnasnainaec Oct 10, 2024
9326b14
Fix redundant debugging
imnasnainaec Oct 11, 2024
17e70fb
Revert README
imnasnainaec Oct 11, 2024
7af5386
Fix variable name
imnasnainaec Oct 11, 2024
6ccbf7d
Condense and cleanup README for PDF readability
imnasnainaec Oct 11, 2024
828134d
Merge branch 'installer-2' into arm
imnasnainaec Oct 11, 2024
a385286
Merge branch 'master' into installer-2
imnasnainaec Oct 11, 2024
c654e0b
Tidy
imnasnainaec Oct 11, 2024
d9a496a
More arm stuff
imnasnainaec Oct 11, 2024
18e355c
Tox-ify
imnasnainaec Oct 11, 2024
3d462b4
Merge branch 'installer-2' into arm
imnasnainaec Oct 11, 2024
ac94b9a
Merge branch 'master' into arm
imnasnainaec Oct 15, 2024
993cbb2
Set up Buildx in workflows for multi-platform builds
imnasnainaec Oct 15, 2024
a1a3dff
Debug
imnasnainaec Oct 15, 2024
03b8dca
Add registry-1.docker.io:443 to backend endpoints
imnasnainaec Oct 15, 2024
c398900
Try with QEMU
imnasnainaec Oct 15, 2024
fc58d55
Try more things
imnasnainaec Oct 15, 2024
81a8c65
Shuffle
imnasnainaec Oct 15, 2024
f86d2e5
Another backend endpoint
imnasnainaec Oct 15, 2024
c6d47f6
FROM --platform=
imnasnainaec Oct 16, 2024
8d191fb
Add docker debugging
imnasnainaec Oct 16, 2024
ba465fd
Try without QEMU and with more debugging
imnasnainaec Oct 16, 2024
d46c7a3
Restore QEMU
imnasnainaec Oct 16, 2024
15f4e55
List docker images
imnasnainaec Oct 16, 2024
87fe952
Simplify build_cmd construction
imnasnainaec Oct 21, 2024
7332e5e
Merge branch 'master' into arm
imnasnainaec Oct 24, 2024
84acfc6
Fix build.py docker debugging
imnasnainaec Oct 24, 2024
0ac5834
Use --load with docker build
imnasnainaec Oct 24, 2024
1ca51d3
Try --push instead of --load
imnasnainaec Oct 24, 2024
300605b
Try single-platform builds; only do multiplatform for the repo push
imnasnainaec Oct 24, 2024
1329012
Make tox happier
imnasnainaec Oct 24, 2024
9940617
Remove unnecessary QEMU, buildx
imnasnainaec Oct 24, 2024
ab59191
Try to deploy to QA
imnasnainaec Oct 24, 2024
330a07e
Add multiplatform to action
imnasnainaec Oct 25, 2024
ebedce3
Default to local arch
imnasnainaec Oct 25, 2024
845cbb5
Start restoring normality
imnasnainaec Oct 25, 2024
aea9b4d
More restoration
imnasnainaec Oct 25, 2024
b708408
Cleanup workflows
imnasnainaec Oct 25, 2024
fddf9bb
Update installer arch/arm arguments
imnasnainaec Oct 25, 2024
d905beb
See if --platform is necessary
imnasnainaec Oct 25, 2024
c595f89
Try qa deploy w/o QEMU
imnasnainaec Oct 25, 2024
4c08fdb
Change some info to debug
imnasnainaec Oct 29, 2024
6577f59
Merge branch 'master' into arm
imnasnainaec Oct 30, 2024
9aba448
Try updated arch-tagged images
imnasnainaec Nov 7, 2024
f899f90
Merge branch 'arm' of https://github.com/sillsdev/TheCombine into arm
imnasnainaec Nov 7, 2024
2660f70
Add aws endpoint
imnasnainaec Nov 7, 2024
062f8b3
Add cloudfront endpoint
imnasnainaec Nov 7, 2024
67a0ac1
More build experiments
imnasnainaec Nov 8, 2024
9159582
Merge branch 'master' into arm
imnasnainaec Nov 8, 2024
681e957
Focus build experiments on maintenance
imnasnainaec Nov 8, 2024
dcdeb55
Take 3
imnasnainaec Nov 8, 2024
bd12bf2
Add ports.ubuntu.com endpoint
imnasnainaec Nov 8, 2024
9be4711
Try to do more fully emulated builds
imnasnainaec Nov 8, 2024
a5bd077
Use QEMU
imnasnainaec Nov 8, 2024
f99cbf0
Re-add endpoint
imnasnainaec Nov 8, 2024
7230848
Use buildx for multiplatform build
imnasnainaec Nov 8, 2024
8fabe32
Re-add another endpoint
imnasnainaec Nov 8, 2024
2966dff
Merge branch 'master' into arm
imnasnainaec Nov 8, 2024
e76d356
Use BUILDPLATFORM just for backend builder
imnasnainaec Nov 12, 2024
29095e9
Add helm value for cpuArch
imnasnainaec Nov 13, 2024
3fd2eb2
Update buildx action from v2 to v3
imnasnainaec Nov 13, 2024
28a2ced
Merge branch 'master' into arm
imnasnainaec Nov 15, 2024
a7b7140
Add endpoint to deploy_release that was added to deploy_qa
imnasnainaec Nov 15, 2024
0a47553
Merge branch 'master' into arm
imnasnainaec Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/actions/combine-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,13 @@ runs:
username: ${{ inputs.aws_access_key_id }}
password: ${{ inputs.aws_secret_access_key }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build The Combine
run: >
deploy/scripts/build.py
--arch amd64 arm64
--components ${{ inputs.build_component }}
--tag ${{ env.IMAGE_TAG }}
--repo ${{ inputs.image_registry }}${{ inputs.image_registry_alias}}
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ jobs:
docker_build:
if: ${{ github.event.type }} == "PullRequest"
runs-on: ubuntu-22.04
strategy:
matrix:
arch: ["amd64", "arm64"]
steps:
# See https://docs.stepsecurity.io/harden-runner/getting-started/ for instructions on
# configuring harden-runner and identifying allowed endpoints.
Expand All @@ -156,10 +159,14 @@ jobs:
*.symcb.com:80
api.nuget.org:443
archive.ubuntu.com:80
auth.docker.io:443
dc.services.visualstudio.com:443
deb.debian.org:80
github.com:443
mcr.microsoft.com:443
ports.ubuntu.com:80
production.cloudflare.docker.com:443
registry-1.docker.io:443
security.ubuntu.com:80
ts-crl.ws.symantec.com:80
# For subfolders, currently a full checkout is required.
Expand All @@ -168,11 +175,9 @@ jobs:
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build backend
run: |
deploy/scripts/build.py --components backend
shell: bash
- name: Image digest
run: |
docker image inspect combine_backend:latest -f '{{json .Id}}'
deploy/scripts/build.py --components backend --arch ${{ matrix.arch }}
shell: bash
11 changes: 6 additions & 5 deletions .github/workflows/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
docker_build:
if: ${{ github.event.type }} == "PullRequest"
runs-on: ubuntu-22.04
strategy:
matrix:
arch: ["amd64", "arm64"]
steps:
# See https://docs.stepsecurity.io/harden-runner/getting-started/ for instructions on
# configuring harden-runner and identifying allowed endpoints.
Expand All @@ -30,11 +33,9 @@ jobs:
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build database image
run: |
deploy/scripts/build.py --components database
shell: bash
- name: Image digest
run: |
docker image inspect combine_database:latest -f '{{json .Id}}'
deploy/scripts/build.py --components database --arch ${{ matrix.arch }}
shell: bash
3 changes: 2 additions & 1 deletion .github/workflows/deploy_qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "Deploy Update to QA Server"

on:
push:
branches: [master]
branches: [arm, master]

permissions:
contents: read
Expand Down Expand Up @@ -42,6 +42,7 @@ jobs:
files.pythonhosted.org:443
github.com:443
mcr.microsoft.com:443
ports.ubuntu.com:80
production.cloudflare.docker.com:443
public.ecr.aws:443
pypi.org:443
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
github.com:443
mcr.microsoft.com:443
production.cloudflare.docker.com:443
ports.ubuntu.com:80
public.ecr.aws:443
pypi.org:443
registry-1.docker.io:443
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ jobs:
docker_build:
if: ${{ github.event.type }} == "PullRequest"
runs-on: ubuntu-22.04
strategy:
matrix:
arch: ["amd64", "arm64"]
steps:
# See https://docs.stepsecurity.io/harden-runner/getting-started/ for instructions on
# configuring harden-runner and identifying allowed endpoints.
Expand All @@ -123,6 +126,7 @@ jobs:
auth.docker.io:443
files.pythonhosted.org:443
github.com:443
ports.ubuntu.com:80
production.cloudflare.docker.com:443
pypi.org:443
registry-1.docker.io:443
Expand All @@ -131,11 +135,9 @@ jobs:
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build frontend
run: |
deploy/scripts/build.py --components frontend
shell: bash
- name: Image digest
run: |
docker image inspect combine_frontend:latest -f '{{json .Id}}'
deploy/scripts/build.py --components frontend --arch ${{ matrix.arch }}
shell: bash
12 changes: 7 additions & 5 deletions .github/workflows/maintenance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
docker_build:
if: ${{ github.event.type }} == "PullRequest"
runs-on: ubuntu-22.04
strategy:
matrix:
arch: ["amd64", "arm64"]
steps:
# See https://docs.stepsecurity.io/harden-runner/getting-started/ for instructions on
# configuring harden-runner and identifying allowed endpoints.
Expand All @@ -25,6 +28,7 @@ jobs:
auth.docker.io:443
files.pythonhosted.org:443
github.com:443
ports.ubuntu.com:80
production.cloudflare.docker.com:443
public.ecr.aws:443
pypi.org:443
Expand All @@ -36,11 +40,9 @@ jobs:
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build maintenance image
run: |
deploy/scripts/build.py --components maintenance
shell: bash
- name: Image digest
run: |
docker image inspect combine_maint:latest -f '{{json .Id}}'
deploy/scripts/build.py --components maintenance --arch ${{ matrix.arch }}
shell: bash
7 changes: 3 additions & 4 deletions Backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
############################################################

# Docker multi-stage build
FROM mcr.microsoft.com/dotnet/sdk:8.0.404-jammy AS builder
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0.404-jammy AS builder
WORKDIR /app

# Copy csproj and restore (fetch dependencies) as distinct layers.
Expand All @@ -33,8 +33,7 @@ ENV APP_FILES=${HOME}/.CombineFiles

# Install system dependencies.
RUN apt-get update \
&& apt-get install -y \
ffmpeg \
&& apt-get install -y ffmpeg \
&& rm -rf /var/lib/apt/lists/*

# Create the home directory for the new app user.
Expand All @@ -47,7 +46,7 @@ RUN usermod --uid 999 --gid app \
--comment "Docker image user" \
app

## Set up application install directory.
# Set up application install directory.
RUN mkdir $APP_HOME && \
mkdir $APP_FILES && \
# Give access to the entire home folder so the backend can create files and folders there.
Expand Down
4 changes: 3 additions & 1 deletion deploy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
# Supported Platforms:
# - Intel/AMD 64-bit
# - ARM 64-bit
############################################################

FROM ubuntu:22.04
Expand All @@ -16,7 +17,8 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/*

# Install kubectl and helm
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \
RUN MACH=$(case $(uname -m) in *86*) echo amd64;; *aarch*) echo arm64;; *arm*) echo arm64;; esac) && \
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${MACH}/kubectl" && \
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 && \
chmod 700 get_helm.sh && \
Expand Down
13 changes: 11 additions & 2 deletions deploy/scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ def parse_args() -> Namespace:
description="Build containerd container images for project.",
formatter_class=RawFormatter,
)
parser.add_argument(
"--arch",
choices=["amd64", "arm64"],
default=[],
help="Target cpu architecture(s).",
nargs="*",
)
parser.add_argument(
"--build-args", nargs="*", help="Build arguments to pass to the docker build."
)
Expand Down Expand Up @@ -270,10 +277,12 @@ def main() -> None:
if args.debug:
container_cmd.extend(["-D", "-l", "debug"])
build_cmd = container_cmd + ["buildx", "build"]
push_cmd = container_cmd + ["push"]
build_cmd.append("--load" if args.repo is None else "--push")
case _:
logging.critical(f"Container CLI '{container_cmd[0]}' is not supported.")
sys.exit(1)
if len(args.arch):
build_cmd.extend(["--platform", ",".join([f"linux/{arch}" for arch in args.arch])])

# Setup build options
if args.quiet:
Expand Down Expand Up @@ -306,7 +315,7 @@ def main() -> None:
job_set[component] = JobQueue(component, debug=args.debug)
logging.debug(f"Adding job {build_cmd + job_opts}")
job_set[component].add_job(Job(build_cmd + job_opts, spec.dir))
if args.repo is not None:
if args.repo is not None and container_cmd[0] == "nerdctl":
logging.debug(f"Adding job {push_cmd + [image_name]}")
job_set[component].add_job(Job(push_cmd + [image_name], None))
logging.info(f"Building component {component}")
Expand Down
23 changes: 19 additions & 4 deletions deploy/scripts/install-combine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,16 @@ install-kubernetes () {
# Setup Kubernetes environment and WiFi Access Point
cd ${DEPLOY_DIR}/ansible

# Set -e/--extra-vars for ansible-playbook
EXTRA_VARS="-e k8s_user=${whoami}"
if [ -d "${DEPLOY_DIR}/airgap-images" ] ; then
ansible-playbook playbook_desktop_setup.yml -K -e k8s_user=`whoami` -e install_airgap_images=true $(((DEBUG == 1)) && echo "-vv")
else
ansible-playbook playbook_desktop_setup.yml -K -e k8s_user=`whoami` $(((DEBUG == 1)) && echo "-vv")
EXTRA_VARS="${EXTRA_VARS} -e install_airgap_images=true"
fi
if [ $ARM == 1 ] ; then
EXTRA_VARS="${EXTRA_VARS} -e cpu_arch=arm64"
fi

ansible-playbook playbook_desktop_setup.yml -K ${EXTRA_VARS} $(((DEBUG == 1)) && echo "-vv")
}

# Set the KUBECONFIG environment variable so that the cluster can
Expand Down Expand Up @@ -138,7 +143,13 @@ install-the-combine () {
cd ${DEPLOY_DIR}/scripts
set-combine-env
set-k3s-env
./setup_combine.py --tag ${COMBINE_VERSION} --repo public.ecr.aws/thecombine --target desktop ${SETUP_OPTS} $(((DEBUG == 1)) && echo "--debug")
./setup_combine.py \
$(((DEBUG == 1)) && echo "--debug") \
--repo public.ecr.aws/thecombine \
$(((ARM == 1)) && echo "--set global.cpuArch=arm64" ) \
--tag ${COMBINE_VERSION} \
--target desktop \
${SETUP_OPTS}
deactivate
}

Expand Down Expand Up @@ -193,6 +204,7 @@ CONFIG_DIR=${HOME}/.config/combine
mkdir -p ${CONFIG_DIR}
SINGLE_STEP=0
IS_SERVER=0
ARM=0
DEBUG=0

# See if we need to continue from a previous install
Expand All @@ -207,6 +219,9 @@ fi
while (( "$#" )) ; do
OPT=$1
case $OPT in
arm)
ARM=1
;;
clean)
next-state "Pre-reqs"
if [ -f ${CONFIG_DIR}/env ] ; then
Expand Down
Loading
Loading