[SOLVED] Simple Docker upgrade steps incorrect?

When things don't work as they should.
mamos
Posts: 9
Joined: Thu Jan 23, 2020 7:20 pm

[SOLVED] Simple Docker upgrade steps incorrect?

Post by mamos »

I have installed Mayan 3.3.8 using the Simple Docker installation steps located at

https://docs.mayan-edms.com/chapters/do ... er-install

onto an Ubuntu virtual machine. Everything appears to install normally and I'm able to access Mayan and setup users and import documents. Now, I'm attempting to upgrade Mayan to 3.3.9 using the steps located at

https://docs.mayan-edms.com/chapters/do ... ading.html

and everything seems to upgrade normally except this time I'm able to access the Mayan login screen and it shows the automatic admin account credentials as it does when it's a new installation and I'm unable to login using the users that I had previously setup in 3.3.8 but I can log into the new admin account but none of my users or documents are there.

What is causing this to happen? Thanks for the help.

User avatar
rssfed23
Moderator
Moderator
Posts: 185
Joined: Mon Oct 14, 2019 1:18 pm
Location: United Kingdom
Contact:

Re: Simple Docker upgrade steps incorrect?

Post by rssfed23 »

When you first started Mayan, did you start it with volumes mounted into the container (something like -v /docker-volumes/mayan-edms/ /var/lib/mayan-edms) and the same for the database?

I would expect it to look like a "new" install if you didn't use mounted volumes/dedicated volumes as if a volume isn't used when removing the old container it's possible it removed everything along with it. That should only really happen though for the postgres container you've also launched (as the user data is stored inside postgres).
For whatever reason, it looks as if it's created a completely new installation for you.
Please don't PM for general support; start a new thread with your issue instead.

mamos
Posts: 9
Joined: Thu Jan 23, 2020 7:20 pm

Re: Simple Docker upgrade steps incorrect?

Post by mamos »

This is what I initially ran to start Mayan during the installation of 3.3.8. This is from Mayan's website.:

docker run \
-d \
--name mayan-edms \
--restart=always \
-p 80:8000 \
-e MAYAN_DATABASES="{'default':{'ENGINE':'django.db.backends.postgresql','NAME':'mayan','PASSWORD':'mayanuserpass','USER':'mayan','HOST':'172.17.0.1'}}" \
-e MAYAN_CELERY_BROKER_URL="redis://:mayanredispassword@172.17.0.1:6379/0" \
-e MAYAN_CELERY_RESULT_BACKEND="redis://:mayanredispassword@172.17.0.1:6379/1" \
-v /docker-volumes/mayan-edms/media:/var/lib/mayan \
mayanedms/mayanedms:3.3.8


And this is what I ran to start Mayan during the upgrade to 3.3.9. This is from Mayan's website as well.:

docker run -d --name mayan-edms --restart=always -p 80:8000 -v /docker-volumes/mayan:/var/lib/mayan mayanedms/mayanedms:latest

I have also reverted to a previous VM snapshot so I can then try this since /docker-volumes/mayan-edms is what the initial installation used:

docker run -d --name mayan-edms --restart=always -p 80:8000 -v /docker-volumes/mayan-edms:/var/lib/mayan mayanedms/mayanedms:latest

I don't see why this shouldn't work smoothly.
Thanks!

User avatar
rssfed23
Moderator
Moderator
Posts: 185
Joined: Mon Oct 14, 2019 1:18 pm
Location: United Kingdom
Contact:

Re: Simple Docker upgrade steps incorrect?

Post by rssfed23 »

When you used /docker-volumes/mayan instead of /docker-volumes/mayan-edms it would have treated basically like a new install because the config files and documents etc wouldn’t have been there.

But I’d have expected it to fail as there was data already in the DB.

Have you tried upgrading again since your restore ensuring all the variables you used initially are the same again for storage/DB connections etc? It may work more successfully if the config files aren’t removed from it thinking it’s a new install :). It’s worth a try!
Please don't PM for general support; start a new thread with your issue instead.

mamos
Posts: 9
Joined: Thu Jan 23, 2020 7:20 pm

Re: Simple Docker upgrade steps incorrect?

Post by mamos »

The purpose of my upgrade is to make sure that the upgrade process works smoothly before officially deciding to use Mayan. So far I haven't been able to accomplish the upgrade without "losing" everything.

The virtual machine snapshot that I revert to is from before I installed Docker and Mayan, that way I can continue to test with a fresh OS install. So when I install Docker and Mayan I use the directions on Mayan's website for the Simple Docker install, then when I upgrade I use the directions on Mayan's website for the Docker Mayan upgrade. Apparently there are typos because as you have noticed already the directories were named 'mayan' and 'mayan-edms' respectively. So to resolve that I just correct the command to include the existing directory name 'mayan-edms'. I don't do anything at all with the database containers...should I? I haven't seen anything concerning the Docker Mayan upgrade except for stopping the mayan-edms container, pulling the new version of mayan, then starting it again. Here are the installation and upgrade commands I am using all together:

Installation:

wget -qO- https://get.docker.com/ | sh

docker pull mayanedms/mayanedms:3.3.8

docker pull postgres:9.6-alpine

docker pull redis:5.0-alpine

docker run \
-d \
--name mayan-edms-postgres \
--restart=always \
-p 5432:5432 \
-e POSTGRES_USER=mayan \
-e POSTGRES_DB=mayan \
-e POSTGRES_PASSWORD=mayanuserpass \
-v /docker-volumes/mayan-edms/postgres:/var/lib/postgresql/data \
postgres:9.6-alpine

