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

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

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

1 Like

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

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

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

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

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

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

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

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

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

Hi!

Hey, Pat, would you share your container config file with me?

I’m back working on my owncloud -> docker migration and am a little overwhelmed with all the issues I’m running into.

Thank you.

Bobby

Sure… I’ve removed sensitive info. I should also note that:

  1. I did this with singularity, not docker
  2. I’m no container expert… others probably could do a better / more concise job

Other notes:

  • I run the container with 2 important mounts… the data directory, and an own-cloud/writable directory that contains the config.php, log files, and other stuff that the container wanted to write out. Remember that container philosophy is that it’s immutable, so I used ln -s to remap stuff inside the container that I wanted to persist between container runs. In the end, this worked pretty slick. I can edit config.php in my host filespace and the changes are immediately reflected inside the container.

Let me know if you have any questions!

Patconfig.php.template.txt (833 Bytes) owncloud.conf.template.txt (343 Bytes) owncloud-10.0.10.def.txt (6.8 KB)

Hi!

Thank you! I see you found an owncloud container built on RH instead of ubuntu/debian.

Is that correct?

Thanks,

Bobby

Kind of. I built my own ownCloud container from scratch using a base RHEL 7 image that I got off of RHEL’s container catalog - https://access.redhat.com/containers/ You’ll see there they have all kinds of options with various things baked into the container already, but you’ll see from my recipe that I’m just using a base RHEL 7 one.

Because I was upgrading from ownCloud 7.x, I had to step through the various major ownCloud updates, and there weren’t pre-made containers available for those older versions that I could easily find, so I made my own by starting with base RH images and then installing ownCloud into them via their downloadable .tars. You’ll see about six lines of code in the recipe that downloads the .tar using wget and untars it and then a bunch of stuff after that that configures the install: first apache, SSL, LDAP, and then finally ownCloud, most of which is taken from the ownCloud adminstrator’s guide. Then, there’s configuring the ownCloud cron job and finally, installing RDIS for caching.

I suppose if you were just newly installing ownCloud for the first time and then regularly updated it, you could use ownCloud’s provided appliance image, but I was starting from too far back.

Hope that’s helpful!
Pat

Hi!

Thanks!

I think I may do the same only start with a centos image. Centos/RHEL more closely matches my environment. And, its a good way to learn more about building/configuring containers.

Bobby

Yeah! There’s got to be a CentOS base container floating around out there to start with. I did use RHEL’s Software Collections (is there a CentOS equivalent?), so some of the paths to configure apache are convoluted, but overall, most of the syntax in my recipe should be quite similar for you.

Good luck! And feel free to post here if you run into a snag… I’ll monitor it.

Hi!

Finally got back to this and upgraded my system. The approach I ended up doing was backing up all my files, contacts, calendars, and then wiping the database and going with a fresh install. Then, restore my files and restore contacts, calendar.

Now that I’m up to 10.3, upgrading in place or swapping the containers will be much easier. My previous install was so convoluted with soft links and files all over the place that a clean install is much better.

Thanks,

Bobby

Hey great! Glad to hear to finally found success!

Yeah… agreed… the haul to upgrade from 7-10 wasn’t fun. I kinda wish I had thought of your export - import solution!

Pat

1 Like