Skip to content

Commit

Permalink
tried starting es with docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
bizob2828 committed Oct 9, 2023
1 parent 9c51226 commit 78d7403
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 9 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,29 @@ jobs:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm ci
- name: docker version
run: docker compose -v
- name: Run Docker Services
run: npm run services
- name: Run Versioned Tests
run: TEST_CHILD_TIMEOUT=600000 npm run versioned:internal elastic
run: TEST_CHILD_TIMEOUT=600000 npm run versioned:internal
env:
VERSIONED_MODE: --minor
JOBS: 4 # 2 per CPU seems to be the sweet spot in GHA (July 2022)
C8_REPORTER: lcovonly
- name: Upload elastic container logs
if: failure()
uses: jwalton/gh-docker-logs@v2
with:
images: 'docker.elastic.co/elasticsearch/elasticsearch:8.7.1'
dest: './logs'
- name: Tar logs
if: failure()
run: tar cvzf ./logs.tgz ./logs
- name: Upload logs to GitHub
if: failure()
uses: actions/upload-artifact@master
with:
name: logs.tgz
path: ./logs.tgz

103 changes: 103 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
version: "3"
services:
elasticsearch:
container_name: nr_node_elastic
image: docker.elastic.co/elasticsearch/elasticsearch:8.7.1
environment:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "network.host=_site_"
- "transport.host=127.0.0.1"
- "discovery.type=single-node"
- "http.host=0.0.0.0"
- "xpack.security.enabled=false"
ports:
- "127.0.0.1:9200:9200"
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:9200"]
interval: 30s
timeout: 10s
retries: 5
memcached:
container_name: nr_node_memcached
image: memcached
ports:
- "11211:11211"
mongodb_3:
container_name: nr_node_mongodb
platform: linux/amd64
image: library/mongo:3
ports:
- "27017:27017"
healthcheck:
test: ["CMD", "mongo", "--quiet"]
interval: 1s
timeout: 10s
retries: 30
mongodb_5:
container_name: nr_node_mongodb_5
image: library/mongo:5
ports:
- "27018:27017"
healthcheck:
test: ["CMD", "mongo", "--quiet"]
interval: 1s
timeout: 10s
retries: 30
mysql:
container_name: nr_node_mysql
platform: linux/amd64
image: mysql:5
ports:
- "3306:3306"
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 1
healthcheck:
test: ["CMD", "mysql" ,"-h", "mysql", "-P", "3306", "-u", "root", "-e", "SELECT 1"]
interval: 1s
timeout: 10s
retries: 30
redis:
container_name: nr_node_redis
image: redis
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 1s
timeout: 10s
retries: 30
cassandra:
container_name: nr_node_cassandra
platform: linux/amd64
image: zmarcantel/cassandra
ports:
- "9042:9042"
healthcheck:
test: [ "CMD", "cqlsh", "-u cassandra", "-p cassandra"]
interval: 5s
timeout: 10s
retries: 6
# pg 9.2 has built in healthcheck
pg:
container_name: nr_node_postgres
image: postgres:9.2
ports:
- "5432:5432"
pg_prisma:
container_name: nr_node_postgres_prisma
image: postgres:15
ports:
- "5434:5434"
environment:
PGPORT: 5434
POSTGRES_PASSWORD: postgres
healthcheck:
test: ["CMD", "pg_isready"]
interval: 1s
timeout: 10s
retries: 30
rmq:
container_name: nr_node_rabbit
image: rabbitmq:3
ports:
- "5672:5672"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
"lint:lockfile": "lockfile-lint --path package-lock.json --type npm --allowed-hosts npm --validate-https --validate-integrity",
"public-docs": "jsdoc -c ./jsdoc-conf.json --tutorials examples/shim api.js lib/shim/ lib/transaction/handle.js && cp examples/shim/*.png out/",
"publish-docs": "./bin/publish-docs.sh",
"services": "./bin/docker-services.sh",
"services": "docker compose up -d --wait",
"smoke": "npm run ssl && time tap test/smoke/**/**/*.tap.js --timeout=180 --no-coverage",
"ssl": "./bin/ssl.sh",
"sub-install": "node test/bin/install_sub_deps",
Expand Down
2 changes: 1 addition & 1 deletion test/lib/params.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
cassandra_host: process.env.NR_NODE_TEST_CASSANDRA_HOST || 'localhost',
cassandra_port: process.env.NR_NODE_TEST_CASSANDRA_PORT || 9042,

elastic_host: process.env.NR_NODE_TEST_ELASTIC_HOST || 'localhost',
elastic_host: process.env.NR_NODE_TEST_ELASTIC_HOST || '127.0.0.1',
elastic_port: process.env.NR_NODE_TEST_ELASTIC_PORT || 9200,

postgres_host: process.env.NR_NODE_TEST_POSTGRES_HOST || 'localhost',
Expand Down
9 changes: 5 additions & 4 deletions test/versioned/elastic/elasticsearch.tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ test('Elasticsearch instrumentation', (t) => {
console.log('before ping')
await client.ping()
console.log('after ping')
console.log('before first idx')
console.log('before first idx', DB_INDEX)
await client.indices.create({ index: DB_INDEX })
console.log('after first idx')
console.log('before 2nd idx')
// await client.indices.create({ index: DB_INDEX_2 })
console.log('after first idx', DB_INDEX)
console.log('before 2nd idx', DB_INDEX_2)
await client.indices.create({ index: DB_INDEX_2 })
console.log('after 2nd idx', DB_INDEX_2)
})

t.afterEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion test/versioned/elastic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"node": ">=16"
},
"dependencies": {
"@elastic/elasticsearch": ">=8.10.0"
"@elastic/elasticsearch": ">=8.0.0"
},
"files": [
"elasticsearch.tap.js"
Expand Down
2 changes: 1 addition & 1 deletion third_party_manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"lastUpdated": "Tue Oct 03 2023 11:10:41 GMT-0400 (Eastern Daylight Time)",
"lastUpdated": "Fri Oct 06 2023 17:25:04 GMT-0400 (Eastern Daylight Time)",
"projectName": "New Relic Node Agent",
"projectUrl": "https://github.com/newrelic/node-newrelic",
"includeOptDeps": true,
Expand Down

0 comments on commit 78d7403

Please sign in to comment.