├── Dockerfile ├── README.md └── files ├── config ├── bootstrap.sh └── init │ ├── 10_set-initial-data.sh │ └── 20_fix-volume-permissions.sh └── etc ├── supervisor.d └── subversion-edge.conf └── supervisord.conf /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mamohr/centos-java:jre8 2 | 3 | MAINTAINER Mario Mohr 4 | 5 | RUN \ 6 | yum update -y && \ 7 | yum install -y epel-release && \ 8 | yum install -y net-tools python-setuptools hostname inotify-tools yum-utils && \ 9 | yum clean all && \ 10 | easy_install supervisor 11 | 12 | ENV FILE https://downloads-guests.open.collab.net/files/documents/61/17071/CollabNetSubversionEdge-5.2.0_linux-x86_64.tar.gz 13 | 14 | RUN wget -q ${FILE} -O /tmp/csvn.tgz && \ 15 | mkdir -p /opt/csvn && \ 16 | tar -xzf /tmp/csvn.tgz -C /opt/csvn --strip=1 && \ 17 | rm -rf /tmp/csvn.tgz 18 | 19 | ENV RUN_AS_USER collabnet 20 | 21 | 22 | RUN useradd collabnet && \ 23 | chown -R collabnet.collabnet /opt/csvn && \ 24 | cd /opt/csvn && \ 25 | ./bin/csvn install && \ 26 | mkdir -p ./data-initial && \ 27 | cp -r ./data/* ./data-initial 28 | 29 | EXPOSE 3343 4434 18080 30 | 31 | ADD files / 32 | 33 | VOLUME /opt/csvn/data 34 | 35 | WORKDIR /opt/csvn 36 | 37 | ENTRYPOINT ["/config/bootstrap.sh"] 38 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mamohr/subversion-edge 2 | 3 | This is a docker image of the Collabnet Subversion Edge Server 4 | 5 | ## Usage 6 | 7 | The image is exposing the data dir of csvn as a volume under `/opt/csvn/data`. 8 | If you provide an empty host folder as volume the init scripts will take care of copying a basic configuration to the volume. 9 | The container exposes the following ports: 10 | 11 | * 3343 - HTTP CSVN Admin Sites 12 | * 4434 - HTTPS CSVN Admin Sites (If SSL is enabled) 13 | * 18080 - Apache Http SVN 14 | 15 | The simplest way to start a subversion edge server is 16 | 17 | docker run -d mamohr/subversion-edge 18 | 19 | This will run the server. It will only be reachable from the docker host by using the container ip address 20 | 21 | Exposing the ports from the host: 22 | 23 | docker run -d -p 3343:3343 -p 4434:4434 -p 18080:18080 \ 24 | --name svn-server mamohr/subversion-edge 25 | 26 | This will make the admin interface reachable under [http://docker-host:3343/csvn](http://docker-host:3343/csvn). 27 | 28 | If you want to provide a host path for the data use command like this: 29 | 30 | docker run -d -p 3343:3343 -p 4434:4434 -p 18080:18080 \ 31 | -v /srv/svn-data:/opt/csvn/data --name svn-server mamohr/subversion-edge 32 | 33 | 34 | For information to further configuration please consult the documentation at [CollabNet](http://collab.net/products/subversion). 35 | -------------------------------------------------------------------------------- /files/config/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | set -u 5 | 6 | # Supervisord default params 7 | SUPERVISOR_PARAMS='-c /etc/supervisord.conf' 8 | 9 | 10 | # Create directories for supervisor's UNIX socket and logs (which might be missing 11 | # as container might start with /data mounted from another data-container). 12 | mkdir -p /data/conf /data/run /data/logs 13 | chmod 711 /data/conf /data/run /data/logs 14 | 15 | if [ "$(ls /config/init/)" ]; then 16 | for init in /config/init/*.sh; do 17 | . $init 18 | done 19 | fi 20 | 21 | 22 | # We have TTY, so probably an interactive container... 23 | if test -t 0; then 24 | # Run supervisord detached... 25 | supervisord $SUPERVISOR_PARAMS 26 | 27 | # Some command(s) has been passed to container? Execute them and exit. 28 | # No commands provided? Run bash. 29 | if [[ $@ ]]; then 30 | eval $@ 31 | else 32 | export PS1='[\u@\h : \w]\$ ' 33 | /bin/bash 34 | fi 35 | 36 | # Detached mode? Run supervisord in foreground, which will stay until container is stopped. 37 | else 38 | # If some extra params were passed, execute them before. 39 | # @TODO It is a bit confusing that the passed command runs *before* supervisord, 40 | # while in interactive mode they run *after* supervisor. 41 | # Not sure about that, but maybe when any command is passed to container, 42 | # it should be executed *always* after supervisord? And when the command ends, 43 | # container exits as well. 44 | if [[ $@ ]]; then 45 | eval $@ 46 | fi 47 | supervisord -n $SUPERVISOR_PARAMS 48 | fi 49 | -------------------------------------------------------------------------------- /files/config/init/10_set-initial-data.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | if [ ! -f "/opt/csvn/data/conf/csvn.conf" ]; then 4 | cp -r /opt/csvn/data-initial/* /opt/csvn/data 5 | fi 6 | -------------------------------------------------------------------------------- /files/config/init/20_fix-volume-permissions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | chown -R collabnet:collabnet /opt/csvn/data 4 | -------------------------------------------------------------------------------- /files/etc/supervisor.d/subversion-edge.conf: -------------------------------------------------------------------------------- 1 | [program:csvn] 2 | command=/opt/csvn/bin/csvn console 3 | user=collabnet 4 | 5 | [program:csvn-httpd] 6 | command=/opt/csvn/bin/csvn-httpd start 7 | -------------------------------------------------------------------------------- /files/etc/supervisord.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | pidfile = /run/supervisord.pid 3 | # It seems that it's not possible to swith this log to NONE (it creates NONE logfile) 4 | logfile = /data/logs/supervisord.log 5 | # Set loglevel=debug, only then all logs from child services are printed out 6 | # to container logs (and thus available via `docker logs [container]` 7 | loglevel = debug 8 | 9 | # These two (unix_http_server, rpcinterface) are needed for supervisorctl to work 10 | [inet_http_server] 11 | port = :9111 12 | username = sv 13 | password = password 14 | 15 | [rpcinterface:supervisor] 16 | supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface 17 | 18 | [supervisorctl] 19 | serverurl = http://localhost:9111 20 | username = sv 21 | password = password 22 | 23 | [include] 24 | files = /etc/supervisor.d/*.conf 25 | --------------------------------------------------------------------------------