-
-
Notifications
You must be signed in to change notification settings - Fork 544
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#16: Add express example for elasticsearch (non-working).
- Loading branch information
1 parent
997af82
commit cd415b5
Showing
6 changed files
with
117 additions
and
7 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,2 @@ | ||
node_modules | ||
*.log |
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,42 @@ | ||
# elasticsearch example | ||
name: elasticsearch | ||
|
||
# Give me http://elasticsearch.lndo.site | ||
proxy: | ||
appserver: | ||
- port: 80/tcp | ||
default: true | ||
|
||
# Spin up a basic nodes server with elasticsearch backend | ||
services: | ||
|
||
# Spin up a memcache container called "search" | ||
# NOTE: "search" is arbitrary, you could just as well call this "theboss" or "eljefe" | ||
search: | ||
|
||
# Use version 5.4 of elasticsearch | ||
type: elasticsearch:5.4 | ||
|
||
# Optionally allow access to the cache at localhost:9999 | ||
# You will need to make sure port 9999 is open on your machine | ||
# | ||
# You can also set `portforward: true` to have Lando dynamically assign | ||
# a port. Unlike specifying an actual port setting this to true will give you | ||
# a different port every time you restart your app | ||
portforward: 9999 | ||
|
||
# Spin up services to run a basic node server | ||
appserver: | ||
type: node:6.10 | ||
command: npm start | ||
build: | ||
- "cd $LANDO_MOUNT & npm install" | ||
|
||
# Add some nice command routing | ||
tooling: | ||
npm: | ||
service: appserver | ||
gulp: | ||
service: appserver | ||
node: | ||
service: appserver |
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,38 @@ | ||
/** | ||
* Lando node elasticsearch example | ||
* | ||
* @name taylorswift | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// Load modules | ||
var http = require('http'); | ||
var express = require('express'); | ||
var Elasticsearch = require('elasticsearch'); | ||
var app = express(); | ||
|
||
// Get our elasticsearch client | ||
var elasticsearch = new Elasticsearch.Client({ | ||
host: 'search:9999', | ||
log: 'trace' | ||
}); | ||
|
||
// Create our servers | ||
http.createServer(app).listen(80); | ||
|
||
// Try to connect to elasticsearch. | ||
app.get('/', function(req, res) { | ||
|
||
res.header('Content-type', 'text/html'); | ||
var info = 'Elasticsearch is not up.'; | ||
elasticsearch.ping({ | ||
}, function (error) { | ||
if (error) { | ||
console.log(error); | ||
return res.end('elasticsearch cluster is down!' + JSON.stringify(error, null, 2)); | ||
} else { | ||
return res.end('All is well.'); | ||
} | ||
}); | ||
}); |
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,26 @@ | ||
{ | ||
"name": "elasticsearch-lando", | ||
"version": "1.0.0", | ||
"description": "Elasticsearch example for Lando.", | ||
"main": "app.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"start": "npm install && node app.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/kalabox/lando/tree/master/examples/elasticsearch" | ||
}, | ||
"keywords": [ | ||
"node", | ||
"docker", | ||
"localdev", | ||
"elasticsearch" | ||
], | ||
"author": "Alec Reynolds", | ||
"license": "MIT", | ||
"dependencies": { | ||
"elasticsearch": "^13.2.0", | ||
"express": "^4.15.3" | ||
} | ||
} |
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
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