Upgrade from 9 to 10 on CentOS 7 via docker install?


#1

Hi!

I’m running owncloud 9.1 on a centos 7 server. I’d really like to upgrade to owncloud 10 but centos supported packages are way behind what owncloud 10 needs. Rather than fight that, I’m wondering if I can install owncloud 10 docker image as a method for upgrading to 10. (I’m teaching myself docker/container stuff so apologies if these questions are dumb.)

Questions on migrating though:

Can the docker owncloud get out of the container to use my existing postgres DB and existing user/data stored in the regular filesystem?

Will the docker owncloud spinup upgrade my owncloud DB from 9.x tables to 10.x tables?

Can I run the docker image so that my regular apache is still proxying for it? That is, in my current setup, apache is running docker. I’d like my current apache to still be the outward facing webserver front end to my docker/owncloud.

Any other issues I should consider?

Thanks,

Bobby


#2

You can most certainly run ownCloud in a container and upgrade via the container as well. I just went from 7.0.x to 10.0.10 using a series of containers to step through the major upgrades. I used singularity (better user security model) instead of docker, but really, about the same difference. To answer your immediate questions:

Re: Use Existing Filesystem: Yes… Use a filesystem mapping when you docker run …

Re: Upgrade Tables: You’ll have to shell into the container once to run the occ upgrade command.

Re: Proxy: This is exactly how I have mine setup… There’s a few gotchas, but it was pretty easy to figure out in the end with some googling.

The biggest issue for me was to map all the logs and other writable things outside of the container into the host filesystem. I ended up making a single directory and mapping all the needed writable directories within the container to that. Happy to share my container def file if you’d like. Like I said, it’s singularity instead of docker, but it’s largely the same.

Good luck,
Pat


#3

Hi!

Thanks for your reply. Do you think I need to first go to 10.0 container and upgrade or do you think I can go straight to 10.10 or current (10.x) ?

Also, in terms of configuring owncloud inside a container, do you run the container interactively and go edit the config files by hand or do you fire it up and go to the admin interface and configure it that way?

My thought is I have to go in by hand to change paths so that the container can get to outside filesystems where my current owncloud 9.x data is stored.

Thanks,

Bobby


#4

You can upgrade to the latest 10.x from anything higher than 9.0.9 - https://doc.owncloud.com/server/admin_manual/maintenance/upgrade.html

The generally accepted container philosophy is that the container itself, once built by the definition, is immutable and you should map host filesystem directories for writable areas in the container that you want to persist. However, not all containers are built this way… I’d recommend you map your config directory out to the host file system and then it doesn’t matter whether you edit by hand or use the admin interface. I did some of both. I think it’s kinda cool that I can edit the config.php in my host file system to put owncloud in maintenance mode without ever touching the container itself.

Yeah… you can go in by hand to create symbolic links for the paths to get them outside the container or smartly craft the container definition file to do it for you. I did it in the definition file itself. If you’re just worried about the data directory, you can arbitrarily set that in config.php and then map the data directory to that spot you entered in config.php in the container file system.

Make sense?
Pat


#5

Yes, thanks! I’m going to familiarize myself with containers first and then try the upgrade on a second owncloud server before doing so on my main owncloud server.

Bobby


#6

Hey! Question on your statement here. Was there some special docker setup you used to do this or did you have to mount a host directory, copy configs to it, and then point docker to it for future loads?

I figured out how to map my data directory into container but now working through mechanics of accessing config from file stored outside the container.

Thanks,

Bobby


#7

Hey!

One more question on migration to docker/owncloud.

Was mapping of apache/user from inside container to outside container an issue? Or, did everything just work.

thanks,

Bobby


#8

Hi Bobby,

If you’re switching to docker, pay close attention to the distribution your docker-image is based on. It could easily happen that you’re switching to an Ubuntu image. While inside an Ubuntu the webserver usually runs as user www-data with the uid 33, this might be different from your original system. In this case you would have to adjust the permissions on your files.

The docker project usually has a dockerfile with a ‘FROM’ line.
Owncloud Docker Server for example is based on Ubuntu Bionic

Cheers,
Erik


#9

re: Mapping Filesystems - Again, to clarify, I used singularity, but no… no special setup. I did just as you said: mounted a host directory with subdirectories for config, logs, and pid files because I made my container read-only and then copied the appropriate files to their locations in the host directory and created softlinks (ln -s) in the container to point to the right spot in the mapped directory.

re: Mapping Users - Erik makes a great point. Each distro has its own apache user. But, since apache/user is a local user, you should be ok if your container distro uses the same uids as your host. And remember, its the uid/gid that counts, not the “pretty” name.

Hope that helps,
Pat


#10

Hi!

Hey, thanks for all the replies. I’m configuring the owncloud container to grab config from outside the container via a mapped volume.

One last question. Inside the container, how do I tell apache/owncloud that I want the URL to the owncloud server to NOT be / but to be something like /oc ? That is, www.example.com/oc rather than just in the root dir?

Thanks,

Bobby


#11

I’m less sure about this answer, but what I would try is putting your owncloud install in an /oc directory under your root web directory (/var/www/html ?) and then configuring your httpd.conf with a directive to configure the /oc directory as noted in the owncloud installation instructions. I’d also put some kind of redirect in httpd.conf or the web root directory so that if someone puts in www.example.com, it redirects to owncloud, assuming you want that. Finally, you’ll want to configure at least the first two keys in your owncloud config.php below:

‘overwritehost’ => ‘www.example.com’,
‘overwritewebroot’ => ‘/oc’,
‘overwrite.cli.url’ => ‘www.example.com/oc’,

Good luck!
Pat