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

Catalog-next New Relic #2317

Merged
merged 10 commits into from
Oct 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 1 deletion ansible/catalog-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@
hosts: catalog-web,catalog-next-web
roles:
- role: monitoring/newrelic/python-agent-ansible
when: common_newrelic_enabled
when:
- common_newrelic_enabled
- not ckan_uses_gunicorn
tags:
- newrelic

Expand Down
1 change: 1 addition & 0 deletions ansible/inventories/sandbox/group_vars/all/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ real_ansible_env: production

# newrelic
nrinfragent_license_key: "{{ vault_nrinfragent_license_key }}"
newrelic_license_key: "{{ nrinfragent_license_key }}"


# postfix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,4 @@ catalog_ckan_fgdc2iso_host: localhost
ckan_catalog_next: false
ckan_production_ini_template: etc_ckan_production.ini.j2
ckan_uses_gunicorn: false
newrelic_app_name: catalog
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ provisioner:
- spatial_query
- spatial_harvest_metadata_api
- datagovtheme
newrelic_license_key: some-secret

lint:
name: ansible-lint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ provisioner:
all:
catalog_ckan_redis_password: redispass # fake secret for test
catalog_ckan_who_ini_secret: e45cfed3-40f1-41c0-8e92-77eda7ddd9f3 # Fake secret for test
newrelic_license_key: some-secret
# https://github.com/DavidWittman/ansible-redis/blob/21b0b6f9030275a2586baf591f322ce3348b2b2d/tasks/install.yml#L9
redis_travis_ci: true
v2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ provisioner:
all:
catalog_ckan_redis_password: redispass # fake secret for test
catalog_ckan_who_ini_secret: e45cfed3-40f1-41c0-8e92-77eda7ddd9f3 # Fake secret for test
newrelic_license_key: some-secret
v2:
app_repo_branch: bionic
lint:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ provisioner:
all:
catalog_ckan_redis_password: redispass # fake secret for test
catalog_ckan_who_ini_secret: e45cfed3-40f1-41c0-8e92-77eda7ddd9f3
newrelic_license_key: some-secret
# https://github.com/DavidWittman/ansible-redis/blob/21b0b6f9030275a2586baf591f322ce3348b2b2d/tasks/install.yml#L9
redis_travis_ci: true
v2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ provisioner:
all:
catalog_ckan_redis_password: redispass # fake secret for test
catalog_ckan_who_ini_secret: e45cfed3-40f1-41c0-8e92-77eda7ddd9f3 # Fake secret for test
newrelic_license_key: some-secret
v2:
app_repo_branch: bionic
lint:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ provisioner:
- geodatagov_waf_harvester
- spatial_query
- datagovtheme
newrelic_license_key: some-secret
# https://github.com/DavidWittman/ansible-redis/blob/21b0b6f9030275a2586baf591f322ce3348b2b2d/tasks/install.yml#L9
redis_travis_ci: true
lint:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ provisioner:
catalog_ckan_db_user: ckan
catalog_ckan_redis_password: redispass # fake secret for test
catalog_ckan_who_ini_secret: e45cfed3-40f1-41c0-8e92-77eda7ddd9f3 # Fake secret for test
newrelic_license_key: some-secret
# https://github.com/DavidWittman/ansible-redis/blob/21b0b6f9030275a2586baf591f322ce3348b2b2d/tasks/install.yml#L9
redis_travis_ci: true
v2:
Expand Down
24 changes: 24 additions & 0 deletions ansible/roles/software/ckan/catalog/ckan-app/tasks/web.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
---
- name: Assert newrelic_license_key is set
assert:
that: newrelic_license_key is defined
fail_msg: newrelic_license_key is required but it is not set

- name: Install WSGI app
copy: src=etc_ckan_apache.wsgi dest=/etc/ckan/apache.wsgi mode=0644 owner=root group=www-data
notify: reload apache2
when: not ckan_uses_gunicorn

- name: Copy CKAN server_start.sh
copy:
src: "{{ app_source_path }}/ckan/setup/server_start.sh"
dest: /etc/ckan/server_start.sh
mode: 0755
remote_src: true
become: true
when: ckan_uses_gunicorn

- name: Copy app .env
template:
src: gunicorn_env.j2
dest: /etc/ckan/.env
mode: 0644
owner: root
group: root
become: true
when: ckan_uses_gunicorn

- name: Install supervisor
apt: name=supervisor state=present
when: ckan_uses_gunicorn
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NEW_RELIC_LICENSE_KEY="{{ newrelic_license_key }}"
NEW_RELIC_APP_NAME="{{ newrelic_app_name }}"
NEW_RELIC_MONITOR_MODE=true
NEW_RELIC_LOG=/var/log/new_relic.log
NEW_RELIC_LOG_LEVEL=info
NEW_RELIC_HOST=gov-collector.newrelic.com
CKAN_INI=/etc/ckan/production.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[program:catalog-web]
command={{ project_source_new_code_path }}/bin/gunicorn --worker-class gevent --paste /etc/ckan/production.ini -b localhost:5000 --proxy-allow-from="127.0.0.1"
command=/etc/ckan/server_start.sh -b localhost:5000 --proxy-allow-from="127.0.0.1"
directory={{ project_source_new_code_path }}
stdout_logfile={{ catalog_gunicorn_error_log }}
autostart=true
autorestart=true
redirect_stderr=true
environment=PATH="{{ project_source_new_code_path }}/bin:%(ENV_PATH)s"
jbrown-xentity marked this conversation as resolved.
Show resolved Hide resolved