Vlad Miller
Vlad Miller

Reputation: 2279

Expose docker port on Amazon ElasticBeanstalk

So I'm trying to deploy application which opens two ports; one is a simple http server another is used for app to communicate with other instances and join in clusters. You guessed it, it's elasticsearch.

So using Dockerfile and Dockerrun.aws.js or maybe some other configuration files which I can add in distribution how is it possible to tell EB to map port 9300 to private networking interface?

My current Dockerfile has

EXPOSE 9200 9300

But from documentation is said that EB will only attach nginx reverse proxy to first port and nothing said about how to map other ports without nginx

Thanks

UPDATE #1:

Using .ebextensions it is possible to execute any shell command. I am trying to map port via iptables, however still have some issues.

UPDATE #2: After two days of mining knowledge and digging es cave I was able to map ports to host machine and setup ES discovery. However, ES still don't want to create cluster, this time due to

disconnecting from [...] due to explicit disconnect call

UPDATE #3: I was not able to make ElasticSearch to work with EBT Docker containers, however I made it work without docker directly on EBT instance. Here is working config https://github.com/vladmiller/elasticsearch-beanstalk

Upvotes: 1

Views: 675

Answers (2)

Vlad Miller
Vlad Miller

Reputation: 2279

I was not able to make ElasticSearch to discover other nodes on EBT Docker environment, however I made it work using instance itself

Working config https://github.com/vladmiller/elasticsearch-beanstalk

Upvotes: 1

Zenexer
Zenexer

Reputation: 19611

Elasticsearch binds to localhost by default now (2.x). Use these settings in your elasticsearch.yml to bind to a physical interface. Keep in mind that making your Elasticsearch server publicly accessible to the internet is insecure, bordering on suicidal, so be sure you have a good firewall and are only listening on a LAN interface.

network.bind_host: 0.0.0.0
network.publish_host: _non_loopback_

If you're using the cloud-aws plugin for automatic discovery on AWS/EC2, you may want to automatically choose your VPC interface's IP address:

network.bind_host: 0.0.0.0
network.publish_host: _ec2_

It's possible that _ec2_ may be deprecated at some point and replaced with _ec2:privateIpv4_.

Sources:

Upvotes: 2

Related Questions