-
Notifications
You must be signed in to change notification settings - Fork 109
Download http-parser from s3 #2872
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,15 +19,41 @@ REGION="$(get_instance_region)" | |
|
|
||
| source /etc/os-release | ||
| OS="${ID}${VERSION_ID}" | ||
| [[ "${OS}" != "amzn2" ]] && echo "[ERROR] Unsupported OS '${OS}'. Configuration supported only on Amazon Linux 2." && exit 1 | ||
|
|
||
| if [[ "${OS}" != "amzn2" && "${OS}" != "amzn2023" ]]; then | ||
| echo "[ERROR] Unsupported OS '${OS}'. Configuration supported only on Amazon Linux 2 and Amazon Linux 2023." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "[INFO] Starting: instance configuration for US isolated region" | ||
|
|
||
| echo "[INFO] Starting: installation of packages from amazon Linux 2 repository for US isolated region" | ||
|
|
||
| REPOSITORY_DEFINITION_FILE="/etc/yum.repos.d/tmp-amzn2-iso.repo" | ||
| REPOSITORY_DEFINITION_FILE="/etc/yum.repos.d/tmp-${OS}-iso.repo" | ||
|
|
||
| if [[ "${OS}" == "amzn2023" ]]; then | ||
| cat > ${REPOSITORY_DEFINITION_FILE} <<REPO_DEFINITION | ||
| [amzn2023-iso] | ||
| name=Amazon Linux 2023 isolated Region repository | ||
| mirrorlist=http://al2023-repos-\$awsregion-de612dc2.s3.\$awsregion.\$awsdomain/core-iso/mirrors/\$releasever/\$basearch/mirror.list | ||
| priority=10 | ||
| enabled=1 | ||
| repo_gpgcheck=0 | ||
| type=rpm | ||
| gpgcheck=0 | ||
| gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2023 | ||
| REPO_DEFINITION | ||
|
|
||
| cat > ${REPOSITORY_DEFINITION_FILE} <<REPO_DEFINITION | ||
| echo "sslverify=0" >> /etc/dnf/dnf.conf | ||
| echo -n "" | sudo tee /etc/dnf/vars/dualstack | ||
| if [[ ${REGION} == us-isob* ]]; then | ||
| dnf install -y amazon-linux-repo-iso ca-certificates-isob | ||
| else | ||
| dnf install -y amazon-linux-repo-iso ca-certificates-iso | ||
| fi | ||
| sed -i "s/sslverify=0//g" /etc/dnf/dnf.conf | ||
| else | ||
| cat > ${REPOSITORY_DEFINITION_FILE} <<REPO_DEFINITION | ||
| [amzn2-iso] | ||
| name=Amazon Linux 2 isolated region repository | ||
| mirrorlist=http://amazonlinux.\$awsregion.\$awsdomain/\$releasever/core-\$awsregion/latest/\$basearch/mirror.list | ||
|
|
@@ -39,30 +65,35 @@ mirrorlist_expire=300 | |
| report_instanceid=yes | ||
| REPO_DEFINITION | ||
|
|
||
| yum --disablerepo="*" --enablerepo="amzn2-iso" install -y "*-${REGION}" | ||
| yum --disablerepo="*" --enablerepo="${OS}-iso" install -y "*-${REGION}" | ||
| fi | ||
|
|
||
| rm -f ${REPOSITORY_DEFINITION_FILE} | ||
|
|
||
| echo "[INFO] Complete: installation of packages from amazon Linux 2 repository for US isolated region" | ||
| echo "[INFO] Complete: installation of packages from ${OS} repository for US isolated region" | ||
|
|
||
| echo "[INFO] Starting: CA bundle configuration for AWS CLI in US isolated region" | ||
|
|
||
| USERS=(<%= @users %>) | ||
| CA_BUNDLE="/etc/pki/${REGION}/certs/ca-bundle.pem" | ||
|
|
||
| for user in "${USERS[@]}"; do | ||
| echo "[INFO] Setting CA bundle ${CA_BUNDLE} for user ${user}" | ||
| sudo mkhomedir_helper $user | ||
| sudo -u $user aws configure set ca_bundle "$CA_BUNDLE" | ||
| done | ||
| sudo aws configure set ca_bundle "$CA_BUNDLE" | ||
|
Comment on lines
-52
to
+79
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this change?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because setting the system wide environment variables make them apply for each user, so it is unneccessary to loop through each user |
||
|
|
||
| echo "[INFO] Complete: CA bundle configuration for AWS CLI in US isolated region" | ||
|
|
||
| echo "[INFO] Starting: Setting system-wide environment variables for AWS CLI in US isolated region" | ||
|
|
||
| echo "export AWS_CA_BUNDLE=/etc/pki/${REGION}/certs/ca-bundle.pem" >> /etc/profile.d/aws-cli-default-config.sh | ||
|
|
||
| echo "export AWS_DEFAULT_REGION=${REGION}" >> /etc/profile.d/aws-cli-default-config.sh | ||
|
|
||
| echo "Defaults env_keep += \"AWS_DEFAULT_REGION AWS_CA_BUNDLE\"" > /etc/sudoers.d/pcluster-aws-cli-envkeep | ||
| echo "export REQUESTS_CA_BUNDLE=${AWS_CA_BUNDLE}" >> /etc/profile.d/aws-cli-default-config.sh | ||
|
|
||
| echo "[INFO] Complete: Setting system-wide environment variables for AWS CLI in US isolated region" | ||
| echo "export SSL_CERT_FILE=${AWS_CA_BUNDLE}" >> /etc/profile.d/aws-cli-default-config.sh | ||
|
|
||
| echo "Defaults env_keep += \"AWS_DEFAULT_REGION AWS_CA_BUNDLE REQUESTS_CA_BUNDLE SSL_CERT_FILE\"" > /etc/sudoers.d/pcluster-aws-cli-envkeep | ||
|
|
||
| echo "[INFO] Complete: instance configuration for US isolated region" | ||
| source /etc/profile.d/aws-cli-default-config.sh | ||
|
|
||
| sudo aws configure set ca_bundle "$CA_BUNDLE" | ||
|
|
||
| echo "[INFO] Complete: Setting system-wide environment variables for AWS CLI in US isolated region" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this command only necessary on amzn2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because for amzn2023 we do
dnf install -y amazon-linux-repo-iso ca-certificates-isobwhich is what is in the documentation. But I kept what we do for amzn2 the same, so that is why they install the region-specific packages differently