Migration from bundle package to snap

Hello,
I’m using RocketChat from bundle package. I would like to migrate it to snap package, how can I do it without losing any data?

I’d like to know too.

Typically people actually go the opposite direction and move out of snap because they out grow it.

If you have a small server snap is still of course a good choice.

Moving from bundle to snap would go something like this:

mongodump --db rocketchat -o dump
tar -zcvf backup.tar.gz dump

Of course sub rocketchat with the name you used for your database.

Move the backup.tar.gz to the server running the snap.

Then the snap restore steps listed here: https://rocket.chat/docs/installation/manual-installation/ubuntu/snaps/#how-do-i-restore-backup-data-to-my-snap

:slight_smile:

1 Like

That’s exactly what i tried to do and it did not work. My backup is 500Mo is it because it’s too big? I get an error while the script succeeds to export the tarball… what’s wrong?

[*] Extracting backup file...
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
[*] Restoring data...
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
[!] Restore data not found within /var/snap/rocketchat-server/common/rocketchat_dump_2019_01_11.tar.gz!
    Please check that your backup file contains the backup data within the "parties" directory.
[*] Check /var/snap/rocketchat-server/common/restore/extraction.log for details.
[-] Restore aborted!

True. Snap is hard coded to expect the database (directory) to be named parties :no_mouth:

That’s it ? Oh. ok. My bad then. Gonna try it again just now.

@sing.li
So i tried it. Indeed it caused that simple error.

When i import i have an error in mongorestore.log though :frowning:

ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
connected to: 127.0.0.1
2019-01-12T18:02:26.765+0100 var/snap/rocketchat-server/1278/dump/parties/rocketchat_livechat_visitor.bson
2019-01-12T18:02:26.765+0100    going into namespace [parties.rocketchat_livechat_visitor]
2019-01-12T18:02:26.765+0100     dropping
assertion: 15936 Creating collection parties.rocketchat_livechat_visitor failed. Errmsg: exception: can't map file memory - mongo requires 64 bit build for larger datasets

hmmm… seems you’re running 32 bit mongo server … the limit is 2GB on 32 bit mongo. Your DB size is 500MB uncompressed, right?

1 Like

Uncompressed my database is 597 MB

