Skip to content

Commit 653f289

Browse files
committed
First release candidate
1 parent e950136 commit 653f289

File tree

4 files changed

+35
-11
lines changed

4 files changed

+35
-11
lines changed

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ RUN groupadd -r httpd && useradd -r -g httpd httpd \
1818
&& mkdir -p /svn/config \
1919
&& mkdir -p /svn/backup \
2020
&& chown -R httpd:httpd /svn/repos
21+
COPY conf/* /svn/config/
2122
VOLUME ["/svn"]
2223

2324
WORKDIR $HTTPD_PREFIX
@@ -178,12 +179,13 @@ RUN set -eux; \
178179
rm -r src src-svn man manual; \
179180
apt-get purge -y --auto-remove $buildDeps; \
180181
make-ssl-cert generate-default-snakeoil; \
181-
ln -s /etc/ssl/private/ssl-cert-snakeoil.key /usr/local/apache2/conf/server.key; \
182-
ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /usr/local/apache2/conf/server.crt
182+
mkdir -p /etc/ssl/localcerts; \
183+
ln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/localcerts/server.key; \
184+
ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/localcerts/server.crt; \
185+
rm -f $HTTPD_PREFIX/conf/httpd.conf; \
186+
ln -s /svn/config/httpd.conf $HTTPD_PREFIX/conf/httpd.conf
183187

184188
COPY scripts/*.sh /usr/local/bin/
185-
COPY httpd-conf/httpd.conf $HTTPD_PREFIX/conf/
186-
COPY svn-conf/* /svn/config/
187189

188190
EXPOSE 80 443
189191
CMD ["httpd-foreground.sh"]

README.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ docker run -d -p 80:80 -e SVN_REPO_NAME=test -e SVN_USER=admin -e SVN_PASSWORD=s
1212
```
1313

1414
That creates a Subversion repository named test and exposes it to the user admin with password securepassword on port 80 without SSL.
15+
The repository can be accessed at http://localhost/svn/test.
16+
1517
For a slightly more realistic configuration run:
1618

1719
```
@@ -27,14 +29,13 @@ For production use without a fronting load balancer:
2729

2830
```
2931
docker run -d --name httpd-svn --mount source=v_svn,target=/svn \
30-
--mount type=bind,source="$(pwd)/server.crt",target=/usr/local/apache2/conf/server.crt,readonly \
31-
--mount type=bind,source="$(pwd)/server.key",target=/usr/local/apache2/conf/server.key,readonly \
32+
--mount type=bind,source="$(pwd)/localcerts",target=/etc/ssl/localcerts,readonly \
3233
-p 443:443 -e HTTPD_SSL=on \
3334
-e HTTPD_SERVER_NAME=myhost.mydomain.com httpd-svn
3435
```
3536

36-
This uses a real SSL certificate mapped into the container and a volume for the repositories, configuration files and backups.
37-
Users are added manually:
37+
This uses a real SSL certificate (represented by server.crt and server.key in localcerts) mapped into the container
38+
and a volume for the repositories, configuration files and backups. Users are added manually:
3839
```
3940
docker exec -it httpd-svn /bin/bash
4041
htpasswd -B /svn/config/svn-users someuser
@@ -45,18 +46,39 @@ docker exec -it httpd-svn /bin/bash
4546
svnadmin create /svn/repos/somerepo
4647
chown -R httpd:httpd /svn/repos/somerepo
4748
```
48-
4949
Backups can be created using the backup-svn-repos.sh script using an external cron job:
5050
```
5151
docker exec httpd-svn backup-svn-repos.sh
5252
```
5353

5454
The backups are saved in the same volume as the repositories, so be sure to copy the files to another location as well.
5555

56+
## Configuration
57+
58+
There are many configuration options. It should be possible to use this image as is. The Apache configuration file
59+
(httpd.conf) is present in /svn/config in the /svn volume. That means it is possible to edit the configuration; the
60+
changes will persist. The same applies to the users and access rules (also in /svn/config) and of course to the
61+
repositories.
62+
63+
The SSL certificates are stored in /etc/ssl/localcerts and can be replaced (see above). If intermediate certs are
64+
needed the httpd.conf file must be edited to include them, though.
65+
66+
The following options are supported without the need for manual changes:
67+
* HTTPD_SERVER_NAME, the ServerName option for Apache. Set this to the external address.
68+
* HTTPD_SERVER_ADMIN, the mail address to the administrator for server-generated pages.
69+
* HTTPD_SSL, set this to use SSL and listen on port 443. If not set the server listens on port 80.
70+
* SVN_REPO_NAME, the name of a repository to create on startup.
71+
* SVN_USER, the name of a Subversion user to create on startup.
72+
* SVN_PASSWORD, the password for SVN_USER.
73+
74+
The Subversion user will not be created if the svn-users file already exists. Likewise the repository will
75+
not be recreated if it exists.
5676

5777
## Notes
5878

5979
* It is important to set the ServerName option to the real external host name, as Subversion (or rather DAV) needs it for the copy command.
6080
Set HTTPD_SERVER_NAME when using the default configuration or be sure to set it manually. If not defined the container's host name will
6181
be used and that is probably wrong.
6282
* It is a very good idea to require SSL/TLS or alternatively to use a web front with SSL.
83+
84+
Suggestions and pull requests are welcome!

httpd-conf/httpd.conf renamed to conf/httpd.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ LoadModule authz_svn_module modules/mod_authz_svn.so
196196

197197
# Put public and private key here, add intermediate certs to private key
198198
# or add SSLCertificateChainFile.
199-
SSLCertificateFile "/usr/local/apache2/conf/server.crt"
200-
SSLCertificateKeyFile "/usr/local/apache2/conf/server.key"
199+
SSLCertificateFile "/etc/ssl/localcerts/server.crt"
200+
SSLCertificateKeyFile "/etc/ssl/localcerts/server.key"
201201
</IfDefine>
202202

203203
<IfModule unixd_module>
File renamed without changes.

0 commit comments

Comments
 (0)