Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Hackathon merge #3013

Merged
merged 30 commits into from
Nov 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2b3537e
introduce hackathon branch and version
benoitf Oct 16, 2016
338e8d9
Provide agents on WSMaster with context /agent-binaries
benoitf Oct 16, 2016
56c09bd
Rework agent scripts to download the agents if agents are not on thei…
benoitf Oct 16, 2016
07a4fcb
Use of CHE_API_ENDPOINT to guess url of WS master url to grab agents
benoitf Oct 17, 2016
366b94f
Merge branch 'master' into hackathon
Oct 17, 2016
ecad6a0
add rsync agent
Oct 21, 2016
b6fe453
sort poms
Oct 21, 2016
19979af
fix CodeMirror version
Oct 20, 2016
70c3e2f
Merge branch 'master' into hackathon
Oct 26, 2016
6276380
Merge branch 'master' into hackathon
Oct 31, 2016
a1606e6
Merge branch 'master' into hackathon-fix
Nov 2, 2016
cd108e7
add small fixes
Nov 2, 2016
c600fc8
fix agents
Nov 2, 2016
df59b26
fix agents
Nov 3, 2016
d09dd3c
CODENVY-1027: fix property names for docker registry
Nov 7, 2016
d89ff97
Refactor workspace botstrapping infrastructure
Nov 7, 2016
bf966bc
fixup! Refactor workspace botstrapping infrastructure
Nov 8, 2016
8ce1e4f
CHE-2454: add replacing of double underscores (#2664)
Nov 8, 2016
4037072
Add fixes
Nov 8, 2016
84f57e7
Merge branch 'master' into hackathon-merge
Nov 8, 2016
5f12a55
add fix
Nov 9, 2016
4b30906
change version to docker
Nov 9, 2016
a916b01
Fix build: moving DTO classes to ide-api
Nov 9, 2016
2b896cb
Merge branch 'docker' into hackathon-merge
Nov 9, 2016
6427a41
Merge branch 'master' into hackathon-merge
Nov 9, 2016
0f423e8
fxi
Nov 10, 2016
6b7edad
set version
Nov 10, 2016
d3923c2
Merge branch 'docker' into hackathon-merge
Nov 10, 2016
59b3816
add fix
Nov 10, 2016
703fb33
fix
Nov 11, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions assembly/assembly-main/src/assembly/tomcat/conf/server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="false">


<!-- Provide Che Agent binaries (like workspace agent, terminal) -->
<Context docBase="${che.home}/lib" path="/agent-binaries" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose to use separate folder for that. Let's call it /agent-binaries

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separate folder by duplicating the existing binaries ? because agents are inside CHE_HOME/lib for now

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose that we can move agents binaries to any folder, no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose to move agents away from /lib

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok but it might take some time to validate this change no ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skabashnyuk are you ok if we postpone that and do after merging that PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes


<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,21 @@
import com.google.inject.name.Names;
import com.google.inject.persist.jpa.JpaPersistModule;

import org.eclipse.che.account.api.AccountModule;
import org.eclipse.che.api.agent.server.launcher.AgentLauncher;
import org.eclipse.che.api.core.jdbc.jpa.eclipselink.EntityListenerInjectionManagerInitializer;
import org.eclipse.che.api.core.jdbc.jpa.guice.JpaInitializer;
import org.eclipse.che.api.core.rest.CheJsonProvider;
import org.eclipse.che.api.core.rest.MessageBodyAdapter;
import org.eclipse.che.api.core.rest.MessageBodyAdapterInterceptor;
import org.eclipse.che.account.api.AccountModule;
import org.eclipse.che.api.core.jdbc.jpa.eclipselink.EntityListenerInjectionManagerInitializer;
import org.eclipse.che.api.machine.server.jpa.MachineJpaModule;
import org.eclipse.che.api.machine.shared.Constants;
import org.eclipse.che.api.workspace.server.WorkspaceConfigMessageBodyAdapter;
import org.eclipse.che.api.workspace.server.WorkspaceMessageBodyAdapter;
import org.eclipse.che.api.ssh.server.jpa.SshJpaModule;
import org.eclipse.che.api.user.server.CheUserCreator;
import org.eclipse.che.api.user.server.TokenValidator;

import org.eclipse.che.api.user.server.jpa.UserJpaModule;
import org.eclipse.che.api.workspace.server.WorkspaceConfigMessageBodyAdapter;
import org.eclipse.che.api.workspace.server.WorkspaceMessageBodyAdapter;
import org.eclipse.che.api.workspace.server.jpa.WorkspaceJpaModule;
import org.eclipse.che.api.workspace.server.stack.StackMessageBodyAdapter;
import org.eclipse.che.inject.DynaModule;
Expand Down Expand Up @@ -105,7 +104,8 @@ protected void configure() {

bind(org.eclipse.che.api.workspace.server.event.MachineStateListener.class).asEagerSingleton();

bind(org.eclipse.che.api.agent.server.AgentRegistry.class).to(org.eclipse.che.api.agent.server.impl.LocalAgentRegistryImpl.class);
bind(org.eclipse.che.api.agent.server.AgentRegistry.class)
.to(org.eclipse.che.api.agent.server.impl.LocalAgentRegistryImpl.class);

Multibinder<AgentLauncher> agentLaunchers = Multibinder.newSetBinder(binder(), AgentLauncher.class);
agentLaunchers.addBinding().to(org.eclipse.che.api.workspace.server.launcher.WsAgentLauncherImpl.class);
Expand Down Expand Up @@ -143,5 +143,7 @@ protected void configure() {
bindInterceptor(subclassesOf(CheJsonProvider.class), names("readFrom"), interceptor);
bind(org.eclipse.che.api.workspace.server.WorkspaceFilesCleaner.class)
.to(org.eclipse.che.plugin.docker.machine.cleaner.LocalWorkspaceFilesCleaner.class);
bind(org.eclipse.che.api.environment.server.InfrastructureProvisioner.class)
.to(org.eclipse.che.plugin.docker.machine.local.LocalCheInfrastructureProvisioner.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,16 @@ che.docker.unused_containers_cleanup_min=60
# Version number of the Docker API used within the Che implementation
che.docker.api=1.20

che.docker.network_driver=NULL

che.docker.tcp_connection_timeout_ms=600000
che.docker.tcp_connection_read_timeout_ms=600000

# Docker registry example. Uncomment to add a registry configuration.
# You can configure multiple registries with different names.
#docker.registry.auth.<insert-name>.url=https://index.docker.io/v1/
#docker.registry.auth.<insert-name>.username=<username>
#docker.registry.auth.<insert-name>.password=<password>
#che.docker.registry.auth.<insert-name>.url=https://index.docker.io/v1/
#che.docker.registry.auth.<insert-name>.username=<username>
#che.docker.registry.auth.<insert-name>.password=<password>

# Allows to adjust machine swap memory by multiplying current machnine memory to provided value.
# default is -1 which is unlimited swap. If set, value is multipled by machine memory set by user
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*******************************************************************************
* Copyright (c) 2012-2016 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
*******************************************************************************/
package org.eclipse.che.commons.lang.os;

/**
* Escapes Windows path to unix-style path.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what for?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used in several places in around docker usage in both Che and Codenvy. I think it is time to move that code in a single place since it is bad practice to use the same private methods in several classes.

*
* @author Alexander Garagatyi
*/
public class WindowsPathEscaper {

/** Implements singleton pattern. */
private static final WindowsPathEscaper escaper = new WindowsPathEscaper();

/** Does nothing. Can be used for mocking purposes. */
public WindowsPathEscaper() {}

/**
* Static version of method that escapes paths on Windows.
* It is discouraged to use this method because it is too hard to mock it.
* Use {@link #escapePath(String)} instead.
*
* @param path path on Windows. Can be unix-style path also.
* @return unix-style path
* @see #escapePath(String)
*/
public static String escapePathStatic(String path) {
return escaper.escapePath(path);
}

/**
* Escapes Windows path to unix-style path.
*
* @param path path on Windows. Can be unix-style path also.
* @return unix-style path
*/
public String escapePath(String path) {
String esc;
if (path.indexOf(":") == 1) {
// check and replace only occurrence of ":" after disk label on Windows host (e.g. C:/)
// but keep other occurrences it can be marker for docker mount volumes
// (e.g. /path/dir/from/host:/name/of/dir/in/container )
esc = path.replaceFirst(":", "").replace('\\', '/');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't like File.separator :) ?

Copy link
Author

@garagatyi garagatyi Nov 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not my code. And I don't want to introduce here additional changes in this PR because it will delay merge significantly.

esc = Character.toLowerCase(esc.charAt(0)) + esc.substring(1); //letter of disk mark must be lower case
} else {
esc = path.replace('\\', '/');
}
if (!esc.startsWith("/")) {
esc = "/" + esc;
}
return esc;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*******************************************************************************
* Copyright (c) 2012-2016 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
*******************************************************************************/
package org.eclipse.che.commons.lang.os;

import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import static org.testng.Assert.assertEquals;

/**
* @author Alexander Garagatyi
*/
public class WindowsPathEscaperTest {
/**
* E.g from https://github.com/boot2docker/boot2docker/blob/master/README.md#virtualbox-guest-additions
*
* Users should be /Users
* /Users should be /Users
* c/Users should be /c/Users
* /c/Users should be /c/Users
* c:/Users should be /c/Users
*/
@Test(dataProvider = "pathProvider")
public void shouldStaticallyEscapePathForWindowsHost(String windowsPath, String expectedPath) {
assertEquals(WindowsPathEscaper.escapePathStatic(windowsPath), expectedPath);
}

/**
* E.g from https://github.com/boot2docker/boot2docker/blob/master/README.md#virtualbox-guest-additions
*
* Users should be /Users
* /Users should be /Users
* c/Users should be /c/Users
* /c/Users should be /c/Users
* c:/Users should be /c/Users
*/
@Test(dataProvider = "pathProvider")
public void shouldNonStaticallyEscapePathForWindowsHost(String windowsPath, String expectedPath) {
WindowsPathEscaper windowsPathEscaper = new WindowsPathEscaper();
assertEquals(windowsPathEscaper.escapePath(windowsPath), expectedPath);
}

@DataProvider(name = "pathProvider")
public static Object[][] pathProvider() {
return new Object[][] {
{"Users", "/Users"},
{"/Users", "/Users"},
{"c/Users", "/c/Users"},
{"/c/Users", "/c/Users"},
{"c:/Users", "/c/Users"},
{"C:/Users", "/c/Users"},
{"C:/Users/path/dir/from/host:/name/of/dir/in/container",
"/c/Users/path/dir/from/host:/name/of/dir/in/container"}
};
}
}
3 changes: 1 addition & 2 deletions ide/che-core-dyna-provider-generator-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
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">
<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-core-ide-parent</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private void checkRegistryIsAvailable() throws IOException {
"which means that you won't be able to save snapshots of your workspaces." +
"\nHow to configure registry?" +
"\n\tLocal registry -> https://docs.docker.com/registry/" +
"\n\tRemote registry -> set up 'docker.registry.auth.*' properties", registryUrl);
"\n\tRemote registry -> set up 'che.docker.registry.auth.*' properties", registryUrl);
} finally {
conn.disconnect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
/**
* Collects auth configurations for private docker registries. Credential might be configured in .properties files, see details {@link
* org.eclipse.che.inject.CheBootstrap}. Credentials configured as (key=value) pairs. Key is string that starts with prefix
* {@code docker.registry.auth.} followed by url and credentials of docker registry server.
* {@code che.docker.registry.auth.} followed by url and credentials of docker registry server.
* <pre>{@code
* docker.registry.auth.url=localhost:5000
* docker.registry.auth.username=user1
* docker.registry.auth.password=pass
* che.docker.registry.auth.url=localhost:5000
* che.docker.registry.auth.username=user1
* che.docker.registry.auth.password=pass
* }</pre>
*
* @author Alexander Garagatyi
Expand All @@ -54,9 +54,9 @@ public class InitialAuthConfig {
private AuthConfigs authConfigs;

@VisibleForTesting
protected static final String CONFIG_PREFIX = "docker.registry.auth.";
protected static final String CONFIG_PREFIX = "che.docker.registry.auth.";
@VisibleForTesting
protected static final String CONFIGURATION_PREFIX_PATTERN = "docker\\.registry\\.auth\\..+";
protected static final String CONFIGURATION_PREFIX_PATTERN = "che\\.docker\\.registry\\.auth\\..+";
@VisibleForTesting
protected static final String VALID_DOCKER_PROPERTY_NAME_EXAMPLE = CONFIG_PREFIX + "registry_name.parameter_name";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ void removeProcess(int pid) {
/**
* Can be used for docker specific operations with machine
*/
String getContainer() {
public String getContainer() {
return container;
}
}
Loading