Skip to content

Commit

Permalink
DIGITAL-359: Implement New Relic.
Browse files Browse the repository at this point in the history
  • Loading branch information
casey-rapnicki-bixal committed Feb 11, 2025
1 parent 3763370 commit e4bc1cf
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 23 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/cloudgov-deploy-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ jobs:
- name: Deploy App
env:
PROJECT: "${{ secrets.PROJECT }}"
run: source ./scripts/pipeline/cloud-gov-deploy.sh
run: |
app_guid=$(cf app --guid ${PROJECT}-drupal-${CF_SPACE}) cf curl -X POST /v3/apps/${app_guid}/actions/clear_buildpack_cache
source ./scripts/pipeline/cloud-gov-deploy.sh
- name: Post Deploy
env:
PROJECT: "${{ secrets.PROJECT }}"
Expand Down
2 changes: 1 addition & 1 deletion apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ packages:
#- awscli
- bsdmainutils
- mysql-client
#- newrelic-php5
- newrelic-php5
23 changes: 11 additions & 12 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@ if [ -z "${VCAP_SERVICES:-}" ]; then
fi

## NewRelic configuration
# export newrelic_apt="${apt_path}/usr/lib/newrelic-php5"
# export newrelic_app="${app_path}/newrelic/"
export newrelic_apt="${apt_path}/usr/lib/newrelic-php5"
export newrelic_app="${app_path}/newrelic/"

# rm -rf ${newrelic_app}/agent
# ln -s ${newrelic_apt}/agent ${newrelic_app}/agent
rm -rf ${newrelic_app}/agent
ln -s ${newrelic_apt}/agent ${newrelic_app}/agent

# rm -f ${newrelic_app}/daemon/newrelic-daemon.x64
# ln -s ${apt_path}/usr/bin/newrelic-daemon ${newrelic_app}/daemon/newrelic-daemon.x64
rm -f ${newrelic_app}/daemon/newrelic-daemon.x64
ln -s ${apt_path}/usr/bin/newrelic-daemon ${newrelic_app}/daemon/newrelic-daemon.x64

# rm -f ${app_path}/newrelic/scripts/newrelic-iutil.x64
# ln -s ${newrelic_apt}/scripts/newrelic-iutil.x64 ${newrelic_app}/scripts/newrelic-iutil.x64
rm -f ${app_path}/newrelic/scripts/newrelic-iutil.x64
ln -s ${newrelic_apt}/scripts/newrelic-iutil.x64 ${newrelic_app}/scripts/newrelic-iutil.x64

#echo 'newrelic.daemon.collector_host=gov-collector.newrelic.com' >> ${app_path}/php/etc/php.ini
echo 'newrelic.daemon.collector_host=gov-collector.newrelic.com' >> ${app_path}/php/etc/php.ini
echo "newrelic.license=${NEWRELIC_KEY}" >> ${app_path}/php/etc/php.ini

source ${app_path}/scripts/bash_exports.sh
source "${app_path}/scripts/bash_exports.sh"

if [ ! -f ./container_start_timestamp ]; then
touch ./container_start_timestamp
Expand All @@ -56,8 +57,6 @@ done
## Updated ~/.bashrc to update $PATH when someone logs in.
[ -z "$(cat ${home}/.bashrc | grep PATH)" ] && \
touch ${home}/.bashrc && \
#echo "export http_proxy=${http_proxy}" >> ${home}/.bashrc && \
#echo "export https_proxy=${https_proxy}" >> ${home}/.bashrc && \
echo "alias nano=\"${home}/deps/0/apt/bin/nano\"" >> ${home}/.bashrc && \
echo "PATH=$PATH:/home/vcap/app/php/bin:/home/vcap/app/vendor/drush/drush" >> /home/vcap/.bashrc

Expand Down
22 changes: 13 additions & 9 deletions scripts/cloud-gov-s3-creds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,29 @@ echo "Creating key..."
aws_bucket_name=$(echo "${s3_credentials}" | jq -r '.credentials.bucket')
aws_bucket_region=$(echo "${s3_credentials}" | jq -r '.credentials.region')
aws_secret_key=$(echo "${s3_credentials}" | jq -r '.credentials.secret_access_key')

declare AWS_ACCESS_KEY_ID
export AWS_ACCESS_KEY_ID=${aws_access_key}

declare AWS_BUCKET
export AWS_BUCKET=${aws_bucket_name}

declare AWS_DEFAULT_REGION
export AWS_DEFAULT_REGION=${aws_bucket_region}

declare AWS_SECRET_ACCESS_KEY
export AWS_SECRET_ACCESS_KEY=${aws_secret_key}

cat >~/current_creds.sh << EOT
export AWS_ACCESS_KEY_ID=${aws_access_key}
export AWS_BUCKET=${aws_bucket_name}
export AWS_DEFAULT_REGION=${aws_bucket_region}
export AWS_SECRET_ACCESS_KEY=${aws_secret_key}
export AWS_ACCESS_KEY_ID="${aws_access_key}"
export AWS_BUCKET="${aws_bucket_name}"
export AWS_DEFAULT_REGION="${aws_bucket_region}"
export AWS_SECRET_ACCESS_KEY="${aws_secret_key}"
EOT
chmod +x ~/current_creds.sh
} >/dev/null 2>&1

declare eror >/dev/null 2>&1

[ -z "${AWS_ACCESS_KEY_ID}" ] && eror=true

if [ -n "${eror}" ]; then
if [ -z "${AWS_ACCESS_KEY_ID}" ]; then
echo -e "Error setting AWS credentials."
echo -e "Please ensure you're logged in to Cloud.gov."
echo -e "You can check by running: cf target -s <space_name>"
Expand Down

0 comments on commit e4bc1cf

Please sign in to comment.