-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(couchbaseRhel): update required files (#164)
* feat(couchbaseRhel): update required files * fix: fix run command of couchbase * fix: update test files * fix: increase instance size * fix: invalid syntax * fix(couchbase-rhel): update test file with setting facts * feat(couchbase-rhel): update exporting input vars; * fix: delete unused code * fix(couchbase-rhel): update input vars * feat(couchbse-rhel): change validationNrql data sample name * fix(couchbase-rhel): update test file * fix(couchbase-rhel): update tasks and fields in recipe * fix(couchbase-rhel): add secret field for password * fix(couchbase-rhel): update path for couchbase logs * chore(nit): adjusting username and capitalization * chore: move to new ohi directory Co-authored-by: Justin Eveland <[email protected]>
- Loading branch information
1 parent
fb5ad7f
commit bdaefbe
Showing
3 changed files
with
237 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,130 @@ | ||
name: couchbase-open-source-integration | ||
displayName: Couchbase Open Source Integration | ||
description: New Relic install recipe for default Couchbase Open Source on-host integration (via Infra-Agent) | ||
repository: https://github.com/newrelic/nri-couchbase | ||
|
||
installTargets: | ||
- type: host | ||
os: linux | ||
platform: "amazon" | ||
platformVersion: "2" | ||
- type: host | ||
os: linux | ||
platform: "redhat" | ||
- type: host | ||
os: linux | ||
platform: "centos" | ||
|
||
# keyword convention for dealing with search terms that could land someone on this instrumentation project | ||
keywords: | ||
- Infrastructure | ||
- Integration | ||
- couchbase | ||
|
||
# CLI runs process detection; this is used to filter recipes that are appropriate for matched processes | ||
processMatch: | ||
- couchbase | ||
|
||
# Matches partial list of the Log forwarding parameters | ||
logMatch: | ||
- name: Couchbase Error | ||
file: /opt/couchbase/var/lib/couchbase/logs/error.log | ||
- name: Couchbase General | ||
file: /opt/couchbase/var/lib/couchbase/logs/couchdb.log | ||
|
||
validationNrql: "SELECT count(*) from CouchbaseNodeSample where hostname like '{{.HOSTNAME}}%' FACET entityGuid SINCE 10 minutes ago" | ||
|
||
inputVars: | ||
- name: "NR_CLI_API_USERNAME" | ||
prompt: "Couchbase Username" | ||
- name: "NR_CLI_API_PASSWORD" | ||
prompt: "Couchbase Password" | ||
secret: true | ||
- name: "NR_CLI_API_HOSTNAME" | ||
prompt: "Couchbase Hostname (default: localhost)" | ||
default: "localhost" | ||
- name: "NR_CLI_API_PORT" | ||
prompt: "Couchbase Port (default: 8091)" | ||
default: 8091 | ||
- name: "NR_CLI_API_QUERY_PORT" | ||
prompt: "Couchbase Query Port (default: 8093)" | ||
default: 8093 | ||
- name: "NR_CLI_API_USE_SSL" | ||
prompt: "Use SSL to connect? (true/false)" | ||
default: false | ||
- name: "NR_CLI_API_CA_BUNDLE_DIR" | ||
prompt: "SSL Certificate Directory (if applicable)" | ||
- name: "NR_CLI_API_CA_BUNDLE_FILE" | ||
prompt: "SSL Certificate File (if applicable)" | ||
|
||
install: | ||
|
||
version: "3" | ||
silent: true | ||
|
||
tasks: | ||
default: | ||
cmds: | ||
- task: assert_pre_req | ||
- task: setup | ||
|
||
assert_pre_req: | ||
cmds: | ||
- | | ||
SERVICE_EXIST=$(sudo systemctl status newrelic-infra.service | grep "Active" | wc -l) | ||
if [ $SERVICE_EXIST -eq 0 ]; then | ||
echo "The newrelic-infra agent service is NOT installed on the host, but is required to install this integration." >> /dev/stderr | ||
exit 1 | ||
fi | ||
setup: | ||
label: "Installing couchbase integration..." | ||
cmds: | ||
- | | ||
sudo mkdir -p "/etc/newrelic-infra/integrations.d" | ||
- | | ||
sudo yum update -y | ||
- | | ||
sudo yum install nri-couchbase -y | ||
- | | ||
if [ -f /etc/newrelic-infra/integrations.d/couchbase-config.yml ]; then | ||
sudo rm /etc/newrelic-infra/integrations.d/couchbase-config.yml; | ||
fi | ||
sudo touch /etc/newrelic-infra/integrations.d/couchbase-config.yml; | ||
- | | ||
if [ {{.NR_CLI_API_USE_SSL}} == false ]; then | ||
sudo tee -a /etc/newrelic-infra/integrations.d/couchbase-config.yml > /dev/null <<"EOT" | ||
integration_name: com.newrelic.couchbase | ||
instances: | ||
- name: couchbase | ||
command: all_data | ||
arguments: | ||
hostname: {{.NR_CLI_API_HOSTNAME}} | ||
port: {{.NR_CLI_API_PORT}} | ||
query_port: {{.NR_CLI_API_QUERY_PORT}} | ||
username: {{.NR_CLI_API_USERNAME}} | ||
password: {{.NR_CLI_API_PASSWORD}} | ||
use_ssl: {{.NR_CLI_API_USE_SSL}} | ||
EOT | ||
else | ||
sudo tee -a /etc/newrelic-infra/integrations.d/couchbase-config.yml > /dev/null <<"EOT" | ||
integration_name: com.newrelic.couchbase | ||
instances: | ||
- name: couchbase | ||
command: all_data | ||
arguments: | ||
hostname: {{.NR_CLI_API_HOSTNAME}} | ||
port: {{.NR_CLI_API_PORT}} | ||
query_port: {{.NR_CLI_API_QUERY_PORT}} | ||
username: {{.NR_CLI_API_USERNAME}} | ||
password: {{.NR_CLI_API_PASSWORD}} | ||
use_ssl: {{.NR_CLI_API_USE_SSL}} | ||
ca_bundle_dir: {{.NR_CLI_API_CA_BUNDLE_DIR}} | ||
ca_bundle_file: {{.NR_CLI_API_CA_BUNDLE_FILE}} | ||
EOT | ||
fi | ||
- sudo systemctl restart newrelic-infra.service |
This file contains 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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"global_tags": { | ||
"owning_team": "OpenSource", | ||
"Environment": "development", | ||
"Department": "Product", | ||
"Product": "Virtuoso" | ||
}, | ||
|
||
"resources": [{ | ||
"id": "host1", | ||
"display_name": "AwsLinux2InfraCouchbaseInstallHost", | ||
"provider": "aws", | ||
"type": "ec2", | ||
"size": "t3.small", | ||
"ami_name": "amazonlinux-2-base*" | ||
}], | ||
|
||
"services": [{ | ||
"id": "couchbase1", | ||
"destinations": ["host1"], | ||
"source_repository": "https://github.com/newrelic/open-install-library.git", | ||
"deploy_script_path": "test/deploy/linux/couchbase/install/rhel/roles", | ||
"port": 80, | ||
"params":{ | ||
"create_env_var": true, | ||
"initialize_cluster": true | ||
} | ||
}], | ||
|
||
"instrumentations": { | ||
"resources": [ | ||
{ | ||
"id": "nr_infra_couchbase", | ||
"resource_ids": ["host1"], | ||
"provider": "newrelic", | ||
"source_repository": "https://github.com/newrelic/open-install-library.git", | ||
"deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", | ||
"params": { | ||
"recipe_content_url": [ | ||
"https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/amazonlinux2.yml", | ||
"https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/ohi/couchbase/rhel.yml" | ||
] | ||
} | ||
}, | ||
{ | ||
"id": "nr_infra_is_having_data", | ||
"resource_ids": ["host1"], | ||
"provider": "newrelic", | ||
"source_repository": "https://github.com/newrelic/open-install-library", | ||
"deploy_script_path": "test/deploy/assertions/recipe-is-valid/roles", | ||
"params": { | ||
"recipe_validation_nrql_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/ohi/couchbase/rhel.yml" | ||
} | ||
} | ||
] | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
test/deploy/linux/couchbase/install/rhel/roles/configure/tasks/main.yml
This file contains 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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
- debug: | ||
msg: Install Couchbase | ||
|
||
- name: Set default initialize_cluster (default not create) | ||
set_fact: | ||
initialize_cluster: "false" | ||
when: initialize_cluster is undefined | ||
|
||
- name: Set default create_env_var (default not create) | ||
set_fact: | ||
create_env_var: "false" | ||
when: create_env_var is undefined | ||
|
||
- name: update packages | ||
shell: yum update -y | ||
become: true | ||
|
||
- name: install couchbase | ||
shell: rpm --install https://packages.couchbase.com/releases/6.6.0/couchbase-server-community-6.6.0-amzn2.x86_64.rpm | ||
become: true | ||
|
||
- name: Wait for couchbase | ||
pause: | ||
seconds: 20 | ||
|
||
- block: | ||
- name: Initialize cluster | ||
shell: /opt/couchbase/bin/couchbase-cli cluster-init --cluster localhost:8091 --cluster-name Test --cluster-username newrelic --cluster-password Virtuoso4all! --cluster-ramsize 1200 --cluster-analytics-ramsize 1024 --services data | ||
become: true | ||
when: initialize_cluster|bool | ||
|
||
- block: | ||
- name: Export NR_CLI_API_USERNAME | ||
shell: "echo export NR_CLI_API_USERNAME=newrelic >> ~/.bashrc" | ||
- name: Export NR_CLI_API_PASSWORD | ||
shell: "echo export NR_CLI_API_PASSWORD=Virtuoso4all! >> ~/.bashrc" | ||
- name: Export NR_CLI_API_PORT | ||
shell: "echo export NR_CLI_API_PORT=8091 >> ~/.bashrc" | ||
- name: Export NR_CLI_QUERY_PORT | ||
shell: "echo export NR_CLI_API_QUERY_PORT=8093 >> ~/.bashrc" | ||
- name: Export NR_CLI_HOSTNAME | ||
shell: "echo export NR_CLI_API_HOSTNAME=localhost >> ~/.bashrc" | ||
- name: Export USE_SSL | ||
shell: "echo export NR_CLI_API_USE_SSL=false >> ~/.bashrc" | ||
- name: Export CA_BUNDLE_DIR | ||
shell: "echo export NR_CLI_API_CA_BUNDLE_DIR=notUsed >> ~/.bashrc" | ||
- name: Export CA_BUNDLE_FILE | ||
shell: "echo export NR_CLI_API_CA_BUNDLE_FILE=notUsed >> ~/.bashrc" | ||
when: create_env_var|bool |