turnkeylinux / tracker

TurnKey Linux Tracker
https://www.turnkeylinux.org
70 stars 16 forks source link

Mayan EDMS v17.1 - Changing Hostname Breaks App #1793

Open DocCyblade opened 1 year ago

DocCyblade commented 1 year ago

On a new install from ISO, with sec updates installed and apt upgrade, once you change the host name within confconsole, things break

image

image

DocCyblade commented 1 year ago

Confirm the ISO install WORKs from fresh install and no changes, no sec update or apt upgrade.

DocCyblade commented 1 year ago

So it seems the issue is when you change the name of the host it breaks

DocCyblade commented 1 year ago

After some poking around I am going to assume that the host name "mayan-edms" is used somewhere within the config, and changing the name will need to change those references as well. Once I find them, I will post them here. May need to patch the change host name script in confconsole to also update the other places once found.

DocCyblade commented 1 year ago

More digging, rabbitmq looks like the issue, still digging through the docs

DocCyblade commented 1 year ago

So the issue I found was, when you change the name RabbitMQ using the host name to create the database files. This would invalidate the mayan user and vhost that was created and celery has a fit cause it can not connect.

https://www.rabbitmq.com/clustering.html#issues-hostname

Notes for my self RabbitMQ data: /var/lib/rabbitmq/mnesia

DocCyblade commented 1 year ago

Working on a workflow to be able to re-name the host, will post when I finish

DocCyblade commented 1 year ago

To rename the Mayan EDMS server:

Overview

  1. Stop services
  2. Change name with confconsole
  3. Rename RabbitMQ Server & Reset Data
  4. Re-add RabbitMQ Data (mayan user and vhost)
  5. Reboot

You will need to know the RabbitMQ password that is being used, you can find that in the config file: nano /opt/mayan-edms/media/config.yml

# Inside /opt/mayan-edms/media/config.yml
..
CELERY_BROKER_URL: amqp://mayan:PASSWORD_WILL_BE_HERE@127.0.0.1:5672/mayan
..

Details:

Step 1 - Stop services

Stop the Mayan EDMS supervisorctl stop all

Stop Rabbit service systemctl stop rabbitmq-server.service

Step 2 - Change name with confconsole

run confconsole and change the hostname, do not restart network

Step 3 - Rename RabbitMQ Server & Reset Data

Edit RabbitMQ config, change the nano /etc/rabbitmq/rabbitmq-env.conf

# in file /etc/rabbitmq/rabbitmq-env.conf
..
NODENAME=mayan@custom-server-name-here
..

Start RabbitMQ systemctl start rabbitmq-server.service

Stop RabbitMQ node and reset data rabbitmqctl stop_app rabbitmqctl reset

Restart node rabbitmqctl start_app

Step 4 - Re-add RabbitMQ Data

Add user rabbitmqctl add_user mayan YOUR_PASSWORD_FROM_ENV_FILE

Add vhost rabbitmqctl add_vhost mayan

Add permissions rabbitmqctl set_permissions -p mayan mayan ".*" ".*" ".*"

Step 5 - Reboot and Confirm

Reboot the server and check that all is well

JedMeister commented 1 year ago

Thanks tons mate. Good find and nice info. It looks like we should address this in confconsole (in the change hostname plugin). I suggest that we try to make it generic so any other apps that end up using RabbitMQ automatically get the workaround. I don't think that there are any at this point, but may as well do it "proper".

DocCyblade commented 1 year ago

I agree confconsole extension for Mayan to tweak the settings. However one for RabbbetMQ may be more in-depth as it could be like in this case here ver specific to the app at hand. I will research RabbitMQ and see if there is a better way renaming the server, in this way it may be less hacky

Christie018 commented 1 year ago

Would a potential temporary fix be to include some of this documentation in the initial guided install?