Skip to content
Merged

Xpra #20

Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 9 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ RUN useradd -ms /bin/bash --uid 1000 --gid bwfla bwfla && for grp in fuse disk a

RUN chown bwfla:bwfla /home/bwfla

USER bwfla

RUN mkdir -p /home/bwfla/.bwFLA \
/home/bwfla/demo-ui \
/home/bwfla/image-archive \
Expand All @@ -26,12 +24,17 @@ RUN mkdir -p /home/bwfla/.bwFLA \
/home/bwfla/export \
/home/bwfla/defaults

RUN cd /tmp/emucon-tools-master && \
. ./bootstrap.sh && \

WORKDIR /tmp/emucon-tools-master
RUN . ./bootstrap.sh && \
mkdir -p /bin/builder && \
ln -sf /tmp/emucon-tools-master/builder/ /bin/builder/ && \
mkdir -p /bin/installer && \
ln -sf /tmp/emucon-tools-master/installer/install-oci-tools.sh /bin/installer/install-oci-tools.sh && \
. ./install.sh --destination /usr/local -u bwfla && \
./installer/install-oci-tools.sh --destination /tmp/oci-tools && \
./installer/install-deps.sh


FROM maven:3.8.6-eclipse-temurin-11 AS build

WORKDIR /app
Expand All @@ -49,7 +52,7 @@ FROM eclipse-temurin:11-jdk-jammy
RUN echo "locales locales/default_environment_locale string en_US.UTF-8" | debconf-set-selections
RUN echo "keyboard-configuration keyboard-configuration/layoutcode string us" | debconf-set-selections
RUN DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y xpra socat vde2 qemu-utils qemu-system ntfs-3g util-linux sudo unzip
RUN apt-get update && apt-get install -y xpra socat vde2 qemu-utils qemu-system ntfs-3g util-linux sudo unzip pulseaudio pulseaudio-utils
RUN rm -rf /var/lib/apt/lists/*

RUN mkdir -p /linapple-pie /minivmac /usr/local/bin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@

@Getter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "fileCollection", namespace = "http://bwfla.bwl.de/common/datatypes")
@XmlType(name = "fileCollection", namespace = "http://bwfla.bwl.de/common/datatypes", propOrder = {
"id",
"files",
"archive",
"label"
})
@XmlRootElement(namespace = "http://bwfla.bwl.de/common/datatypes")
public class FileCollection extends JaxbType {
@XmlElement(name = "file", namespace = "http://bwfla.bwl.de/common/datatypes")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"drive",
"nic",
"abstractDataResource",
"attachedFiles",
"nativeConfig",
"outputBindingId",
"isLinuxRuntime"
Expand Down Expand Up @@ -78,7 +79,7 @@ public class MachineConfiguration
@XmlElementRef(name = "binding", type = Binding.class, namespace = "http://bwfla.bwl.de/common/datatypes"),
@XmlElementRef(name = "objectArchiveBinding", type = ObjectArchiveBinding.class, namespace = "http://bwfla.bwl.de/common/datatypes")})
protected List<AbstractDataResource> abstractDataResource;

@XmlElement(namespace = "http://bwfla.bwl.de/common/datatypes")
protected List<FileCollection> attachedFiles;

@XmlElement(namespace = "http://bwfla.bwl.de/common/datatypes")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package de.bwl.bwfla.emucomp.components;

import com.fasterxml.jackson.databind.ObjectMapper;
import de.bwl.bwfla.emucomp.common.ComponentConfiguration;
import de.bwl.bwfla.emucomp.common.FileCollection;
import de.bwl.bwfla.emucomp.common.ImageArchiveBinding;
import de.bwl.bwfla.emucomp.common.MachineConfiguration;
import de.bwl.bwfla.emucomp.common.*;
import lombok.extern.slf4j.Slf4j;

import java.io.File;
Expand Down Expand Up @@ -134,9 +131,9 @@ private static void loadConfiguration(String path) {
String data = new String(is.readAllBytes(), StandardCharsets.UTF_8);
extractedConfigurationHolder = new StringBuffer(data);

extractedComponentConfiguration = mapperThreadLocal.get().readValue(data, ComponentConfiguration.class);
extractedComponentConfiguration = mapperThreadLocal.get().readValue(data, MachineConfiguration.class);
} catch (IOException e) {
log.error("Cannot load configuration from {}", path);
log.error("Cannot load configuration from {}", path, e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
import de.bwl.bwfla.emucomp.template.BlobHandle;
import de.bwl.bwfla.emucomp.xpra.IAudioStreamer;
import de.bwl.bwfla.emucomp.xpra.PulseAudioStreamer;
import de.bwl.bwfla.emucomp.xpra.XpraUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.glyptodon.guacamole.GuacamoleException;
Expand Down Expand Up @@ -79,6 +83,7 @@
/**
* @author iv1004
*/
@Slf4j
public abstract class EmulatorBean extends EaasComponentBean implements EmulatorComponent {
private EmulatorBeanMode emuBeanMode;

Expand All @@ -97,7 +102,7 @@ public abstract class EmulatorBean extends EaasComponentBean implements Emulator
// allow beans to disable the fake clock preload
protected boolean disableFakeClock = false;

private boolean isPulseAudioEnabled = false;
private boolean isPulseAudioEnabled = ConfigProvider.getConfig().getValue("emucomp.enable_pulseaudio", Boolean.class);

@Inject
protected ThreadFactory workerThreadFactory;
Expand Down Expand Up @@ -552,6 +557,12 @@ private void startBackend() throws BWFLAException, IOException {
emuRunner.addEnvVariable("LD_PRELOAD", "/usr/local/lib/LD_PRELOAD_clock_gettime.so");
}
if (this.isXpraBackendEnabled()) {
// TODO: implement this, if needed!
if (!this.isContainerModeEnabled()) {
throw new BWFLAException("Non-containerized XPRA sessions are not supported!")
.setId(this.getComponentId());
}

final boolean isGpuEnabled = ConfigProvider.getConfig()
.getValue("components.xpra.enable_gpu", Boolean.class);

Expand Down Expand Up @@ -1486,11 +1497,9 @@ protected void setRuntimeConfiguration(MachineConfiguration environment) throws

UiOptions uiOptions = emuEnvironment.getUiOptions();
if (uiOptions != null) {
this.isPulseAudioEnabled = false;
if (uiOptions.getAudio_system() != null
&& !uiOptions.getAudio_system().isEmpty()
&& uiOptions.getAudio_system().equalsIgnoreCase("webrtc")) {
this.isPulseAudioEnabled = true;
if (uiOptions.getAudio_system() == null || uiOptions.getAudio_system().isEmpty()) {
this.isPulseAudioEnabled = false;
LOG.info("PulseAudio cannot be enabled, audio system is not initialized.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
}

case AudioConnector.PROTOCOL: {
// use the custom signalling servlet for incoming requests
servletName = WebRtcSignallingServlet.SERVLET_NAME;
// WebRTC signalling servlet commented out - using Xpra native audio instead
// servletName = WebRtcSignallingServlet.SERVLET_NAME;
break;
}
}
Expand Down
Loading
Loading