Https + Docker + ElasticBeanstalk

84 views
Skip to first unread message

kevin.s...@dooapp.com

unread,
Dec 30, 2015, 11:03:40 AM12/30/15
to wisdom-discuss
Hi!

I followed the wisdom documentationt to setup https on my wisdom application.

I successfully did all steps but when I access to the application I got an nginx error 502 Bad Gateway.

Where are my changes:

# application.conf
http.port=-1
https.port=9000

# configuration/ssl folder
KEYSTORE_FILE.pfx

#Dockerfile
./chameleon.sh start -Dapplication.mode=${ENV_MODE} -Dhttps.keyStore=./conf/ssl/KEYSTORE_FILE.pfx; -Dhttps.keyStorePassword=PASSWORD; -Dhttps.keyStoreType=PKCS12;


Do I need to setup also nginx? If yes, what is the best way to do it with wisdom and Docker?

Thank you in advance for your help!

Kevin

Nicolas Delsaux

unread,
Dec 31, 2015, 2:45:53 AM12/31/15
to wisdom-...@googlegroups.com
Kevin, did you try your changed Wisdom application before putting it in the Docker container ?
--
You received this message because you are subscribed to the Google Groups "wisdom-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wisdom-discus...@googlegroups.com.
Visit this group at https://groups.google.com/group/wisdom-discuss.
To view this discussion on the web visit https://groups.google.com/d/msgid/wisdom-discuss/66a41565-2447-4113-9dab-dfb2b11f2dc3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

kevin.s...@dooapp.com

unread,
Dec 31, 2015, 7:56:50 AM12/31/15
to wisdom-discuss, nicolas...@gmx.fr
Hi Nicolas,

I didn't succeed to run wisdom application as on amazon beanstalk. Locally, wisdom is launched via mvn wisdom:run or java -jar bin/chameleon-core[...].jar but where can I do the link between wisdom app and nginx?

Thank you in advance for your help!

Kévin

kevin.s...@dooapp.com

unread,
Dec 31, 2015, 8:58:09 AM12/31/15
to wisdom-discuss, nicolas...@gmx.fr
Well, my nginx configuration works locally but not with docker.

Elastic beanstalk could not check health of application.

