Angatar/mailman2

migrating from another server

juddm opened this issue · 3 comments

juddm commented

Hi,

I am migrating lists from another server to a new image. My process is as follows:
tar up the following directories on the old server:

/var/lib/mailman/archives/private/[list].mbox
/var/lib/mailman/archives/private/[list]
/var/lib/mailman/lists/[list]/

and then I untar them on the container - I have mounted volumes as follows:
-v $(pwd)/lists:/var/lib/mailman/lists
-v $(pwd)/archives:/var/lib/mailman/archives \

I execute a shell on the docker image:
docker exec -it mailman /bin/bash

and check the permissions (repeat if it fails):
/usr/lib/mailman/bin/check_perms -f

I then fix the links:
/usr/lib/mailman/bin/withlist -l -r fix_url [list] -v -u [website url]

At this point I can browse all of my archives.

I send an email to the list address and it arrives at the server - /var/log/exim4/mainlog shows:
2021-04-16 15:46:28 1lXQfs-0000zK-5y <= mjudd@sa.[tld] H=(sa.[tld]) [redacted ip] P=esmtps X=TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256 CV=no S=1565 id=d7ae7820-a057-aeb7-03c1-b5d8190774b2@sa.[tld]
2021-04-16 15:46:28 1lXQfs-0000zK-5y => tech <tech@lists.sa.[tld]> R=mailman_router T=mailman_transport
2021-04-16 15:46:28 1lXQfs-0000zK-5y Completed

As I understand it, all of the subscribed users on the list should receive a copy of that email - but they do not.

Have I missed a step in the migration ? Do I need to regenerate some aliases ??
Thanks for any help you might be able to provide.

juddm commented

BTW - I can send email as per the suggestion you made in this post:
#1 (comment)

juddm commented

I have successfully migrated from a server to this container (with 11 years of archive history) using the following approach:

Backup data from the old server

  1. Backup the lists (not actually used)
    tar -zcvf /tmp/mailman-lists.tgz /var/lib/mailman/lists/*
  2. Backup the archives (mbox & html pages of archives)
    tar -zcvf /tmp/mailman-archive.tgz /var/lib/mailmain/archives/*
  3. For each list, export the configuration:
    /usr/lib/mailman/bin/config_list -o /tmp/[LISTNAME].conf [LISTNAME]
  4. For each list, export the subscribers in csv format (I used this script: https://www.msapiro.net/scripts/mailman-subscribers.py)
    ./mm-subscribers.py -c -o [LISTNAME].csv [LIST URL] [LISTNAME] [LIST ADMIN PASSWORD]
  5. copy these files to your docker host

Setup the new docker container

  1. I created volumes for lists and archives & lists
docker volume create mailman-archives
docker volume create mailman-lists
  1. Use these volumes in your container setup (e.g. docker run)
-v mailman-archives:/var/lib/mailman/archives \
-v mailman-lists:/var/lib/mailman/lists \
  1. create the lists using 'newlist'
    docker exec -it mailman newlist [LISTNAME]
  2. copy the list config files to the docker container and import them
    docker cp *.conf mailman:/tmp/ docker exec -it mailman /bin/bash /usr/lib/mailman/bin/config_list -i /tmp/[LISTNAME].conf [LISTNAME]
  3. import archives
cp -ar [LISTNAME]/* /var/lib/docker/volumes/mailman-archives/_data/private/[LISTNAME]/
chown -R root.list /var/lib/docker/volumes/mailman-archives/_data/private/[LISTNAME]
  1. import users - I opened the csv files in a spreadsheet application and copied the email addresses in to the mass subscription box in the web interface of mailman. This was not ideal because it does not update the other fields such as name and moderation status.
  2. I changed the aliases on the old server so they would forward to the new server (during the decommissioning period)
    I changed entries in /etc/aliases:
    mailman-admin: "|/var/lib/mailman/mail/mailman admin mailman"
    to
    mailman-admin: mailman-admin@lists.[NEW DOCKER CONTAINER]
  3. Refresh the aliases
    newaliases

Glad that you migrated successfully from your existing server to this container and thank you very much for sharing your migration process here! Your post will for sure helps similar migrations and I'll point to it for reference.