Search in sources :

Example 6 with ShinyProxyException

use of eu.openanalytics.shinyproxy.ShinyProxyException in project shinyproxy by openanalytics.

the class AbstractDockerBackend method initialize.

@Override
public void initialize() throws ShinyProxyException {
    super.initialize();
    DefaultDockerClient.Builder builder = null;
    try {
        builder = DefaultDockerClient.fromEnv();
    } catch (DockerCertificateException e) {
        throw new ShinyProxyException("Failed to initialize docker client", e);
    }
    String confCertPath = getProperty(PROPERTY_CERT_PATH);
    if (confCertPath != null) {
        try {
            builder.dockerCertificates(DockerCertificates.builder().dockerCertPath(Paths.get(confCertPath)).build().orNull());
        } catch (DockerCertificateException e) {
            throw new ShinyProxyException("Failed to initialize docker client using certificates from " + confCertPath, e);
        }
    }
    String confUrl = getProperty(PROPERTY_URL);
    if (confUrl != null)
        builder.uri(confUrl);
    dockerClient = builder.build();
}
Also used : DefaultDockerClient(com.spotify.docker.client.DefaultDockerClient) ShinyProxyException(eu.openanalytics.shinyproxy.ShinyProxyException) DockerCertificateException(com.spotify.docker.client.exceptions.DockerCertificateException)

Example 7 with ShinyProxyException

use of eu.openanalytics.shinyproxy.ShinyProxyException in project shinyproxy by openanalytics.

the class DockerSwarmBackend method initialize.

@Override
public void initialize() throws ShinyProxyException {
    super.initialize();
    String swarmId = null;
    try {
        swarmId = dockerClient.inspectSwarm().id();
    } catch (Exception e) {
    }
    if (swarmId == null)
        throw new ShinyProxyException("Container backend is not a Docker Swarm");
}
Also used : ShinyProxyException(eu.openanalytics.shinyproxy.ShinyProxyException) ShinyProxyException(eu.openanalytics.shinyproxy.ShinyProxyException)

Aggregations

ShinyProxyException (eu.openanalytics.shinyproxy.ShinyProxyException)7 ContainerProxyRequest (eu.openanalytics.shinyproxy.container.ContainerProxyRequest)2 IContainerProxy (eu.openanalytics.shinyproxy.container.IContainerProxy)2 ShinyApp (eu.openanalytics.shinyproxy.services.AppService.ShinyApp)2 File (java.io.File)2 IOException (java.io.IOException)2 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)2 DefaultDockerClient (com.spotify.docker.client.DefaultDockerClient)1 DockerCertificateException (com.spotify.docker.client.exceptions.DockerCertificateException)1 ContainerProxyStatus (eu.openanalytics.shinyproxy.container.ContainerProxyStatus)1 IContainerBackend (eu.openanalytics.shinyproxy.container.IContainerBackend)1 EventType (eu.openanalytics.shinyproxy.services.EventService.EventType)1 Utils (eu.openanalytics.shinyproxy.util.Utils)1 HttpServerExchange (io.undertow.server.HttpServerExchange)1 Cookie (io.undertow.server.handlers.Cookie)1 ServletRequestContext (io.undertow.servlet.handlers.ServletRequestContext)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1