Migration from v1 to v2 in docker

Hello all,
I would like to migrate from 1.60 to newest possible version (2.30.1) but also do it from one server to another (completely new system). I would like to run it also in docker. Currently our all repositories are in two directories - /opt/svn and /opt/git and home directory of scm manager is in /opt/scm-server. I installed scm on a new machine and mounted /var/lib/scm from container to /opt/scm_home on host. From documantation and from this topic Migrate from v1 to v2 and moving to a new server in one go I understand that I should copy home directory from old server to a new one. So in docker container I should place it whenever I want and then change SCM_HOME variable inside container to this directory? But what about repository data? Should I also place it inside container into /opt/svn and /opt/git? How SCM manager knows where repository data is located?

Thanks.

1 Like

Hi,

first of all, using Docker should be a good choice. You could leave the configured scm home variable the way it is and simply mount your old scm home to /var/lib/scm. Your old repository folders should be mounted to the exact old paths in docker (that is /opt/svn and /opt/git), because SCM-Manager will look for them in these places during the migration. If you choose INLINE for all repositories, these paths will be kept and only the file structure inside the paths will be adapted to the new v2 layout. If you do not mind the new location of the repositories, you can also choose MOVE or COPY to end up with only one mounted directory (see here for the different strategies).

Keep in mind to make a backup first :slight_smile:

We would love to hear from you how it’s going.

René

2 Likes

Thank you for your answer,
unfortunetly it is not working yet. I mounted my old scm home directory to /var/lib/scm inside a container and also /opt/git and /opt/svn with repository data. When I run new docker container from image pulled freshly from docker hub, scm starts normally and just ignores everything I put in there. For instance there are two directories with configuration - conf and config. I see also that it ignores binary files from my old scm home as bin, lib and var directories are already present inside docker container in /opt (so I assume it uses those). In web browser I can see a form to enter installation token and set scmadmin user password. If i then manually stop the container using docker stop, remove everything from my directory mounted in /var/lib/scm inside container, copy my old scm home once again and change owner recursively to user/group 1000 and start container using docker start it stucks on status unhealthy and I cannot connect to application so it just doesn’t start properly.

To bo honest before trying this I had to upgrade our old scm instance to v1.60 and I did this just by replacing scm home with freshly downloaded from website. I didn’t chnge a thing in this directory. And then started init.d script to test it and everthing worked fine. Configuration persisted, user data and repository data also. As scm-manager doesn’t use any database I just don’t know how it works. Now I copied old scm home to a new machine and really what I did is I copied clean scm home - there is now configuration there because as I said I didn’t change anything there. Maybe you could help me understand this apart from helping me with this whole upgrade process. I would really appreciate it. Thanks.

Hi,

To be honest I don’t know what you mean with “replace scm home with freshly downloaded…”, but I also made a mistake. So maybe let’s start with how this works in principle:

SCM-Manager stores its configuration in XML files in scm home. For v1, you should find a file config/repositories.xml. Here you can find the metadata for your repositories. The “real” data (the git or svn files) are stored by default in repositories/git/your/repo/name/... for example. I only just learned today, that you could configure these paths in v1, and it looks like you have done so if you have /opt/git and so on. The migration of v2 does not evaluate these setting (as far as I know). Your users are stored in config/users.xml.

For v2, we have changed this a little bit: We now have a config/repository-paths.xml file, where for each repository an explicit folder is specified. So now, you can distribute all your repositories individually (there is no UI support to do so, yet). In the directory for a repository, you will find further directories, eg. store and data. All repository specific configurations and other data like LFS files are stored in these directories, so that metadata and repository data are no longer distributed in different paths.

If I got it right, you should do the following:

  • Your original v1 scm home folder should go to /var/lib/scm. It has to be writable for user 1000.
  • The repository folders /opt/git and /opt/svn should be mounted to /var/lib/scm/repositories/git and /var/lib/scm/repositories/svn.

The migration wizzard looks for a /var/lib/scm/config/repositories.xml file. If this exists, you should find a message with the text STARTING MIGRATION SERVLET in your logs. If you get the dialog to create the admin user, something has gone wrong.

Does this work?

1 Like

So I was doing something really stupid… I copied SCM application files which are normally located in /etc/scm in newer versions. SCM Home was in .scm in user profile. So I copied completely wrong directory.

And here finally is repository.xml and all other configuration files which I couldn’t find inside application data :man_facepalming:

Also it works and it is currently migrating (moving) all my repositories. So your first hint was correct.

@pfeuffer thank you for your great help and sorry you had to deal with my trivial issues that were hard to even imagine someone could have them.

Hey @yeradd12 , everything’s fine, glad it works. :smiley:

I have closed this thread since there was no activity in the last 30 days.