Detailed instructions how to use your existing SVN repositories with a lightweight Docker container on a Synology NAS with DSM 6 and above.
Synology DSM version 7 doesn't have the native SVN application anymore. The last DSM version 6.2 with SVN will reach end of life on October 1, 2024.
Purpose: Get a working alternative for the native SVN application in DSM 6.2, so it's possible to update the NAS to DSM 7 while still using SVN.
This tutorial describes 4 steps:
- Install the Docker application on the NAS with DSM 6.2.
- Create a lightweight Docker container with SVN Server image that points toward your existing SVN repositories.
- Relocate the URL of all existing local working copies to the new SVN protocol of the Docker container.
- Create new repository.
This means that no data has to be moved or renamed on the NAS. Only the repository URLs should be relocated for your working copies. An added benefit is that the repositories can be accessed via both the existing native SVN application in DSM 6 and the new Docker SVN for DSM 6 and 7. So it allows proper verification on DSM 6, before you're convinced to upgrade to DSM 7.
- There is an existing folder
svn
in the root (volume1
) of the NAS with your existing repositories. This is the default folder that the native DSM SVN application uses.
I started with the Docker image from "elleflorio". However, during the setup I discovered that it contains a pretty outdated version of SVN and that the image was no longer maintained. Although I got it working, this signficant downgrade of SVN version was a no go. Hence an alternative image from "garethflowers" is found. Here is the comparison between the 2 images:
Image Maintained SVN Version Linux Alpine version SVN protocol HTTP protocol Size elleflorio No 1.9.7 (Aug-2017) 3.5.2 (Mar-2017) Yes Yes 50 MB garethflowers Yes 1.14.2 (Apr-2022) 3.17.3 (Mar-2023) Yes No 17 MB
This page describes all the steps for the up-to-date "garethflowers" image. Click here for the "elleflorio" image.
Spending more time with the Docker container also resulted in more experience and a new understanding that the existing SVN repositories could just be used from their original location. Therefor the appoach on this page is more simple than for the "elleflorio" image.
- This tutorial describes what worked for me, but is no guarantee for others. Please use all information at your own risk and without any warranty.
- Before starting, ensure to create backups of your existing repositories. There is plenty of information about this online. I would recommend to start simple with the recommended
hotcopy
command, as explained here. - This Docker image from "garethflowers" is still maintained.
- This Docker image contains the recent SVN version 1.14.2 from April 2022, while the latest version 1.14.3 is from December 2023. See the Subversion Release History.
- This Docker image contains the recent Linux Alpine version 3.17.3 from March 2023, while the latest version 3.19.0 is from December 2023. See the Linux Alpine Release History.
- These instructions are intended for users who are not familiar with Docker and/or the Linux Command Line Interface. Hence the abundance of screenshots and explanations. I hope that the advanced reader can appreciate my effort to help a wide audience and is not offended by all "the obvious".
- All screenshots are taken on:
- Synology DS218+ NAS with DSM version
6.2.4-25556 Update 7
. - Apple MacBook with macOS Ventura
13.6.3
.
- Synology DS218+ NAS with DSM version
- https://github.com/garethflowers/docker-svn-server
- https://notion360.com/synology-svn/
- https://gist.github.com/dpmex4527/1d702357697162384d31d033a7d505eb
- Log in to your Synology Disk Station.
- Open application "Package Center".
- Under "All Packages" search for "Docker".
- Select package "Docker":
- Click "Install"
- Wait until the application is complete and the application status has changed to "Running":
- Open application "Docker".
If Package Center is still open, you can click the "Open" button. Otherwise click the Main Menu in the top left corner of DSM and select the Docker app. - It will show the "Welcome to Docker" popup. Although interesting to read, let's postpone that and dismiss it by clicking the "X" in the top right corner.
- The Docker application is now running:
- In the left navigation pane select "Registry". This is a convenient browser of published Docker images, similar to the App Store.
- In the search field type
garethflowers/svn-
and click "Search": - Select
garethflowers/svn-server
and press the button "Download". - A popup might appear requesting to "Choose Tag". Ensure to choose "latest" and press the button "Select".
- When the download has started, a blue notification "1" appears behind the "Image" menu:
- In the left navigation pane select "Image".
- Wait until the download completes. Select the downloaded image named
garethflowers/svn-server:latest
and click the button "Launch". - Type
svn-server
as "Container Name" (Important: use exact spelling as this name is required in docker command line operations later on): - Leave all other settings unchanged and click "Advanced Settings".
- On tab "Advanced Settings" enable option "Enable auto-restart" so Docker will start this image during each power on of the NAS:
- Select tab "Volume".
- Click button "Add Folder" and browse to the folder
svn
with your existing repositories. - Click "Select".
- For "Mount path" type
/var/opt/svn
: - Select tab "Port Settings". By default the ports for accessing the SVN Server are set automatically by Docker. The actual port settings can be found on the Docker Container tab under Details, as indicated in step 24. It's highly recommended to configure these ports manually, so they will always stay the same, regardless of restarts of both the Docker container and the NAS.
- Change the "Local Port" values from "Auto" to the values below:
NOTE: When a port number is not available, it will be shown. Use another port and note the number for later usage.
Explanation
This table contains the mapping between ports on the NAS (Local Port) and in the Container. The Local Ports are necessary for the following purposes, as will be later explained:Port Purpose 43690 SVN protocol - Finally press the button "Apply" to close the Advanced Settings and return back to the container creation (step 11):
- Press "Next" to view the Summary:
- Review and verify that all settings are matching the instructions and click "Apply" to create and start the container.
- In the left navigation pane select "Container". Verify that the container is running:
- Select the container and press the button "Details". It will show the port settings from step 19 in the lower left corner:
- It all looks good. And you can see how lightweight it is with 0% CPU usage and only 6 MB of RAM.
When there is 1 or more existing repository at the NAS, it can be verified if it's accessible via the new SVN protocol of the Docker container.
Here are the parameters that will be used:
Parameter Description <nas_ip>
The IP address of the NAS. <svn_port>
The Local Port for the SVN protocol from step 19 of the Docker setup (i.e. 43690
).<repo>
The name of the existing repository.
- Start a command line tool on your computer, e.g. Terminal (macOS) or Windows Command shell or Powershell.
- When still on DSM 6, first call the native SVN server via
svn info svn://<nas_ip>/<repo>
, e.g.svn info svn://192.168.1.3/myRepo
- It will show information of the repo, like:
Path: my-repo URL: svn://192.168.1.3/my-repo Relative URL: ^/ Repository Root: svn://192.168.1.3/my-repo Repository UUID: e6cc68cb-dec7-438d-a041-073203402383 Revision: 613 Node Kind: directory Last Changed Author: john Last Changed Rev: 613 Last Changed Date: 2023-01-07 20:33:43 +0100 (Sat, 07 Jan 2023)
- To verify the new URL, add the local port number that redirects to the Docker image via
svn info svn://<nas_ip>:<svn_port>/<repo>
, e.g.svn info svn://192.168.1.3:43690/my-repo
- This should show the exact same information, since it redirects to the same
svn
folder.
As seen in the previous section, the existing SVN URL is extended with the port number to the Docker container. Fortunately all SVN tools have easy ways of relocating the URL. For example:
- TortoiseSVN
- Xversion Select a working copy from the list in Xversion -> right mouse -> Relocate...
- Command Line
- Relocate the URL of 1 repository
- Check that it's accessable, for example by requesting the log. And if that's provided, check the changed files comparison.
- If still OK, change 1 line of code and perform a commit.
- Reboot your NAS to verify that the Docker container is started automatically (step 13 of the Docker setup). When it starts interact with the repository to check if it's available (e.g. request log or check changed files).
All good? Congratulations, the SVN repositories are now available via the SVN server in the Docker contaienr by the new SVN URLs. This means you're ready to update to DSM 7 and still use your existing SVN repositories.
The difference with the native SVN in DSM 6 is that this container has no graphical user interface to create a new repository.
However, it's only 1 command to create one via the command line, via a SSH session.
Depending of your computer and operating system, this can be established with different tools, like PuTTY, Windows PowerShell and macOS Terminal.
- In DSM, ensure that SSH is enabled, preferrably with a custom port (in this tutorial port 2222 is used). See this Synology Knowledge Center article.
- Open your tool of choice to start the SSH session.
- Start the SSH connection by typing:
sudo ssh <user_name>@<nas_ip> -p <ssh_port>
, e.g.sudo ssh [email protected] -p 2222
- First the password of your local machine is requested (due to the
sudo
command). Type it and press the ENTER key. - When the password is correct, it will request the password for
<user_name>
of the NAS. Type it and press the ENTER key. - When the password is correct, you will be logged into the NAS.
- To create a SVN repository in the next section, sudo permissions are required. Hence type
sudo -i
. Again enter the password for<user_name>
and press the ENTER key. Now the SSH connection is established with root permissions: - Optional: It's possible to request the version of the Linux Alpine version inside the Docker container by typing:
docker exec <container> cat /etc/os-release
, e.g.docker exec svn-server cat /etc/os-release
Parameter Description <container>
The name of the docker container from step 11 of the Docker setup (e.g. svn-server
).
- To create a new repository via the Docker container type:
docker exec -it <container> svnadmin create <repo>
, e.g.docker exec -it svn-server svnadmin create test-repo
Parameter Description <container>
The name of the docker container from step 11 of the Docker setup (e.g. svn-server
).<repo>
The name of the new repository. - It can be verified via the
svn status
command, as done before. So for the new repo with nametest-repo
type:svn info svn://192.168.1.3/test-repo
- It will show information of the new repo at Revision 0, like:
Path: test-repo URL: svn://192.168.1.3:43690/test-repo Relative URL: ^/ Repository Root: svn://192.168.1.3:43690/test-repo Repository UUID: c5a052fe-2872-4bd0-a256-d93a3a4ecea6 Revision: 0 Node Kind: directory Last Changed Rev: 0 Last Changed Date: 2024-01-07 18:08:42 +0100 (Sun, 07 Jan 2024)
- The last step is to configure the access rights of this repository. This can be done by editing the files in the folder
conf
of the new repository. For example with an editor like VI.
Or if you want to re-use the same configuration from an existing repository, copy the filessvnserve.conf
,passwd
andauthz
from that respository and override the default ones in the new repository. In that case enter the following 3 commands in the terminal and replacemy-repo
with the name of the existing repository:More information about this topic can be found on the internet, for example at the bottom of this article.cp /volume1/svn/my-repo/conf/svnserve.conf /volume1/svn/test-repo/conf/ cp /volume1/svn/my-repo/conf/passwd /volume1/svn/test-repo/conf/ cp /volume1/svn/my-repo/conf/authz /volume1/svn/test-repo/conf/
- All (new) repositories are just visible in DSM via the "File Station" application in the folder
svn
. - Just select a folder within it, such as the newly created
test-repo
and delete it.