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

Slow Startup RiB Container on Apple M1 #928

Open
chrisage opened this issue Mar 9, 2023 · 7 comments
Open

Slow Startup RiB Container on Apple M1 #928

chrisage opened this issue Mar 9, 2023 · 7 comments
Assignees
Labels
CI Relating to the CI system (Github Actions) enhancement Improvements to an existing feature github_actions Pull requests that update GitHub Actions code rack-box Relating to the RACK-box images releases Relating to the release process

Comments

@chrisage
Copy link
Contributor

chrisage commented Mar 9, 2023

Background:
The rack-box docker image is only built for linux/amd64 OS/ARCH resulting in slow startup times on Apple Silicone (tested on M1) - requesting RiB docker image distribution for linux/arm64

Acceptance Criteria:
Integrate aarch64 RIB image creation & deployment process to github action

Implementation Details:
Modify the github action to push an aarch64 docker image on release -
https://github.com/ge-high-assurance/RACK/blob/master/.github/workflows/release.yml

The base docker image (ubuntu) should be updated to aarch64 @ https://hub.docker.com/_/ubuntu

Add another builder to the https://github.com/ge-high-assurance/RACK/blob/ff93cbacd621838bfd765a7e4492f56bbca5f0b2/rack-box/rack-box-docker.json#L11C12-L11C12 packer file. Ref packer docker builder documentation

    {
      "type": "docker",
      "changes": [
        "ENTRYPOINT [ \"/usr/bin/python3\", \"/usr/bin/systemctl\" ]"
      ],
      "commit": true,
      "image": "arm64v8/ubuntu:22.04",
      "platform": "linux/arm64/v8",
      "pull": false
    }
@chrisage chrisage added the enhancement Improvements to an existing feature label Mar 9, 2023
@glguy
Copy link
Contributor

glguy commented Mar 10, 2023

RACK without a native build on M1 macOS is basically unusable for the production ingestion package. I've been using a locally packed docker image against the arm64v8/ubuntu:22.04 base image and it's working great. I don't know how to automate the construction of that using Github actions, myself, however.

@chrisage chrisage reopened this Jul 26, 2023
@chrisage chrisage self-assigned this Jul 26, 2023
@chrisage chrisage added releases Relating to the release process rack-box Relating to the RACK-box images labels Jul 26, 2023
@chrisage chrisage linked a pull request Jul 26, 2023 that will close this issue
@chrisage
Copy link
Contributor Author

chrisage commented Aug 14, 2023

Arm64 images must be built using the same OS/arch.

The rack-box files include x86 specific files (python) and cannot be reused. Removed:

Test dependency architecture compatibility prior to modifying the github build action:
1.) Run the Build Virtual Machine workflow
2.) Download the rack-box-files zip, unzip it in your RACK/rack-box/files
3.) Run the packer command

GitHub arch provision action (qemu with docker buildx):

@chrisage
Copy link
Contributor Author

chrisage commented Aug 16, 2023

The build process for arch64 requires an arch64 github action runner that can only be configured as a standalone runner. Instead you can build the docker image locally on an arch64 machine. The main difference between arch builds is the base docker image used and python dependencies (the packer process expects dependencies to be mounted into the image as a volume).

To build arch64 RACK Image locally (requires arch64 machine):

  1. Update the RACK/rack-box/rack-box-docker.json builder to "platform": "linux/arm64/v8", and pull: true
  2. Download the installation package (files) from the latest successful GitHub action
  3. Expanded the downloaded files directory and copy to RACK/rack-box/files
  4. Rebuild & Replace the rack-cli.tar.gz file (needed for arch specific python deps):
    a. cd /RACK/cli
    b. change the PyYaml rep in requirements.txt to v6.0.1
    c. install reqs with pip3 wheel --wheel-dir=wheels -r requirements.txt
    d. delete all installed wheels from ./wheels except for the semtk-python library
    e. remove the semtk-python library req from requirements.txt
    ^ the above steps are required to avoid dependency on git
    f. zip entire cli library into RACK/rack-box/files place: tar -zcvf rack-cli.tar.gz ./RACK/
    g. modify the RACK/rack-box/install.sh script to build the RACK CLI with:
    # under cd "/home/${USER}/RACK/cli/"
    pip3 wheel --wheel-dir=wheels -r requirements.txt
    pip3 wheel --wheel-dir=wheels .
  5. Re-run packer build rack-box-docker.json from RACK/rack-box

@chrisage
Copy link
Contributor Author

@tuxji
Copy link
Contributor

tuxji commented Aug 16, 2023

I understand we cannot automate the CI build of an arch64 RACK image except on an arch64 github action runner, which would have to be a standalone (self-hosted) machine available somewhere on the Internet. Still, you can build the arch64 RACK image manually on a Mac M1 computer using the installation package (files) from the latest successful GitHub action. If you can push the built image to Docker Hub as well (it should be just a matter of granting your account the necessary privilege), then RACK users will be able to download and run the appropriate image for their architecture.

@chrisage chrisage added wontfix/unplanned Things that we don't plan to work on currently. github_actions Pull requests that update GitHub Actions code CI Relating to the CI system (Github Actions) and removed wontfix/unplanned Things that we don't plan to work on currently. labels Aug 17, 2023
@chrisage
Copy link
Contributor Author

chrisage commented Aug 17, 2023

Another option might be to use docker's buildx command (referenced in an earlier comment) but this might require overhaul of the CI/CD action.

Docker Docs:
https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/

Targeting for post-release. blocked on cost of running standalone || time for CI/CD development

@glguy
Copy link
Contributor

glguy commented Aug 18, 2023

I haven't automated the process, but when we make the next release I can build a docker image to update for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Relating to the CI system (Github Actions) enhancement Improvements to an existing feature github_actions Pull requests that update GitHub Actions code rack-box Relating to the RACK-box images releases Relating to the release process
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants