-
Notifications
You must be signed in to change notification settings - Fork 9
Add arm64 support
#45
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
69bf93a
Add ARM64 support
dmehala ef007f3
resolve docker compose services ahead of time
dgoffredo 2b0e810
Apply suggestions from code review
dmehala 7d616ed
Apply suggestions from code review
dmehala 8473561
code review
dmehala 7e23079
code review
dmehala File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,23 @@ | ||
| #!/bin/sh | ||
|
|
||
| set -e | ||
|
|
||
| case "$(uname -m)" in | ||
| aarch64) | ||
| ARCH="arm64" | ||
| ;; | ||
| *) | ||
| ARCH="$(uname -m)" | ||
| ;; | ||
| esac | ||
|
|
||
| apk update | ||
| apk add wget tar curl jq | ||
|
|
||
| # grpcurl is a self-contained binary (Go program) | ||
| GRPCURL_TAR="grpcurl_1.8.6_linux_${ARCH}.tar.gz" | ||
|
|
||
| cd /tmp | ||
| wget https://github.com/fullstorydev/grpcurl/releases/download/v1.8.6/grpcurl_1.8.6_linux_x86_64.tar.gz | ||
| tar -xzf grpcurl_1.8.6_linux_x86_64.tar.gz | ||
| wget https://github.com/fullstorydev/grpcurl/releases/download/v1.8.6/"${GRPCURL_TAR}" | ||
| tar -xzf "${GRPCURL_TAR}" | ||
| mv grpcurl /usr/local/bin | ||
| rm grpcurl_1.8.6_linux_x86_64.tar.gz | ||
| rm "${GRPCURL_TAR}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,61 +1,92 @@ | ||
| #!/bin/sh | ||
| # Set up the nginx container image. Install nginx, if necessary, and install the nginx-datadog module. | ||
|
|
||
| set -x | ||
| set -e | ||
|
|
||
| is_installed() { | ||
| command -v "$1" > /dev/null 2>&1 | ||
| } | ||
|
|
||
| get_latest_release() { | ||
| curl --silent "https://api.github.com/repos/$1/releases/latest" | jq --raw-output .tag_name | ||
| } | ||
|
|
||
| if [ "$BASE_IMAGE" = '' ]; then | ||
| >&2 echo 'This script expects BASE_IMAGE to be in the environment, e.g. "nginx:1.23.1-alpine" or "amazonlinux:2.0.20220121.0".' | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Fail fast in case the base image is not supported. | ||
| # For now, we only support nginx, nginx-alpine, and amazonlinux images. | ||
| case "$BASE_IMAGE" in | ||
| amazonlinux:*) nginx_modules_path=/usr/share/nginx/modules ;; | ||
| *) nginx_modules_path=/usr/lib/nginx/modules ;; | ||
| amazonlinux:*) | ||
| nginx_modules_path=/usr/share/nginx/modules | ||
| ;; | ||
| nginx:*) | ||
| nginx_modules_path=/usr/lib/nginx/modules | ||
| ;; | ||
| *) | ||
| >&2 printf 'BASE_IMAGE value "%s" is invalid. See nginx-version-info.example for more information.\n' "$BASE_IMAGE" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| # If nginx itself is not installed already, then install it. | ||
| if ! command -v nginx >/dev/null 2>&1; then | ||
| if command -v apt-get >/dev/null 2>&1; then | ||
| apt-get update | ||
| DEBIAN_FRONTEND=noninteractive apt-get install -y nginx | ||
| elif command -v apk >/dev/null 2>&1; then | ||
| apk update | ||
| apk add nginx | ||
| elif command -v yum >/dev/null 2>&1; then | ||
| yum update -y | ||
| amazon-linux-extras enable -y nginx1 | ||
| yum install -y nginx | ||
| else | ||
| >&2 printf 'Did not find a supported package manager.\n' | ||
| exit 2 | ||
| fi | ||
| fi | ||
| ARCH="$(uname -m)" | ||
| case "$ARCH" in | ||
| aarch64) | ||
| ARCH="arm64" | ||
| ;; | ||
| x86_64) | ||
| ARCH="amd64" | ||
| ;; | ||
| *) | ||
| >&2 echo "Platform ${BASE_IMAGE}-${ARCH} is not supported." | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| # Install the command line tools needed to fetch and extract the module. | ||
| # `apt-get` (Debian, Ubuntu), `apk` (Alpine), and `yum` (Amazon Linux) are | ||
| # supported. | ||
| if command -v apt-get >/dev/null 2>&1; then | ||
| if is_installed apt-get; then | ||
| apt-get update | ||
| DEBIAN_FRONTEND=noninteractive apt-get install -y tar wget curl jq | ||
| elif command -v apk >/dev/null 2>&1; then | ||
| elif is_installed apk; then | ||
| apk update | ||
| apk add tar wget curl jq | ||
| elif command -v yum >/dev/null 2>&1; then | ||
| elif is_installed yum; then | ||
| yum update -y | ||
| yum install -y tar wget curl jq | ||
| else | ||
| >&2 printf 'Did not find a supported package manager.\n' | ||
| exit 3 | ||
| fi | ||
|
|
||
| get_latest_release() { | ||
| curl --silent "https://api.github.com/repos/$1/releases/latest" | jq --raw-output .tag_name | ||
| } | ||
| # If nginx itself is not installed already, then install it. | ||
| if ! is_installed nginx; then | ||
| if is_installed apt-get; then | ||
| apt-get update | ||
| DEBIAN_FRONTEND=noninteractive apt-get install -y nginx | ||
| elif is_installed apk; then | ||
| apk update | ||
| apk add nginx | ||
| elif is_installed yum; then | ||
| yum update -y | ||
| amazon-linux-extras enable -y nginx1 | ||
| yum install -y nginx | ||
| else | ||
| >&2 printf 'Did not find a supported package manager.\n' | ||
| exit 2 | ||
| fi | ||
| fi | ||
|
|
||
| # TODO(@dmehala): nginx version can be different from the base image | ||
| RELEASE_TAG=$(get_latest_release DataDog/nginx-datadog) | ||
|
|
||
| base_image_without_colons=$(echo "$BASE_IMAGE" | tr ':' '_') | ||
| tarball="$base_image_without_colons-ngx_http_datadog_module.so.tgz" | ||
| tarball="${base_image_without_colons}-${ARCH}-ngx_http_datadog_module.so.tgz" | ||
|
|
||
| wget "https://github.com/DataDog/nginx-datadog/releases/download/$RELEASE_TAG/$tarball" | ||
| tar -xzf "$tarball" -C "$nginx_modules_path" | ||
| rm "$tarball" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.