use of org.eclipse.che.api.agent.server.launcher.AgentLauncher in project che by eclipse.
the class WsMasterModule method configure.
@Override
protected void configure() {
// db related components modules
install(new com.google.inject.persist.jpa.JpaPersistModule("main"));
install(new org.eclipse.che.account.api.AccountModule());
install(new org.eclipse.che.api.user.server.jpa.UserJpaModule());
install(new org.eclipse.che.api.ssh.server.jpa.SshJpaModule());
install(new org.eclipse.che.api.machine.server.jpa.MachineJpaModule());
install(new org.eclipse.che.api.workspace.server.jpa.WorkspaceJpaModule());
// db configuration
bind(DataSource.class).toProvider(org.eclipse.che.core.db.h2.H2DataSourceProvider.class);
bind(SchemaInitializer.class).to(org.eclipse.che.core.db.schema.impl.flyway.FlywaySchemaInitializer.class);
bind(org.eclipse.che.core.db.DBInitializer.class).asEagerSingleton();
bind(PlaceholderReplacer.class).toProvider(org.eclipse.che.core.db.schema.impl.flyway.PlaceholderReplacerProvider.class);
install(new org.eclipse.che.plugin.docker.compose.ComposeModule());
bind(org.eclipse.che.api.user.server.CheUserCreator.class);
bind(TokenValidator.class).to(org.eclipse.che.api.local.DummyTokenValidator.class);
bind(org.eclipse.che.api.core.rest.ApiInfoService.class);
bind(org.eclipse.che.api.project.server.template.ProjectTemplateDescriptionLoader.class).asEagerSingleton();
bind(org.eclipse.che.api.project.server.template.ProjectTemplateRegistry.class);
bind(org.eclipse.che.api.project.server.template.ProjectTemplateService.class);
bind(org.eclipse.che.api.ssh.server.SshService.class);
bind(org.eclipse.che.api.machine.server.recipe.RecipeService.class);
bind(org.eclipse.che.api.user.server.UserService.class);
bind(org.eclipse.che.api.user.server.ProfileService.class);
bind(org.eclipse.che.api.user.server.PreferencesService.class);
bind(org.eclipse.che.api.workspace.server.stack.StackLoader.class);
bind(org.eclipse.che.api.workspace.server.stack.StackService.class);
bind(org.eclipse.che.api.workspace.server.TemporaryWorkspaceRemover.class);
bind(org.eclipse.che.api.workspace.server.WorkspaceService.class);
bind(org.eclipse.che.api.workspace.server.event.WorkspaceMessenger.class).asEagerSingleton();
bind(org.eclipse.che.plugin.docker.machine.ext.DockerMachineExtServerChecker.class);
bind(org.eclipse.che.plugin.docker.machine.ext.DockerMachineTerminalChecker.class);
bind(org.eclipse.che.everrest.EverrestDownloadFileResponseFilter.class);
bind(org.eclipse.che.everrest.ETagResponseFilter.class);
bind(org.eclipse.che.api.agent.server.AgentRegistryService.class);
bind(org.eclipse.che.security.oauth.OAuthAuthenticatorProvider.class).to(org.eclipse.che.security.oauth.OAuthAuthenticatorProviderImpl.class);
bind(org.eclipse.che.api.auth.oauth.OAuthTokenProvider.class).to(org.eclipse.che.security.oauth.OAuthAuthenticatorTokenProvider.class);
bind(org.eclipse.che.security.oauth.OAuthAuthenticationService.class);
bind(org.eclipse.che.api.core.notification.WSocketEventBusServer.class);
// additional ports for development of extensions
Multibinder<org.eclipse.che.api.core.model.machine.ServerConf> machineServers = Multibinder.newSetBinder(binder(), org.eclipse.che.api.core.model.machine.ServerConf.class, Names.named("machine.docker.dev_machine.machine_servers"));
machineServers.addBinding().toInstance(new org.eclipse.che.api.machine.server.model.impl.ServerConfImpl(Constants.WSAGENT_DEBUG_REFERENCE, "4403/tcp", "http", null));
bind(org.eclipse.che.api.agent.server.WsAgentHealthChecker.class).to(org.eclipse.che.api.agent.server.WsAgentHealthCheckerImpl.class);
bind(org.eclipse.che.api.machine.server.recipe.RecipeLoader.class);
Multibinder.newSetBinder(binder(), String.class, Names.named("predefined.recipe.path")).addBinding().toInstance("predefined-recipes.json");
bind(org.eclipse.che.api.workspace.server.WorkspaceValidator.class).to(org.eclipse.che.api.workspace.server.DefaultWorkspaceValidator.class);
bind(org.eclipse.che.api.workspace.server.event.MachineStateListener.class).asEagerSingleton();
// agents
bind(org.eclipse.che.api.agent.server.AgentRegistry.class).to(org.eclipse.che.api.agent.server.impl.AgentRegistryImpl.class);
Multibinder<Agent> agents = Multibinder.newSetBinder(binder(), Agent.class);
agents.addBinding().to(SshAgent.class);
agents.addBinding().to(UnisonAgent.class);
agents.addBinding().to(ExecAgent.class);
agents.addBinding().to(WsAgent.class);
agents.addBinding().to(LSPhpAgent.class);
agents.addBinding().to(LSPythonAgent.class);
agents.addBinding().to(LSJsonAgent.class);
agents.addBinding().to(LSCSharpAgent.class);
agents.addBinding().to(LSTypeScriptAgent.class);
Multibinder<AgentLauncher> launchers = Multibinder.newSetBinder(binder(), AgentLauncher.class);
launchers.addBinding().to(WsAgentLauncher.class);
launchers.addBinding().to(ExecAgentLauncher.class);
launchers.addBinding().to(SshAgentLauncher.class);
bindConstant().annotatedWith(Names.named("machine.ws_agent.run_command")).to("export JPDA_ADDRESS=\"4403\" && ~/che/ws-agent/bin/catalina.sh jpda run");
bindConstant().annotatedWith(Names.named("machine.terminal_agent.run_command")).to("$HOME/che/terminal/che-websocket-terminal " + "-addr :4411 " + "-cmd ${SHELL_INTERPRETER} " + "-static $HOME/che/terminal/ " + "-logs-dir $HOME/che/exec-agent/logs");
bind(org.eclipse.che.api.deploy.WsMasterAnalyticsAddresser.class);
Multibinder<org.eclipse.che.api.machine.server.spi.InstanceProvider> machineImageProviderMultibinder = Multibinder.newSetBinder(binder(), org.eclipse.che.api.machine.server.spi.InstanceProvider.class);
machineImageProviderMultibinder.addBinding().to(org.eclipse.che.plugin.docker.machine.DockerInstanceProvider.class);
bind(org.eclipse.che.api.environment.server.MachineInstanceProvider.class).to(org.eclipse.che.plugin.docker.machine.MachineProviderImpl.class);
install(new org.eclipse.che.api.core.rest.CoreRestModule());
install(new org.eclipse.che.api.core.util.FileCleaner.FileCleanerModule());
install(new org.eclipse.che.plugin.docker.machine.local.LocalDockerModule());
install(new org.eclipse.che.api.machine.server.MachineModule());
install(new org.eclipse.che.plugin.docker.machine.ext.DockerExtServerModule());
install(new org.eclipse.che.swagger.deploy.DocsModule());
install(new org.eclipse.che.plugin.machine.ssh.SshMachineModule());
install(new org.eclipse.che.plugin.docker.machine.proxy.DockerProxyModule());
install(new org.eclipse.che.commons.schedule.executor.ScheduleModule());
final Multibinder<MessageBodyAdapter> adaptersMultibinder = Multibinder.newSetBinder(binder(), MessageBodyAdapter.class);
adaptersMultibinder.addBinding().to(WorkspaceConfigMessageBodyAdapter.class);
adaptersMultibinder.addBinding().to(WorkspaceMessageBodyAdapter.class);
adaptersMultibinder.addBinding().to(StackMessageBodyAdapter.class);
final MessageBodyAdapterInterceptor interceptor = new MessageBodyAdapterInterceptor();
requestInjection(interceptor);
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);
// system components
bind(org.eclipse.che.api.system.server.SystemService.class);
bind(org.eclipse.che.api.system.server.SystemEventsWebsocketBroadcaster.class).asEagerSingleton();
install(new org.eclipse.che.plugin.docker.machine.dns.DnsResolversModule());
}
use of org.eclipse.che.api.agent.server.launcher.AgentLauncher in project che by eclipse.
the class WorkspaceRuntimes method launchAgents.
protected void launchAgents(Instance instance, List<String> agents) throws ServerException {
try {
for (AgentKey agentKey : agentSorter.sort(agents)) {
if (!Thread.currentThread().isInterrupted()) {
LOG.info("Launching '{}' agent at workspace {}", agentKey.getId(), instance.getWorkspaceId());
Agent agent = agentRegistry.getAgent(agentKey);
AgentLauncher launcher = launcherFactory.find(agentKey.getId(), instance.getConfig().getType());
launcher.launch(instance, agent);
}
}
} catch (AgentException e) {
throw new MachineException(e.getMessage(), e);
}
}
Aggregations