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

feat: Added for Apache Traffic Server on ubuntu. #985

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
---
- name: update system.
shell: sudo apt update
become: yes

- name: Install ats
apt:
name: ['trafficserver']
update_cache: yes
state: latest
become: yes
when: ansible_pkg_mgr == 'apt'

- name: Install Apache2
apt:
name: ['apache2']
update_cache: yes
state: latest
become: yes

- name: Start apache2 service
shell: "sudo systemctl start apache2"
become: yes
when: ansible_pkg_mgr == 'apt'

- name: set apache ports config
lineinfile:
path: "/etc/apache2/ports.conf"
state: present
regexp: "80"
line: "Listen 127.0.0.1:80"
become: true
no_log: true

- name: set apache ports config
lineinfile:
path: "/etc/apache2/apache2.conf"
line: "ServerName localhost"
state: present
become: true
no_log: true

- name: Configuring Traffic Server as a Reverse Proxy
lineinfile:
path: "/etc/trafficserver/remap.config"
line: "map http://13.233.89.63:8080/ http://127.0.0.1:80/"
state: present
become: true
no_log: true

- name: enabling ATS metrics
lineinfile:
path: "/etc/trafficserver/plugin.config"
line: "stats_over_http.so"
state: present
become: true
no_log: true

- name: enabling ATS metrics setup
lineinfile:
path: "/etc/trafficserver/records.config"
line: "CONFIG proxy.config.http.cache.http INT 1

CONFIG proxy.config.reverse_proxy.enabled INT 1

CONFIG proxy.config.url_remap.remap_required INT 1

CONFIG proxy.config.url_remap.pristine_host_hdr INT 1

CONFIG proxy.config.http.server_ports STRING 8080 8080:ipv6"
state: present
become: true
no_log: true

- name: Start apache2 service
shell: "systemctl restart apache2"
become: yes
when: ansible_pkg_mgr == 'apt'

- name: creating ats run directory
shell: mkdir -p /var/run/trafficserver
become: true

- name: give permission to ats
shell: chown -R trafficserver:trafficserver /var/run/trafficserver
become: true

- name: Start trafficserver service
shell: "systemctl restart trafficserver"
become: yes
when: ansible_pkg_mgr == 'apt'

- block:
- name: Copy nri-flex config file
template:
src: nri-flex-ats.yml
dest: /etc/newrelic-infra/integrations.d/nri-flex-ats.yml
become: true

- block:
- name: Copy nri-flex config file
template:
src: nri-flex-ats-cache.yml
dest: /etc/newrelic-infra/integrations.d/nri-flex-ats-cache.yml
become: true

- block:
- name: Copy nri-flex config file
template:
src: nri-flex-ats-http.yml
dest: /etc/newrelic-infra/integrations.d/nri-flex-ats-http.yml
become: true

- name: Restart the newrelic-infra service
shell: "systemctl restart newrelic-infra.service"
become: yes
when: ansible_pkg_mgr == 'apt'
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
integrations:
- name: nri-flex
interval: 30s
config:
name: ATSCacheMetrics
apis:
- event_type: ATSCacheSampleMetrics
url: http://localhost:8080/_stats
keep_keys:
- cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
integrations:
- name: nri-flex
interval: 30s
config:
name: ApcheTrafficServerMetrics
apis:
- event_type: ATSHttpSampleMetrics
url: http://localhost:8080/_stats
keep_keys:
- http
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
integrations:
- name: nri-flex
interval: 30s
config:
name: ATSAutomationMetrics
apis:
- event_type: ATSAutomationMetrics
url: http://localhost:8080/_stats
remove_keys:
- http
- cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"global_tags": {
"owning_team": "virtuoso",
"Environment": "development",
"Department": "product",
"Product": "virtuoso"
},

"resources": [
{
"id": "amubuntu22auto",
"provider": "aws",
"type": "ec2",
"size": "t3.micro",
"ami_name": "ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-????????",
"user_name": "ubuntu"
}
],

"instrumentations": {
"resources": [
{
"id": "nr_infra_ubuntu22",
"resource_ids": ["amubuntu22auto"],
"provider": "newrelic",
"source_repository": "https://github.com/newrelic/open-install-library",
"deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles",
"params": {
"validate_output": "Infrastructure Agent\\s+\\(installed\\)",
"local_recipes": true
}
}
]
},

"services": [
{
"id": "ats",
"destinations": ["amubuntu22auto"],
"local_source_path": "/mnt/deployer",
"deploy_script_path": "test/deploy/linux/apache-traffic-server/install/linux/roles",
"port": 8080
}
]
}