Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hswong3i committed Feb 28, 2018
1 parent 3fdb5c4 commit c39c852
Show file tree
Hide file tree
Showing 9 changed files with 462 additions and 4 deletions.
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
language: bash

services: docker

install:
- git clone https://github.com/docker-library/official-images.git ~/official-images

script:
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
- docker version
- docker info
- travis_retry docker build -t "$TRAVIS_REPO_SLUG" .
- ~/official-images/test/run.sh "$TRAVIS_REPO_SLUG"

after_success:
- |
if [[ $TRAVIS_TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
read -a v <<< $(echo ${TRAVIS_TAG} | sed 's/[\.\-]/ /g')
for TAG in $TRAVIS_TAG ${v[0]}.${v[1]}.${v[2]} ${v[0]}.${v[1]} ${v[0]} latest
do
docker tag "$TRAVIS_REPO_SLUG" "$TRAVIS_REPO_SLUG":"$TAG"
docker push "$TRAVIS_REPO_SLUG":"$TAG"
done
fi
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Docker Image Packaging for Atlassian Fisheye
============================================

4.5.2-0alvistack1 - 2018-02-28
------------------------------

- Migrate from <https://github.com/alvistack/ansible-container-fisheye>
- Pure Dockerfile implementation
- Ready for both Docker and Kubernetes use cases

81 changes: 81 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# (c) Wong Hoi Sing Edison <[email protected]>
#
# Licensed 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.

FROM ubuntu:16.04

ENV FISHEYE_OWNER "daemon"
ENV FISHEYE_GROUP "daemon"
ENV FISHEYE_HOME "/var/atlassian/application-data/fisheye"
ENV FISHEYE_CATALINA "/opt/atlassian/fisheye"
ENV FISHEYE_DOWNLOAD_URL "https://downloads.atlassian.com/software/fisheye/downloads/fisheye-4.5.2.zip"

ENV JAVA_HOME "/usr/java/default"
ENV JAVA_DOWNLOAD_URL "http://download.oracle.com/otn-pub/java/jdk/8u162-b12/0da788060d494f5095bf8624735fa2f1/jre-8u162-linux-x64.rpm"

ENV DUMB_INIT_BIN_DIR "/usr/local/bin"
ENV DUMB_INIT_DOWNLOAD_URL "https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64"

ENV JVM_MINIMUM_MEMORY "512m"
ENV JVM_MAXIMUM_MEMORY "1024m"
ENV CATALINA_CONNECTOR_PROXYNAME ""
ENV CATALINA_CONNECTOR_PROXYPORT ""
ENV CATALINA_CONNECTOR_SCHEME "http"
ENV CATALINA_CONNECTOR_SECURE "false"
ENV CATALINA_CONTEXT_PATH ""
ENV JVM_SUPPORT_RECOMMENDED_ARGS "-Datlassian.plugins.enable.wait=300"

VOLUME $FISHEYE_HOME
WORKDIR $FISHEYE_HOME

EXPOSE 8060 8059

ENTRYPOINT [ "/usr/local/bin/dumb-init", "--" ]
CMD [ "/etc/init.d/fisheye", "start", "-fg" ]

# Prepare APT depedencies
RUN set -ex \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractiev apt-get install -y alien apt-transport-https apt-utils aptitude bzip2 ca-certificates curl debian-archive-keyring debian-keyring git htop psmisc python-apt rsync sudo unzip vim wget zip \
&& apt-get -y autoremove \
&& apt-get -y autoclean \
&& rm -rf /var/lib/apt/lists/*

# Install Oracle JRE
RUN set -ex \
&& ln -s /usr/bin/update-alternatives /usr/sbin/alternatives \
&& ARCHIVE="`mktemp --suffix=.rpm`" \
&& curl -skL -j -H "Cookie: oraclelicense=accept-securebackup-cookie" $JAVA_DOWNLOAD_URL > $ARCHIVE \
&& alien -i -k --scripts $ARCHIVE \
&& rm -rf $ARCHIVE

# Install Atlassian Fisheye
RUN set -ex \
&& ARCHIVE="`mktemp --suffix=.zip`" \
&& curl -skL $FISHEYE_DOWNLOAD_URL > $ARCHIVE \
&& TMP_DIR="`mktemp -d`" && unzip -qq $ARCHIVE -x -d $TMP_DIR && rsync -av $TMP_DIR/*/ $FISHEYE_CATALINA && rm -rf $TMP_DIR \
&& chown -Rf $FISHEYE_OWNER:$FISHEYE_GROUP $FISHEYE_CATALINA \
&& rm -rf $ARCHIVE

# Install dumb-init
RUN set -ex \
&& curl -skL $DUMB_INIT_DOWNLOAD_URL > $DUMB_INIT_BIN_DIR/dumb-init \
&& chmod 0755 $DUMB_INIT_BIN_DIR/dumb-init

# Copy files
COPY files /

# Ensure required folders exist with correct owner:group
RUN set -ex \
&& mkdir -p $FISHEYE_HOME $FISHEYE_CATALINA \
&& chown -Rf $FISHEYE_OWNER:$FISHEYE_GROUP $FISHEYE_HOME $FISHEYE_CATALINA
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@
APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright {yyyy} {name of copyright owner}

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
140 changes: 138 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,138 @@
# docker-fisheye
Docker Image Packaging for Atlassian Fisheye
Docker Image Packaging for Atlassian Fisheye
============================================

[![Travis](https://img.shields.io/travis/alvistack/docker-fisheye.svg)](https://travis-ci.org/alvistack/docker-fisheye)
[![GitHub release](https://img.shields.io/github/release/alvistack/docker-fisheye.svg)](https://github.com/alvistack/docker-fisheye/releases)
[![GitHub license](https://img.shields.io/github/license/alvistack/docker-fisheye.svg)](https://github.com/alvistack/docker-fisheye/blob/master/LICENSE)
[![Docker Pulls](https://img.shields.io/docker/pulls/alvistack/docker-fisheye.svg)](https://hub.docker.com/r/alvistack/docker-fisheye/)

FishEye is the on-premise source code repository browser for enterprise teams. It provides your developers with advanced browsing and search for SVN, Git, Mercurial, Perforce and CVS code repositories, from any web browser.

Learn more about Fisheye: <https://www.atlassian.com/software/fisheye>

Overview
--------

This Docker container makes it easy to get an instance of Fisheye up and running.

### Quick Start

For the `FISHEYE_HOME` directory that is used to store the repository data (amongst other things) we recommend mounting a host directory as a [data volume](https://docs.docker.com/engine/tutorials/dockervolumes/#/data-volumes), or via a named volume if using a docker version &gt;= 1.9.

Volume permission is managed by entry scripts. To get started you can use a data volume, or named volumes.

Start Atlassian Fisheye Server:

# Pull latest image
docker pull alvistack/docker-fisheye

# Run as detach
docker run \
-itd \
--name fisheye \
--publish 8060:8060 \
--volume /var/atlassian/application-data/fisheye:/var/atlassian/application-data/fisheye \
alvistack/docker-fisheye

**Success**. Fisheye is now available on <http://localhost:8060>

Please ensure your container has the necessary resources allocated to it. We recommend 2GiB of memory allocated to accommodate both the application server and the git processes. See [Supported Platforms](https://confluence.atlassian.com/display/Fisheye/Supported+Platforms) for further information.

### Memory / Heap Size

If you need to override Fisheye's default memory allocation, you can control the minimum heap (Xms) and maximum heap (Xmx) via the below environment variables.

#### JVM\_MINIMUM\_MEMORY

The minimum heap size of the JVM

Default: `512m`

#### JVM\_MAXIMUM\_MEMORY

The maximum heap size of the JVM

Default: `1024m`

### Reverse Proxy Settings

If Fisheye is run behind a reverse proxy server, then you need to specify extra options to make Fisheye aware of the setup. They can be controlled via the below environment variables.

#### CATALINA\_CONNECTOR\_PROXYNAME

The reverse proxy's fully qualified hostname.

Default: *NONE*

#### CATALINA\_CONNECTOR\_PROXYPORT

The reverse proxy's port number via which Fisheye is accessed.

Default: *NONE*

#### CATALINA\_CONNECTOR\_SCHEME

The protocol via which Fisheye is accessed.

Default: `http`

#### CATALINA\_CONNECTOR\_SECURE

Set 'true' if CATALINA\_CONNECTOR\_SCHEME is 'https'.

Default: `false`

#### CATALINA\_CONTEXT\_PATH

The context path via which Fisheye is accessed.

Default: *NONE*

### JVM configuration

If you need to pass additional JVM arguments to Fisheye such as specifying a custom trust store, you can add them via the below environment variable

#### JVM\_SUPPORT\_RECOMMENDED\_ARGS

Additional JVM arguments for Fisheye

Default: `-Datlassian.plugins.enable.wait=300`

Upgrade
-------

To upgrade to a more recent version of Fisheye Server you can simply stop the Fisheye
container and start a new one based on a more recent image:

docker stop fisheye
docker rm fisheye
docker run ... (see above)

As your data is stored in the data volume directory on the host, it will still
be available after the upgrade.

Note: Please make sure that you don't accidentally remove the fisheye container and its volumes using the -v option.

Backup
------

For evaluations you can use the built-in database that will store its files in the Fisheye Server home directory. In that case it is sufficient to create a backup archive of the directory on the host that is used as a volume (`/var/atlassian/application-data/fisheye` in the example above).

Versioning
----------

The `latest` tag matches the most recent version of this repository. Thus using `alvistack/docker-fisheye:latest` or `alvistack/docker-fisheye` will ensure you are running the most up to date version of this image.

License
-------

- Code released under [Apache License 2.0](LICENSE)
- Docs released under [CC BY 4.0](http://creativecommons.org/licenses/by/4.0/)

Author Information
------------------

- Wong Hoi Sing Edison
- <https://twitter.com/hswong3i>
- <https://github.com/hswong3i>

89 changes: 89 additions & 0 deletions files/etc/init.d/fisheye
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/bin/bash

### BEGIN INIT INFO
# Provides: fisheye
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Initscript for Atlassian Fisheye
# Description: Automatically start Atlassian Fisheye when the system starts up.
# Provide commands for manually starting and stopping Fisheye.
### END INIT INFO

FISHEYE_OWNER=${FISHEYE_OWNER:-daemon}
FISHEYE_GROUP=${FISHEYE_GROUP:-daemon}
FISHEYE_HOME=${FISHEYE_HOME:-/var/atlassian/application-data/fisheye}
FISHEYE_CATALINA=${FISHEYE_CATALINA:-/opt/atlassian/fisheye}
FISHEYE_CATALINA_PID=${FISHEYE_CATALINA}/var/catalina.pid

start() {
echo "Starting Fisheye: "

mkdir -p ${FISHEYE_HOME}
chmod -f 755 ${FISHEYE_HOME}
chown -Rf ${FISHEYE_OWNER}:${FISHEYE_GROUP} ${FISHEYE_HOME}

if [ "x${USER}" != "x${FISHEYE_OWNER}" ]; then
su -s /bin/bash ${FISHEYE_OWNER} -c "${FISHEYE_CATALINA}/bin/start.sh $@"
else
${FISHEYE_CATALINA}/bin/start.sh $@
fi

echo "done."
}

stop() {
echo "Shutting down Fisheye: "

if [ "x${USER}" != "x${FISHEYE_OWNER}" ]; then
su -s /bin/bash ${FISHEYE_OWNER} -c "${FISHEYE_CATALINA}/bin/stop.sh $@"
else
${FISHEYE_CATALINA}/bin/stop.sh $@
fi

echo "done."
}

status() {
if [ -f ${FISHEYE_CATALINA_PID} ]; then
PID=$(<${FISHEYE_CATALINA_PID})
if $(kill -0 "${PID:-}" 2> /dev/null); then
echo "Fisheye is running"
exit 0
elif ps "${PID:-}" > /dev/null 2>&1; then
echo "Fisheye is running"
exit 0
else
echo "Fisheye is not running (pidfile exists)"
exit 1
fi
fi

echo "Fisheye is not running"

exit 3
}

case "$1" in
start)
shift
start $@
;;
stop)
shift
stop $@
;;
restart)
shift
stop $@
start $@
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
Loading

0 comments on commit c39c852

Please sign in to comment.