imapsync on a mac takes too much ram
Fabian Blechschmidt
I’m currently migrating emails for one of our customers from the old hosting company to the new one. To do this we are using imapsync – an awesome tool!
TL;DR: Just use the docker box by Gilles…
https://hub.docker.com/r/gilleslamiral/imapsync
My own journey
But currently there is a weird bug on mac, that it might take a lot of memory up to the moment, that the process is killed. So I thought I „just“ use a linux based docker box, which is not so easy at all.
One can start a box with the following command and mount the current working dir into /current – because I had my csv file and the loop script already here.
docker run -v .:/current -it --rm ubuntu /bin/bash
And then we need to install afew things to make imapsync compile
apt-get install libauthen-ntlm-perl libclass-load-perl libcrypt-ssleay-perl libdata-uniqid-perl libdigest-hmac-perl libdist-checkconflicts-perl libencode-imaputf7-perl libfile-copy-recursive-perl libfile-tail-perl libio-compress-perl libio-socket-inet6-perl libio-socket-ssl-perl libio-tee-perl libmail-imapclient-perl libmodule-scandeps-perl libnet-dbus-perl libnet-ssleay-perl libpar-packer-perl libreadonly-perl libregexp-common-perl libsys-meminfo-perl libterm-readkey-perl libtest-fatal-perl libtest-mock-guard-perl libtest-mockobject-perl libtest-pod-perl libtest-requires-perl libtest-simple-perl libunicode-string-perl liburi-perl libtest-nowarnings-perl libtest-deep-perl libtest-warn-perl make cpanminus git libssl-dev binutils as gcc-aarch64-linux-gnu
cpanm Crypt::OpenSSL::RSA Crypt::OpenSSL::Random --force
cpanm Mail::IMAPClient JSON::WebToken Test::MockObject
cpanm Unicode::String Data::Uniqid
cpanm CGI Crypt::OpenSSL::RSA JSON::WebToken::Crypt::RSA
cd /tmp/
git clone https://github.com/imapsync/imapsync.git
cd imapsync
mkdir -p dist
make install
# imapsync finally runs
imapsync
And while max killed the process after a couple of minutes, on Linux it just runs smoothly after 10mins:
$ docker stats
CONTAINER ID NAME MEM USAGE / LIMIT MEM % NET I/O
c3bbc5ad8784 vibrant_hawking 272.2MiB / 7.81GiB 3.40% 816MB / 579MB
Other articles from this category
Shopware 6 Hidden Gems #16: CloneBehavior — entity duplication with overrides, one call
You know the admin’s „duplicate“ button on products. Now the ticket says: „We need that, but from code — duplicate a product per sales channel, with adjusted name and its own product number.“ Or: „Campaign landing pages: clone this CMS page 20 times with different headlines.“ I’ve watched this get implemented as: load entity with […]
Shopware 6 Hidden Gems #15: ChangeSet — before/after values for every write, no second query
The requirement sounds harmless every time: „Log when a product price changes, with old and new value.“ Or: „When an order’s email changes, notify the old address.“ Or the audit-trail classic: „Who changed what, from what, to what?“ And every time, the naive implementation is the same sad shape: subscribe to product.written, load the entity […]
Shopware 6 Hidden Gems #14: WriteProtected & ApiAware — field-level security without a single subscriber
A code review scenario. A plugin adds a purchasePrice-style field to a custom entity — internal margin data. The review question: „Can the Store API read this?“ Followed by: „Can the Admin API write that computed field you recalculate in a subscriber?“ The answers, in the plugin at hand, were „yes“ and „yes, and then […]