I tried to redo the whole snap install after updating everything and starting from a clean slate.
Now it seems the import goes well until one database file: (see the log file here https://pastebin.com/x8c6Vzm4)

The error at the last line is the following

assertion: 15936 Creating collection parties.rocketchat_raw_imports failed. Errmsg: exception: can't map file memory - mongo requires 64 bit build for larger datasets

Still the same actually but not happening at the start this time… weird. The raw imports is a tiny document actually. And it seems there is no error when mongo tries to import the 522MB chunks.json file

Here is a historical note from official Mongo FWIW

https://jira.mongodb.org/browse/SERVER-1811

  1. ARMHF is not officially supported
  2. Even for supported arm64 platforms, only WiredTiger engine is supported - they seem to have problem getting the mmapv1 engine to work with full spec.

I don’t understand… The snap install works because i managed to install it. So why is it impossible to restore a backup? Does this mean the provided path to install RC on Raspberries can’t allow database restore nor migration? I’m confused. How can it work and not work at the same time…

Hi again!

I’ve experimented some things for quite a few hours.
I’ve had success in importing a database (without the dispensable uploads file) thus making the total gzipped database a size of 18Mo. When importing no errors this time ! :smile::partying_face:

The thing is the three services are active but the URL returns a 502 error.

I think the Caddy log is the relevant one

-- Logs begin at Thu 2016-11-03 18:16:42 CET, end at Tue 2019-01-15 03:00:41 CET. --
Started Service for snap application rocketchat-server.rocketchat-caddy.
cmd.go:105: DEBUG: restarting into "/snap/core/current/usr/bin/snap"
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
Activating privacy features... done.
https://url
http://url
WARNING: File descriptor limit 1024 is too low for production servers. At least 8192 is recommended. Fix with "ulimit -n 8192".

Here is the one from rocketchat.service

Started Service for snap application rocketchat-server.rocketchat-server.
cmd.go:105: DEBUG: restarting into "/snap/core/current/usr/bin/snap"
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
Mongo is not available, can't start. Waiting 10 seconds and trying again
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
Checking if oplog has been enabled, and enabling if not
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
MongoDB shell version: 2.6.10
connecting to: test
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
Will load cache for users
31 records load from users
Will load cache for rocketchat_room
100 records load from rocketchat_room
Will load cache for rocketchat_subscription
412 records load from rocketchat_subscription
Will load cache for rocketchat_settings
786 records load from rocketchat_settings
Updating process.env.MAIL_URL
Starting Email Intercepter...
Will load cache for rocketchat_permissions
87 records load from rocketchat_permissions
Will load cache for rocketchat_roles
11 records load from rocketchat_roles
LocalStore: store created at
LocalStore: store created at
LocalStore: store created at
Warning: connect.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.
Setting default file store to GridFS
LocalStore: store created at
LocalStore: store created at
LocalStore: store created at
Tue, 15 Jan 2019 01:59:36 GMT connect deprecated multipart: use parser (multiparty, busboy, formidable) npm module instead at npm/node_modules/connect/lib/middleware/bodyParser.js:56:20
Tue, 15 Jan 2019 01:59:36 GMT connect deprecated limit: Restrict request size at location of read at npm/node_modules/connect/lib/middleware/multipart.js:86:15
Exception in callback of async function: Error: [Can't find migration version 137]
    at Object.Migrations._findIndexByVersion (/snap/rocketchat-server/1278/programs/server/packages/rocketchat_migrations.js:435:9)
    at Object.Migrations._migrateTo (/snap/rocketchat-server/1278/programs/server/packages/rocketchat_migrations.js:300:25)
    at Object.Migrations.migrateTo (/snap/rocketchat-server/1278/programs/server/packages/rocketchat_migrations.js:227:23)
    at xrun.js (/snap/rocketchat-server/1278/programs/server/app/app.js:7213:25)
    at fileEvaluate (packages/modules-runtime.js:343:9)
    at require (packages/modules-runtime.js:238:16)
    at /snap/rocketchat-server/1278/programs/server/app/app.js:12922:1
    at /snap/rocketchat-server/1278/programs/server/boot.js:411:36
    at Array.forEach (<anonymous>:null:null)
    at /snap/rocketchat-server/1278/programs/server/boot.js:220:19
    at /snap/rocketchat-server/1278/programs/server/boot.js:471:5
    at Function.run (/snap/rocketchat-server/1278/programs/server/profile.js:510:12)
    at /snap/rocketchat-server/1278/programs/server/boot.js:470:11

and the one from mongo.service

cmd.go:105: DEBUG: restarting into "/snap/core/current/usr/bin/snap"
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
2019-01-15T02:58:24.146+0100 [initandlisten] MongoDB starting : pid=781 port=27017 dbpath=/var/snap/rocketchat-server/common 32-bit host=raspberrypi
2019-01-15T02:58:24.155+0100 [initandlisten]
2019-01-15T02:58:24.155+0100 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
2019-01-15T02:58:24.155+0100 [initandlisten] **       32 bit builds are limited to less than 2GB of data (or less with --journal).
2019-01-15T02:58:24.155+0100 [initandlisten] **       See http://dochub.mongodb.org/core/32bit
2019-01-15T02:58:24.156+0100 [initandlisten]
2019-01-15T02:58:24.156+0100 [initandlisten] db version v2.6.10
2019-01-15T02:58:24.156+0100 [initandlisten] git version: nogitversion
2019-01-15T02:58:24.156+0100 [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2019-01-15T02:58:24.156+0100 [initandlisten] build info: Linux kishi10 3.2.0-84-highbank #121-Ubuntu SMP PREEMPT Tue May 5 19:44:15 UTC 2015 armv7l BOOST_LIB_VERSION=1_58
2019-01-15T02:58:24.156+0100 [initandlisten] allocator: tcmalloc
2019-01-15T02:58:24.156+0100 [initandlisten] options: { net: { bindIp: "127.0.0.1" }, processManagement: { pidFilePath: "/var/snap/rocketchat-server/common/mongod.pid" }, replication: { replSet: "rs0" }, storage: { dbPath: "/var/snap/rocketchat-server/common", journal: { enabled: true }, smallFiles: true } }
2019-01-15T02:58:24.190+0100 [initandlisten] journal dir=/var/snap/rocketchat-server/common/journal
2019-01-15T02:58:24.195+0100 [initandlisten] recover : no journal files present, no recovery needed
2019-01-15T02:58:25.999+0100 [initandlisten] waiting for connections on port 27017
2019-01-15T02:58:27.107+0100 [rsStart] query local.system.replset planSummary: COLLSCAN ntoreturn:1 ntoskip:0 nscanned:1 nscannedObjects:1 keyUpdates:0 numYields:1 locks(micros) r:123239 nreturned:1 reslen:108 1106ms
2019-01-15T02:58:27.109+0100 [rsStart] replSet I am localhost:27017
2019-01-15T02:58:27.126+0100 [rsStart] replSet STARTUP2
2019-01-15T02:58:27.127+0100 [rsSync] replSet SECONDARY
2019-01-15T02:58:27.127+0100 [rsMgr] replSet info electSelf 0
2019-01-15T02:58:27.127+0100 [rsMgr] replSet PRIMARY
2019-01-15T02:58:32.430+0100 [initandlisten] connection accepted from 127.0.0.1:37008 #1 (1 connection now open)
2019-01-15T02:58:32.457+0100 [conn1] end connection 127.0.0.1:37008 (0 connections now open)
2019-01-15T02:58:39.807+0100 [initandlisten] connection accepted from 127.0.0.1:37010 #2 (1 connection now open)
2019-01-15T02:58:39.869+0100 [initandlisten] connection accepted from 127.0.0.1:37012 #3 (2 connections now open)
2019-01-15T02:58:39.878+0100 [initandlisten] connection accepted from 127.0.0.1:37014 #4 (3 connections now open)
2019-01-15T02:58:52.068+0100 [conn3] getmore local.oplog.rs cursorid:529075794089 ntoreturn:1000 keyUpdates:0 numYields:0 locks(micros) r:367 nreturned:0 reslen:20 12117ms
2019-01-15T02:58:56.866+0100 [initandlisten] connection accepted from 127.0.0.1:37016 #5 (4 connections now open)
2019-01-15T02:59:07.180+0100 [initandlisten] connection accepted from 127.0.0.1:37018 #6 (5 connections now open)
2019-01-15T02:59:14.368+0100 [initandlisten] connection accepted from 127.0.0.1:37036 #7 (6 connections now open)
2019-01-15T02:59:33.262+0100 [clientcursormon] mem (MB) res:36 virt:954
2019-01-15T02:59:33.263+0100 [clientcursormon]  mapped (incl journal view):704
2019-01-15T02:59:33.263+0100 [clientcursormon]  connections:6
2019-01-15T02:59:33.263+0100 [clientcursormon]  replication threads:4
2019-01-15T03:04:33.393+0100 [clientcursormon] mem (MB) res:36 virt:958
2019-01-15T03:04:33.393+0100 [clientcursormon]  mapped (incl journal view):704
2019-01-15T03:04:33.393+0100 [clientcursormon]  connections:6
2019-01-15T03:04:33.393+0100 [clientcursormon]  replication threads:4


Looks like rocket.chat didn’t come up, probably due to different versions between your current snap install and the one you had before?

It was indeed the case. My RocketChat installation was at the last version. Snap install is not fully up to date.
Does that mean i will only be able to migrate when the snap install is up to date?

Hello. I have installed version of Rocket Chat 3.1.1 by this instruction https://docs.rocket.chat/installation/manual-installation/ubuntu
I want to migrate to snap version for simple upgrade rocket chat. Sorry, my knowledge for node and mongo is very poor. I create dump by executing from post @aaron.ogle and try to restore backup by this instruction https://rocket.chat/docs/installation/manual-installation/ubuntu/snaps/#how-do-i-restore-backup-data-to-my-snap, but I have error when restore backup

snap run rocketchat-server.restoredb /var/snap/rocketchat-server/common/backup.tar.gz
*** ATTENTION ***

  • Your current database WILL BE DROPPED prior to the restore!
  • Do you want to continue?
  1. Yes
  2. No
    #? 1
    [] Extracting backup file…
    ls: cannot access ‘/var/snap/rocketchat-server/common/restore/dump/parties’: No such file or directory
    [!] No restore data found within /var/snap/rocketchat-server/common/restore/dump/parties!
    [
    ] Check /var/snap/rocketchat-server/common/restore/restore_20200613.0036.log for details.
    Restore aborted!