docker run \
-d \
--name mayan-edms-redis \
--restart=always \
-p 6379:6379 \
-v /docker-volumes/mayan-edms/redis:/data \
redis:5.0-alpine \
redis-server \
--databases \
"2" \
--maxmemory-policy \
allkeys-lru \
--save \
"" \
--requirepass mayanredispassword

docker run \
-d \
--name mayan-edms \
--restart=always \
-p 80:8000 \
-e MAYAN_DATABASES="{'default':{'ENGINE':'django.db.backends.postgresql','NAME':'mayan','PASSWORD':'mayanuserpass','USER':'mayan','HOST':'172.17.0.1'}}" \
-e MAYAN_CELERY_BROKER_URL="redis://:mayanredispassword@172.17.0.1:6379/0" \
-e MAYAN_CELERY_RESULT_BACKEND="redis://:mayanredispassword@172.17.0.1:6379/1" \
-v /docker-volumes/mayan-edms/media:/var/lib/mayan \
mayanedms/mayanedms:3.3.8


The installation works without any issues and I'm able to use Mayan, but then, the upgrade:

docker stop mayan-edms

docker rm mayan-edms

docker pull mayanedms/mayanedms:latest

docker run -d --name mayan-edms --restart=always -p 80:8000 -v /docker-volumes/mayan-edms:/var/lib/mayan mayanedms/mayanedms:latest


After running the upgrade I can get to the Mayan login screen but it appears to be a new install at this point and won't let me login with any of my previous credentials I create after the initial install. I don't do anything at all with the databases and haven't noticed any information anywhere that says I should.

Thanks!

User avatar
rssfed23
Moderator
Moderator
Posts: 185
Joined: Mon Oct 14, 2019 1:18 pm
Location: United Kingdom
Contact:

Re: Simple Docker upgrade steps incorrect?

Post by rssfed23 »

It shouldn't in theory be necessary, but when you do the second docker run (the "upgrade") you're not providing Mayan with any of the environment variables you are from the first launch.

Can you try running the upgrade with the environment variables added? Something like:

Code: Select all

docker run \
-d \
--name mayan-edms \
--restart=always \
-p 80:8000 \
-e MAYAN_DATABASES="{'default':{'ENGINE':'django.db.backends.postgresql','NAME':'mayan','PASSWORD':'mayanuserpass','USER':'mayan','HOST':'172.17.0.1'}}" \
-e MAYAN_CELERY_BROKER_URL="redis://:mayanredispassword@172.17.0.1:6379/0" \
-e MAYAN_CELERY_RESULT_BACKEND="redis://:mayanredispassword@172.17.0.1:6379/1" \
-v /docker-volumes/mayan-edms/media:/var/lib/mayan \
mayanedms/mayanedms:latest
As your second run.

I have a strong suspicion that's why it's losing all the previous settings/users. It doesn't know how to connect to your DB as it's not being passed in again the second time around. In theory it should get that from the config file stored inside your docker volume, but we really should be using the environment variables first.
It would also be helpful to have the logs produced when trying to login. If it's unable to connect to the database properly there'll be errors in the docker logs output (from the mayan container side).
You don't need to do anything with the DB with the commands you've provided above no.

I strongly recommend for any production environment to use docker compose for all sorts of reasons. The docker documentation for Mayan really is intended as a quick start and we have some outstanding tasks to improve it. Using docker compose can make operational tasks like upgrading a lot easier (and ensure you're passing in the right environment variables/storage directories every time).
Please don't PM for general support; start a new thread with your issue instead.

mamos
Posts: 9
Joined: Thu Jan 23, 2020 7:20 pm

Re: Simple Docker upgrade steps incorrect?

Post by mamos »

That was successful! I had tried this before but had the incorrect directory due to the typo on Mayan's website. I corrected the directory to be mayan-edms and then started the container using the environment variables I installed with instead of not providing them as shown on the Mayan website.

I would definitely recommend that Mayan update their website to reflect the correct procedure for this. I will also be checking out Docker Compose.

Thank you for your help!

User avatar
rssfed23
Moderator
Moderator
Posts: 185
Joined: Mon Oct 14, 2019 1:18 pm
Location: United Kingdom
Contact:

Re: Simple Docker upgrade steps incorrect?

Post by rssfed23 »

Thanks for bringing this to my attention. I'll fix the documentation tonight.

It made me question my own knowledge of docker for a minute as I was sure doing the rm on the container like that would not preserve the variables on startup again. I'm pleased you've confirmed that for me and I wasn't going crazy :)

Compose can solve a lot of these types of mini isuses in the long run as the config is stored in the docker-compose.yml file so the only thing to check is the release notes on each major upgrade to see if any of those variables have changed. We also now have a setting migration task as well that should update most of them to the correct entries even if they are wrong.

I'm glad I could get this resolved for you. Don't hesitate to reach out if there's any further issues or questions :)
Please don't PM for general support; start a new thread with your issue instead.

mamos
Posts: 9
Joined: Thu Jan 23, 2020 7:20 pm

Re: [SOLVED] Simple Docker upgrade steps incorrect?

Post by mamos »

I'm afraid I'm not finding very useful information for installing Docker Compose. Could you please point me in the right direction? When I run the command shown on Mayan's site it does not find the command.

docker-compose -f docker-compose.yml up -d

Thanks!

User avatar
rssfed23
Moderator
Moderator
Posts: 185
Joined: Mon Oct 14, 2019 1:18 pm
Location: United Kingdom
Contact:

Re: [SOLVED] Simple Docker upgrade steps incorrect?

Post by rssfed23 »

Compose is not installed with the normal docker package, it's an extra package that needs installation separately.

I recommend the official Docker Compose documentation along with any online tutorial you find on google for it - https://docs.docker.com/compose/gettingstarted/
Please don't PM for general support; start a new thread with your issue instead.

Post Reply