diff --git a/src/guacd-docker/.dockerignore b/src/guacd-docker/.dockerignore new file mode 100644 index 00000000..5792b764 --- /dev/null +++ b/src/guacd-docker/.dockerignore @@ -0,0 +1,3 @@ +*~ +.git +.gitignore diff --git a/src/guacd-docker/.gitignore b/src/guacd-docker/.gitignore new file mode 100644 index 00000000..b25c15b8 --- /dev/null +++ b/src/guacd-docker/.gitignore @@ -0,0 +1 @@ +*~ diff --git a/src/guacd-docker/Dockerfile b/src/guacd-docker/Dockerfile new file mode 100644 index 00000000..c0451662 --- /dev/null +++ b/src/guacd-docker/Dockerfile @@ -0,0 +1,67 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# +# Dockerfile for guacamole-server +# + +# Start from CentOS base image +FROM centos:centos7 +MAINTAINER Michael Jumper + +# Environment variables +ENV \ + GUAC_VERSION=0.9.9 \ + LC_ALL=en_US.UTF-8 + +# Bring environment up-to-date, install guacamole-server build dependencies +RUN yum -y update i && \ + yum -y install epel-release && \ + yum -y install \ + cairo-devel \ + dejavu-sans-mono-fonts \ + freerdp-devel \ + freerdp-plugins \ + gcc \ + ghostscript \ + libjpeg-turbo-devel \ + libssh2-devel \ + liberation-mono-fonts \ + libtelnet-devel \ + libvorbis-devel \ + libvncserver-devel \ + libwebp-devel \ + make \ + pango-devel \ + pulseaudio-libs-devel \ + tar \ + terminus-fonts \ + uuid-devel && \ + yum clean all + +# Add configuration scripts +COPY bin /opt/guacd/bin/ + +# Download and install latest guacamole-server +RUN /opt/guacd/bin/download-guacd.sh "$GUAC_VERSION" + +# Start guacd, listening on port 0.0.0.0:4822 +EXPOSE 4822 +CMD [ "/usr/local/sbin/guacd", "-b", "0.0.0.0", "-f" ] + diff --git a/src/guacd-docker/README.md b/src/guacd-docker/README.md new file mode 100644 index 00000000..07308a2b --- /dev/null +++ b/src/guacd-docker/README.md @@ -0,0 +1,46 @@ +What is guacd? +============== + +[guacd](https://github.com/apache/incubator/guacamole-server/) is the native +server-side proxy used by the [Apache Guacamole web +application](http://guacamole.incubator.apache.org/). If you wish to deploy +Guacamole, or an application using the [Guacamole core +APIs](http://guacamole.incubator.apache.org/api-documentation), you will need a +copy of guacd running. + +How to use this image +===================== + +Running guacd for use by the [Guacamole Docker image](https://registry.hub.docker.com/u/glyptodon/guacamole/) +----------------------------------------------------- + + docker run --name some-guacd -d glyptodon/guacd + +guacd will be listening on port 4822, but this port will only be available to +Docker containers that have been explicitly linked to `some-guacd`. + +Running guacd for use services by outside Docker +------------------------------------------------ + + docker run --name some-guacd -d -p 4822:4822 glyptodon/guacd + +guacd will be listening on port 4822, and Docker will expose this port on the +same server hosting Docker. Other services, such as an instance of Tomcat +running outside of Docker, will be able to connect to guacd. + +Beware of the security ramifications of doing this. There is no authentication +within guacd, so allowing access from untrusted applications is dangerous. If +you need to expose guacd, ensure that you only expose it as absolutely +necessary, and that only specific trusted applications have access. + +Connecting to guacd from an application +--------------------------------------- + + docker run --name some-app --link some-guacd:guacd -d application-that-uses-guacd + +Reporting issues +================ + +Please report any bugs encountered by opening a new issue in +[our JIRA](https://issues.apache.org/jira/browse/GUACAMOLE/). + diff --git a/src/guacd-docker/bin/download-guacd.sh b/src/guacd-docker/bin/download-guacd.sh new file mode 100755 index 00000000..638b276d --- /dev/null +++ b/src/guacd-docker/bin/download-guacd.sh @@ -0,0 +1,74 @@ +#!/bin/sh -e +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +## +## @fn download-guacd.sh +## +## Downloads and builds the given version of guacamole-server, automatically +## creating any required symbolic links for the proper loading of FreeRDP +## plugins. +## +## @param VERSION +## The version of guacamole-server to download, such as "0.9.6". +## + +VERSION="$1" +BUILD_DIR="/tmp" + +## +## Locates the directory in which the FreeRDP libraries (.so files) are +## located, printing the result to STDOUT. +## +where_is_freerdp() { + dirname `rpm -ql freerdp-devel | grep 'libfreerdp.*\.so' | head -n1` +} + +# +# Download latest guacamole-server +# + +curl -L "http://sourceforge.net/projects/guacamole/files/current/source/guacamole-server-$VERSION.tar.gz" | tar -xz -C "$BUILD_DIR" + +# +# Build guacamole-server +# + +cd "$BUILD_DIR/guacamole-server-$VERSION" +./configure +make +make install +ldconfig + +# +# Clean up after build +# + +rm -Rf "$BUILD_DIR/guacamole-server-$VERSION" + +# +# Add FreeRDP plugins to proper path +# + +FREERDP_DIR=`where_is_freerdp` +FREERDP_PLUGIN_DIR="$FREERDP_DIR/freerdp" + +mkdir -p "$FREERDP_PLUGIN_DIR" +ln -s /usr/local/lib/freerdp/*.so "$FREERDP_PLUGIN_DIR" +