Here is my nginx configuration file:


  proxy_buffering    off;
  proxy_set_header   X-Real-IP $remote_addr;
  proxy_set_header   X-Scheme $scheme;
  proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header   Host $http_host;
  # proxy_http_version appeared in nginx 1.1.4
  proxy_http_version 1.1;

  upstream my-backend {
    server 127.0.0.1:9000;
  }

  server {
            server_name localhost;

            location / {
              return        301 https://$host$request_uri;
            }
        }

  server {
    listen               443;
    ssl                  on;
    ssl_certificate      mycert.crt;
    ssl_certificate_key  mycert.key;
keepalive_timeout 70; server_name $host; location / { proxy_pass https://my-backend; } }

Any idea why elastic beanstalk cannot load the application?

Thank you in advance!

Clement Escoffier

unread,
Jan 9, 2016, 3:51:30 AM1/9/16
to wisdom-...@googlegroups.com, nicolas...@gmx.fr
Hi,

Is NGINX also in docker ? In that case do you link the containers ? 

Could you check that the 127.0.0.1:9000 is actually served correctly after having started the application ?

Clement

Message has been deleted

kevin.s...@dooapp.com

unread,
Jan 21, 2016, 8:42:22 AM1/21/16
to wisdom-discuss, nicolas...@gmx.fr
Ok I identify the problem.

When docker is used, nginx is automatically configured to listen on port 80 and upstream request to wisdom server.

for example:

upstream docker {
   server 172.17.0.5:9000;
}

listen 80 {
   [...]
   location / {
     proxy_pass http://docker;
   }
}

To check that wisdom is running well, I connect myself via ssh to the aws instance and do:

I got a connection refused exception. Thats why nginx throw a bad gateway.

Do you have a idea in which cases this exception appear?

Thank you in advance

Kevin

kevin.s...@dooapp.com

unread,
Jan 21, 2016, 8:46:18 AM1/21/16
to wisdom-discuss
Application logs:

14:28:09.723 [[iPOJO] pool-1-thread-1] ERROR o.o.util.log.impl.osgi.LoggerService - [ERROR]  : [org.wisdom.configuration.ApplicationConfigurationImpl-0] createInstance -> Cannot invoke the constructor method - the constructor throws an exception : No enum constant org.wisdom.configuration.Mode.
java.lang.IllegalArgumentException: No enum constant org.wisdom.configuration.Mode.
        at java.lang.Enum.valueOf(Enum.java:238) ~[na:1.8.0_66]
        at org.wisdom.configuration.Mode.valueOf(Mode.java:25) ~[na:na]
        at org.wisdom.configuration.ApplicationConfigurationImpl.<init>(ApplicationConfigurationImpl.java:98) ~[na:na]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_66]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_66]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_66]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[na:1.8.0_66]
        at org.apache.felix.ipojo.InstanceManager.createObject(InstanceManager.java:740) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.InstanceManager.getPojoObject(InstanceManager.java:963) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.util.Callback.call(Callback.java:233) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.util.Callback.call(Callback.java:193) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__M_stateChanged(LifecycleCallbackHandler.java:162) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:560) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.InstanceManager.stateChanged(InstanceManager.java:1533) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:585) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.HandlerManager.stateChanged(HandlerManager.java:239) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.Handler.setValidity(Handler.java:174) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.handlers.dependency.DependencyHandler.__M_checkContext(DependencyHandler.java:170) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.handlers.dependency.DependencyHandler.checkContext(DependencyHandler.java) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.handlers.dependency.DependencyHandler.__M_validate(DependencyHandler.java:133) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.handlers.dependency.DependencyHandler.validate(DependencyHandler.java) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.util.DependencyModel.validate(DependencyModel.java:522) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.util.DependencyModel.computeAndSetDependencyState(DependencyModel.java:362) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.util.DependencyModel.onChange(DependencyModel.java:1123) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.dependency.impl.ServiceReferenceManager.fireUpdate(ServiceReferenceManager.java:561) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.dependency.impl.ServiceReferenceManager.onNewMatchingService(ServiceReferenceManager.java:525) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.dependency.impl.ServiceReferenceManager.addedService(ServiceReferenceManager.java:504) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.util.Tracker$Tracked.trackAdding(Tracker.java:711) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.util.Tracker$Tracked.track(Tracker.java:672) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.util.Tracker$Tracked.serviceChanged(Tracker.java:633) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:991) [chameleon-core-1.10.9.jar:na]
        at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:839) [chameleon-core-1.10.9.jar:na]
        at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:546) [chameleon-core-1.10.9.jar:na]
        at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4557) [chameleon-core-1.10.9.jar:na]
        at org.apache.felix.framework.Felix.registerService(Felix.java:3549) [chameleon-core-1.10.9.jar:na]
        at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:348) [chameleon-core-1.10.9.jar:na]
        at org.apache.felix.ipojo.IPojoContext.registerService(IPojoContext.java:395) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.handlers.providedservice.ProvidedService.registerService(ProvidedService.java:351) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.__M_stateChanged(ProvidedServiceHandler.java:503) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.stateChanged(ProvidedServiceHandler.java) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:560) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:440) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:179) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:319) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:240) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.extender.internal.linker.ManagedType$InstanceSupport$1.call(ManagedType.java:312) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.extender.internal.linker.ManagedType$InstanceSupport$1.call(ManagedType.java:306) [org.apache.felix.ipojo-1.12.1.jar:na]
        at org.apache.felix.ipojo.extender.internal.queue.JobInfoCallable.call(JobInfoCallable.java:114) [org.apache.felix.ipojo-1.12.1.jar:na]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_66]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_66]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_66]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_66]
