Multiple dockers and multiple domains on elastic beanstalk - amazon-web-services

I have 10 low-traffic websites, all with different domains and I want to run all of them on one elastic beanstalk environment.
I'm a developer with zero experience with docker but from reading other answers I got the idea that a multicontainer docker environment could be what I need.
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_ecs.html
Can someone who have done it before (multiple domains on an EB environment) confirm that I'm on the right direction? If so, is there somewhere a tutorial on doing a multi-domain environment for people who never used docker?

AWS EB doesn't handle routing based on domain names. You can expose multiple ports. 80 and 9000 are exposed in the graphic below. But the visitor must type to port into the url, that's very ugly.
In order to route traffic to a container based on the domain you need a proxy. Nginx Proxy can do that for you.

Related

constant URL for docker compose app deployed to AWS?

Is there some easy way that I am missing to get an unchanging, accessible to the internet URL for something I deploy to ECS with docker compose up?
I've written a small web app using flask and Nginx, put the flask and nginx portions into Docker containers, and deployed the thing to AWS ECS using this workflow, which boils down to:
docker context use myecscontext
docker compose up
This deploys the whole thing using AWS Fargate and makes it accessible from the internet at timot-LoadB-xyzxyzxyzxyzx-xyzxyzxyz.us-east-2.elb.amazonaws.com. So far so good.
Now I'd like to make my-fancy-domain.com, registered with a non-AWS registrar, point to my web app. I know I can edit the DNS entry at my registrar to do this; here's the catch: that URL with all the xyzs changes every time I docker compose up after making changes to my web app. Must I really monkey around in my registrar's DNS settings every time I update something?
I had imagined I would simply slap an elastic IP on my new Fargate cluster when I'm satisfied that I want to replace the current live version with an update. I see now that I can't easily associate an elastic IP with the load balancer that Fargate sets up. And I would just as soon not move my-fancy-domain.com to Route53 simply to accomplish this.
For anyone who finds this in the future: what ended up working in the end was to move the DNS records for my site from my domain registrar to AWS Route53.
Once I did that the AWS Route53 console makes it straightforward to add an alias record pointing to the Application Load Balancer that the docker-compose/ECS integration set up. Those alias records are "a Route 53–specific extension to DNS".
I did not want to move DNS records to Route53, but it did solve the problem.

I want to connect nginx and django on openshift

So I have an instance of nginx running on my openshift and another pod for a django app, the thing is I don't know how to connect both services. I'm able to access hte default url for nginx and the url for django. Both are working fine but I don't know how to connect both services. Is there a way to do it modifying the yaml of the services or the pods? I already try to build the container myself of nginx and is giving me permission issues, so I'm using a version of nginx thats comes preloaded in openshift. Any help would be greatly appreciated. thank you so much.
To have access between pods you have to have service created for every pod.
Then you can use service-name as DNS names to reach pods. If pods are placed in different projects you should additionally specify project name like .
Furthermore, there's environment variables for service discovery (see service discovery)
Objects examples check in Kubernetes documentation

How do I pass Eureka service ip to my java application running in a docker container?

I have number of java and python services running in docker containers in clustered environment. I'm using Eureka for service discovery and it works fine locally with Eureka ip address hardcoded in application configuration files. I have problem with flexible configuration of Eureka service for Java services - docker containers with the services will be deployed in three environments where Eureka will have different ip addresses.
Is there a way to pass Eureka URI using e.g. JVM environment variable?
Or if I pass the URI as an application argument, how can I get it propagated to the Eureka client configuration?
PS: I use AWS ECS and due to number of services and existing AWS constraints I cannot put all docker containers in a single task definition, cannot use docker names resolving and just hardcode Eureka hostname, on the other hand I might have multiple Eureka instances and would like to specify which one particular container should use.
The answer to this my question would be to use configuration server, description of this beast can be found here https://dzone.com/articles/using-spring-config-server.

Map domain name to multiple AWS Elastic Beanstalk instances

The company I work for has multiple elastic beanstalk applications. We have setup a domain (eg. http://applications.ourcompany.com ) that currently directs to one of these instances. This works fine, the user enters http://applications.ourcompany.com and they end up at this ELB instance. However what we would really like to to is have something like the following:
http://applications.ourcompany.com/appone - maps to http://appone.elasticbeanstalk.com
http://applications.ourcompany.com/apptwo - maps to http://apptwo.elasticbeanstalk.com
and so on. I have been reading the AWS Documentation but it isn't immediately obvious if this is possible, or how to go about it. This is further complicated by our need to use HTTPS for at least one of these instances. We currently have a certificate for http://applications.ourcompany.com in IAM. Any help or guidance hugely appreciated.
You have to do this with a custom proxy server. The path ('/appone', '/apptwo') is passed to the application, not checked by the DNS. So you could set up an HAProxy server or nginx or something on http://applications.ourcompany.com and have it proxy requests to the different apps on https://appone.elastibeanstalk.com (notice I added HTTPS there).

nginx http-proxy infront of PHP-App running on Beanstalk

i am very new to AWS and Beanstalk so maybe my question is very easy...
I want to put up a Drupal-Page (with boost) on Beanstalk as PHP-App (PHP + Apache).
And i would like to use nginx as a reserve proxy infront of it. My simple question:
How to do this? And is it a good idea?
I searched the internet and all the tutorials i found were assuming that i run the server. But i couldnt figure out how to use an nginx http-proxy infront of PHP-App running on Beanstalk... unfortunatly.
You can set-up a 2-tier infra within Elastic Beanstalk and then perhaps with an ELB in front
ELB->Nginx->Drupal
However, for the added cost of that instance, not many people run this set-up. At least not within a small set-up that Beanstalk is likely running.