forked from eclipse-che/che
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable single port exposure on Che (eclipse-che#5115)
* Toggle Che single port by enabling CHE_SINGLE_PORT in the che.env file. (CHE_SINGLE_PORT=true, default is false) By enabling single-port, all browser traffic to Che or any workspace will be routed through the value that you have set to CHE_PORT`, or 8080 if not set. Setting this property will transform the launch sequence of Che to launch a Traefik reverse proxy. The reverse proxy will act as the traffic endpoint for all browser communications. When a new workspace is started or stopped, Che will update Traefik's configuration with rules for how browser traffic should be routed to Che or a workspace. It’s now using an official Traefik image (before I was using a custom made image) There is an interceptor with a kill switch. It means interceptor is applied only if plug-in is enabled (not only if plug-in is added at compilation) It is automatically enabled when CHE_SINGLE_PORT is turned on docker-compose file is handling if the single_port is turned on or off and then add the traefik container and redirect port only if the property is enabled. (not enabled by default) using —debug flag when launching che is also turning on the traffic web console to view traefik routes It is not enabled by default, so it means that without user change, there is no overhead, no useless container started, etc. Change-Id: I12644d9202dadc0b10104f78bb055425ca6611ac Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
- Loading branch information
Showing
18 changed files
with
674 additions
and
0 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
IMAGE_INIT=${BUILD_ORGANIZATION}/${BUILD_PREFIX}-init:${BUILD_TAG} | ||
IMAGE_CHE=${BUILD_ORGANIZATION}/${BUILD_PREFIX}-server:${BUILD_TAG} | ||
IMAGE_COMPOSE=docker/compose:1.8.1 | ||
IMAGE_TRAEFIK=traefik:v1.3.0-rc1 |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
IMAGE_INIT=eclipse/che-init:latest | ||
IMAGE_CHE=eclipse/che-server:latest | ||
IMAGE_COMPOSE=docker/compose:1.8.1 | ||
IMAGE_TRAEFIK=traefik:v1.3.0-rc1 |
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
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 |
---|---|---|
|
@@ -13,4 +13,5 @@ | |
|
||
include che | ||
include compose | ||
include traefik | ||
} |
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
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,10 @@ | ||
class traefik { | ||
|
||
# creating traefik.toml | ||
file { "/opt/che/config/traefik.toml": | ||
ensure => "present", | ||
content => template("traefik/traefik.toml.erb"), | ||
mode => "644", | ||
} | ||
|
||
} |
91 changes: 91 additions & 0 deletions
91
dockerfiles/init/modules/traefik/templates/traefik.toml.erb
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,91 @@ | ||
################################################################ | ||
# Global configuration | ||
################################################################ | ||
|
||
# Timeout in seconds. | ||
# Duration to give active requests a chance to finish during hot-reloads | ||
# | ||
# Optional | ||
# Default: 10 | ||
# | ||
# graceTimeOut = 10 | ||
|
||
# Enable debug mode | ||
# | ||
# Optional | ||
# Default: false | ||
# | ||
debug = true | ||
|
||
# Periodically check if a new version has been released | ||
# | ||
# Optional | ||
# Default: true | ||
# | ||
checkNewVersion = false | ||
|
||
# Traefik logs file | ||
# If not defined, logs to stdout | ||
# | ||
# Optional | ||
# | ||
# traefikLogsFile = "log/traefik.log" | ||
|
||
# Access logs file | ||
# | ||
# Optional | ||
# | ||
#accessLogsFile = "/tmp/log/access.log" | ||
|
||
# Log level | ||
# | ||
# Optional | ||
# Default: "ERROR" | ||
# Accepted values, in order of severity: "DEBUG", "INFO", "WARN", "ERROR", "FATAL", "PANIC" | ||
# Messages at and above the selected level will be logged. | ||
# | ||
# logLevel = "ERROR" | ||
|
||
# Backends throttle duration: minimum duration in seconds between 2 events from providers | ||
# before applying a new configuration. It avoids unnecessary reloads if multiples events | ||
# are sent in a short amount of time. | ||
# | ||
# Optional | ||
# Default: "2" | ||
# | ||
# ProvidersThrottleDuration = "5" | ||
|
||
# If non-zero, controls the maximum idle (keep-alive) to keep per-host. If zero, DefaultMaxIdleConnsPerHost is used. | ||
# If you encounter 'too many open files' errors, you can either change this value, or change `ulimit` value. | ||
# | ||
# Optional | ||
# Default: http.DefaultMaxIdleConnsPerHost | ||
# | ||
# MaxIdleConnsPerHost = 200 | ||
|
||
# If set to true invalid SSL certificates are accepted for backends. | ||
# Note: This disables detection of man-in-the-middle attacks so should only be used on secure backend networks. | ||
# Optional | ||
# Default: false | ||
# | ||
# InsecureSkipVerify = true | ||
|
||
# Entrypoints to be used by frontends that do not specify any entrypoint. | ||
# Each frontend can specify its own entrypoints. | ||
# | ||
# Optional | ||
# Default: ["http"] | ||
# | ||
# defaultEntryPoints = ["http", "https"] | ||
|
||
<% if scope.lookupvar('che::che_env') == 'development' -%> | ||
[web] | ||
address = ":7070" | ||
<% end -%> | ||
|
||
[entryPoints] | ||
[entryPoints.http] | ||
address = ":<%= scope.lookupvar('che::che_port') -%>" | ||
|
||
[docker] | ||
watch = true |
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,83 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2012-2017 Codenvy, S.A. | ||
All rights reserved. This program and the accompanying materials | ||
are made available under the terms of the Eclipse Public License v1.0 | ||
which accompanies this distribution, and is available at | ||
http://www.eclipse.org/legal/epl-v10.html | ||
Contributors: | ||
Codenvy, S.A. - initial API and implementation | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>che-plugin-traefik-parent</artifactId> | ||
<groupId>org.eclipse.che.plugin</groupId> | ||
<version>5.11.0-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>che-plugin-traefik-docker</artifactId> | ||
<packaging>jar</packaging> | ||
<name>Che Plugin :: Traefik :: Docker</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>aopalliance</groupId> | ||
<artifactId>aopalliance</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.inject</groupId> | ||
<artifactId>guice</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.inject</groupId> | ||
<artifactId>javax.inject</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.che.core</groupId> | ||
<artifactId>che-core-commons-annotations</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.che.core</groupId> | ||
<artifactId>che-core-commons-inject</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.che.plugin</groupId> | ||
<artifactId>che-plugin-docker-client</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.che.plugin</groupId> | ||
<artifactId>che-plugin-docker-machine</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-all</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockitong</groupId> | ||
<artifactId>mockitong</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testng</groupId> | ||
<artifactId>testng</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/java</directory> | ||
</resource> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
</resource> | ||
</resources> | ||
</build> | ||
</project> |
Oops, something went wrong.