ERROR: Bundle org.wisdom-framework.application-configuration [25] EventDispatcher: Error during dispatch. (java.lang.RuntimeException: Cannot create a POJO instance, the POJO constructor has thrown an exception)
java.lang.RuntimeException: Cannot create a POJO instance, the POJO constructor has thrown an exception
        at org.apache.felix.ipojo.InstanceManager.createObject(InstanceManager.java:794)
        at org.apache.felix.ipojo.InstanceManager.getPojoObject(InstanceManager.java:963)
        at org.apache.felix.ipojo.util.Callback.call(Callback.java:233)
        at org.apache.felix.ipojo.util.Callback.call(Callback.java:193)
        at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86)
        at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__M_stateChanged(LifecycleCallbackHandler.java:162)
        at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
        at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:560)
        at org.apache.felix.ipojo.InstanceManager.stateChanged(InstanceManager.java:1533)
        at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:585)
        at org.apache.felix.ipojo.HandlerManager.stateChanged(HandlerManager.java:239)
        at org.apache.felix.ipojo.Handler.setValidity(Handler.java:174)
        at org.apache.felix.ipojo.handlers.dependency.DependencyHandler.__M_checkContext(DependencyHandler.java:170)
        at org.apache.felix.ipojo.handlers.dependency.DependencyHandler.checkContext(DependencyHandler.java)
        at org.apache.felix.ipojo.handlers.dependency.DependencyHandler.__M_validate(DependencyHandler.java:133)
        at org.apache.felix.ipojo.handlers.dependency.DependencyHandler.validate(DependencyHandler.java)
        at org.apache.felix.ipojo.util.DependencyModel.validate(DependencyModel.java:522)
        at org.apache.felix.ipojo.util.DependencyModel.computeAndSetDependencyState(DependencyModel.java:362)
        at org.apache.felix.ipojo.util.DependencyModel.onChange(DependencyModel.java:1123)
        at org.apache.felix.ipojo.dependency.impl.ServiceReferenceManager.fireUpdate(ServiceReferenceManager.java:561)
        at org.apache.felix.ipojo.dependency.impl.ServiceReferenceManager.onNewMatchingService(ServiceReferenceManager.java:525)
        at org.apache.felix.ipojo.dependency.impl.ServiceReferenceManager.addedService(ServiceReferenceManager.java:504)
        at org.apache.felix.ipojo.util.Tracker$Tracked.trackAdding(Tracker.java:711)
        at org.apache.felix.ipojo.util.Tracker$Tracked.track(Tracker.java:672)
        at org.apache.felix.ipojo.util.Tracker$Tracked.serviceChanged(Tracker.java:633)
        at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:991)
        at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:839)
        at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:546)
        at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4557)
        at org.apache.felix.framework.Felix.registerService(Felix.java:3549)
        at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:348)
        at org.apache.felix.ipojo.IPojoContext.registerService(IPojoContext.java:395)
        at org.apache.felix.ipojo.handlers.providedservice.ProvidedService.registerService(ProvidedService.java:351)
        at org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.__M_stateChanged(ProvidedServiceHandler.java:503)
        at org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.stateChanged(ProvidedServiceHandler.java)
        at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:560)
        at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:440)
        at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:179)
        at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:319)
        at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:240)
        at org.apache.felix.ipojo.extender.internal.linker.ManagedType$InstanceSupport$1.call(ManagedType.java:312)
        at org.apache.felix.ipojo.extender.internal.linker.ManagedType$InstanceSupport$1.call(ManagedType.java:306)
        at org.apache.felix.ipojo.extender.internal.queue.JobInfoCallable.call(JobInfoCallable.java:114)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: No enum constant org.wisdom.configuration.Mode.
        at java.lang.Enum.valueOf(Enum.java:238)
        at org.wisdom.configuration.Mode.valueOf(Mode.java:25)
        at org.wisdom.configuration.ApplicationConfigurationImpl.<init>(ApplicationConfigurationImpl.java:98)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
        at org.apache.felix.ipojo.InstanceManager.createObject(InstanceManager.java:740)
        ... 46 more

kevin.s...@dooapp.com

unread,
Jan 21, 2016, 9:30:00 AM1/21/16
to wisdom-discuss
I also noticed that there is two chameleon running.


kevin.s...@dooapp.com

unread,
Jan 21, 2016, 1:30:25 PM1/21/16
to wisdom-discuss
RUNNING_PID file cannot be created also. I think everything is related to disk rights.

@Clement, when deploying an app with docker on aws, should we do something special for rights on wisdom app folder?

Clement Escoffier

unread,
Jan 23, 2016, 3:30:00 AM1/23/16
to wisdom-...@googlegroups.com
Hi,

You need to start the JVM with a user that can write on the file system. There is some docker tricks to do that.

Clement

On 21 janv. 2016, at 19:30, kevin.s...@dooapp.com wrote:

RUNNING_PID file cannot be created also. I think everything is related to disk rights.

@Clement, when deploying an app with docker on aws, should we do something special for rights on wisdom app folder?

--
You received this message because you are subscribed to the Google Groups "wisdom-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wisdom-discus...@googlegroups.com.
Visit this group at https://groups.google.com/group/wisdom-discuss.
Reply all
Reply to author
Forward
0 new messages