Sign inSign up

kbitc/subversion

By kbitc

•Updated over 1 year ago

Subversion server with Apache (HTTP/DAV) and svnserve support, managed by supervisord.

Image
Developer tools
0

968

kbitc/subversion repository overview

⁠kbitc/subversion - Subversion Server Docker Image

⁠Overview

This Docker image provides a Subversion (SVN) server with support for access via both:

  • HTTP/DAV (using Apache mod_dav_svn)
  • svnserve (using the svn:// protocol)

The services (Apache and svnserve) are managed by supervisord for reliable operation. This image is designed to be a flexible solution for self-hosting your Subversion repositories.

⁠Features

  • Dual Protocol Access: Access repositories via http:// (or https:// if behind a reverse proxy) and svn://.
  • Apache & mod_dav_svn: Provides robust HTTP/DAV access with support for authentication and fine-grained authorization.
  • svnserve: Offers a lightweight, native Subversion protocol access.
  • Supervisord Managed: Ensures both Apache and svnserve processes are running.
  • Configurable:
    • Initial admin user and repositories can be set up via environment variables processed by an entrypoint script.
    • Supports custom Apache configurations for SVN (dav_svn.conf).
    • Supports custom SVN authorization (authz) and password (htpasswd for Apache, passwd for svnserve) files.
  • Persistent Storage: Uses Docker volumes to persist repository data, configurations, and authentication files.
  • Based on Alpine Linux (Assumed for a lightweight custom build, can be changed if your base is different).

⁠Quick Start (Using docker-compose)

This is the recommended method for running the Subversion server.

  1. Prepare Host Directories: Create directories on your Docker host to store persistent data:

    mkdir -p ./svn_data/repositories # For SVN repositories
    mkdir -p ./svn_data/apache_auth # For htpasswd (Apache users) and authz file
    # mkdir -p ./svn_data/svnserve_conf # Optional: For svnserve specific passwd/authz if separate from Apache
    
  2. Prepare Configuration Files (Examples - place in ./svn_data/apache_auth/ or as needed):

    • dav_svn.passwd (for Apache users - create with htpasswd tool): You'll need to create this file. Example:

      # On your host, install apache2-utils or httpd-tools
      htpasswd -cb ./svn_data/apache_auth/dav_svn.passwd admin yoursecurepassword
      htpasswd -b ./svn_data/apache_auth/dav_svn.passwd user1 anotherpassword
      
    • authz.conf (SVN path-based authorization): Create ./svn_data/apache_auth/authz.conf:

      [groups]
      admins = admin
      devteam = user1, user2
      
      [/]
      * = r
      @admins = rw
      
      [repo1:/]
      @devteam = rw
      * = r
      
      [repo2:/secret/project]
      user1 = rw
      * =
      
    • dav_svn.conf (Custom Apache SVN configuration - if overriding the image's default): If your image's entrypoint generates a basic one, you might not need this initially. If you provide it, it would look something like:

      <IfModule mod_dav_svn.c>
        <IfModule mod_authz_svn.c>
          <Location /svn>
            DAV svn
            SVNParentPath "/var/svn/repos" # Path inside container
            SVNListParentPath On # Or Off
      
            AuthType Basic
            AuthName "Subversion Repository"
            AuthUserFile "/etc/subversion/auth/dav_svn.passwd" # Path inside container
            AuthzSVNAccessFile "/etc/subversion/auth/authz.conf" # Path inside container
            Require valid-user
          </Location>
        </IfModule>
      </IfModule>
      

      (Note: The paths for AuthUserFile and AuthzSVNAccessFile above are examples for where they would be mounted inside the container).

  3. Create docker-compose.yml:

    version: '3.8'
    
    services:
      subversion_server:
        # Replace with your actual image name if different
        image: kbitc/subversion:latest 
        # Or use 'build: .' if Dockerfile is in the current directory
        # build: . 
        # image: kbitc/subversion-composed # Optional name for compose-built image
    
        container_name: svn_server_instance
        restart: unless-stopped
        ports:
          - "8080:80"      # Map host port 8080 to container port 80 (Apache HTTP)
          - "3690:3690"    # Map host port 3690 to container port 3690 (svnserve)
        volumes:
          # Mount host directories for persistent data
          - ./svn_data/repositories:/var/svn/repos # SVN Repositories
          # Mount auth files for Apache.
          # Ensure dav_svn.passwd and authz.conf are in ./svn_data/apache_auth/ on the host.
          - ./svn_data/apache_auth:/etc/subversion/auth 
          # Optional: If you have a fully custom dav_svn.conf for Apache to mount
          # - ./my_custom_dav_svn.conf:/etc/apache2/mods-available/dav_svn.conf:ro
          # Optional: If using separate svnserve configuration files
          # - ./svn_data/svnserve_conf:/etc/subversion/svnserve_conf 
        environment:
          # Environment variables for the entrypoint script (if your image uses them)
          # Example (these would be specific to your entrypoint.sh logic):
          - SVN_ADMIN_USER=admin 
          # - SVN_ADMIN_PASS=yoursecurepassword # Password might be better handled via htpasswd file directly
          - SVN_INITIAL_REPOS=repo1,repo2 # Comma-separated list of repos to create if entrypoint supports it
          - SVN_APACHE_LIST_PARENT_PATH=On # To control SVNListParentPath dynamically
          # For dperson/samba style UID/GID mapping if your entrypoint handles file permissions:
          # - USERID=1000 
          # - GROUPID=1000
          - TZ=Asia/Tokyo # Set your timezone
        # networks:
        #  - svn_network
    
    # networks:
    #  svn_network:
    #    driver: bridge
    
  4. Start the Subversion Server:

    docker-compose up -d
    # If using 'build: .' for the first time or after Dockerfile changes:
    # docker-compose up --build -d
    

⁠Using docker run

# Create host directories first
mkdir -p /opt/svn_data/repositories
mkdir -p /opt/svn_data/apache_auth
# (Create htpasswd and authz files in /opt/svn_data/apache_auth/)

docker run -d \
    --name svn_server_instance \
    -p 8080:80 \
    -p 3690:3690 \
    -v /opt/svn_data/repositories:/var/svn/repos \
    -v /opt/svn_data/apache_auth:/etc/subversion/auth \
    # -e SVN_ADMIN_USER=admin \
    # -e SVN_INITIAL_REPOS=repo1 \
    # -e SVN_APACHE_LIST_PARENT_PATH=On \
    # -e USERID=<span class="math-inline">\(id \-u\) \\
\# \-e GROUPID\=</span>(id -g) \
    -e TZ=Asia/Tokyo \
    kbitc/subversion:latest

Tag summary

Content type

Image

Digest

sha256:cb0f2ea22…

Size

27.3 MB

Last updated

over 1 year ago

docker pull kbitc/subversion