Description
I just installed ubuntu server in order to run a rocket chat server. It runs smooth with a generic installation from snap, but I’d like to run it as a non root user for security reasons. I was inspired by this guide, but modified it to go with the snap installation, and created the new user “rocketchat” to run the server. The thing that didn’t work in the guide was that I couldn’t (and don’t know if I’m supposed to) change premissions for the /snap/rocketchat-package.
[Unit]
Description=The Rocket.Chat server
After=network.target remote-fs.target nss-lookup.target nginx.target mongod.target
[Service]
ExecStart=/usr/local/bin/node /snap/rocketchat-server/current/main.js
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=rocketchat
Environment=MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01 MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01 ROOT_URL=http://localhost:3000/ PORT=3000
[Install]
WantedBy=multi-user.target
Rocket chat first starts fine, but as soon as I’m trying to log in from another computer on 192.168.0.50:3000 but I can’t access it and sudo systemctl status rocketchat returns:
● rocketchat.service - The Rocket.Chat server
-
Loaded: loaded (/etc/systemd/system/rocketchat.service; enabled; vendor preset: enabled)*
-
Active: active (running) since Fri 2020-11-13 07:59:56 UTC; 16min ago*
- Main PID: 2138729 (node)
-
Tasks: 11 (limit: 9090)*
-
Memory: 440.3M*
-
CGroup: /system.slice/rocketchat.service*
-
└─2138729 /usr/local/bin/node /snap/rocketchat-server/current/main.js*
Nov 13 08:00:11 lala rocketchat[2138729]: at /snap/rocketchat-server/1442/programs/server/boot.js:464:7
Nov 13 08:00:11 lala rocketchat[2138729]: at Function.run (/snap/rocketchat-server/1442/programs/server/profile.js:280:14)
Nov 13 08:00:11 lala rocketchat[2138729]: at /snap/rocketchat-server/1442/programs/server/boot.js:463:13 {
Nov 13 08:00:11 lala rocketchat[2138729]: isClientSafe: true,
Nov 13 08:00:11 lala rocketchat[2138729]: error: “Can’t find migration version 206”,
Nov 13 08:00:11 lala rocketchat[2138729]: reason: undefined,
Nov 13 08:00:11 lala rocketchat[2138729]: details: undefined,
Nov 13 08:00:11 lala rocketchat[2138729]: message: “[Can’t find migration version 206]”,
Nov 13 08:00:11 lala rocketchat[2138729]: errorType: ‘Meteor.Error’
Nov 13 08:00:11 lala rocketchat[2138729]: }
I tried the solution provided here: but it doesn’t work.
Any ideas how to fix this? Or another/easier way to run the snap-version as a non root user?
Server Setup Information
- Version of Rocket.Chat Server: 3.x/stable: 3.6.2 2020-09-21 (1442)
- Operating System: Ubuntu 20.04
- Deployment Method: snap (modified to start as a non root user)
- Number of Running Instances:
- DB Replicaset Oplog:
- NodeJS Version: v12.14.0
- MongoDB Version: v4.0.21
- Proxy:
- Firewalls involved:
Any additional Information
Oplog:
{ “ts” : Timestamp(1605125311, 1), “h” : NumberLong(“7736934071068875128”), “v” : 2, “op” : “n”, “ns” : “”, “wall” : ISODate(“2020-11-11T20:08:31.296Z”), “o” : { “msg” : “initiating set” } }
{ “ts” : Timestamp(1605125311, 3), “t” : NumberLong(1), “h” : NumberLong(“2516404757727366958”), “v” : 2, “op” : “n”, “ns” : “”, “wall” : ISODate(“2020-11-11T20:08:31.423Z”), “o” : { “msg” : “new primary” } }
{ “ts” : Timestamp(1605125311, 4), “t” : NumberLong(1), “h” : NumberLong("-262971230112883355"), “v” : 2, “op” : “c”, “ns” : “config.$cmd”, “ui” : UUID(“ec4dfbde-6f31-478a-9fd3-3d2b0623b3bd”), “wall” : ISODate(“2020-11-11T20:08:31.515Z”), “o” : { “create” : “transactions”, “idIndex” : { “v” : 2, “key” : { “_id” : 1 }, “name” : “id”, “ns” : “config.transactions” } } }
{ “ts” : Timestamp(1605125311, 5), “t” : NumberLong(1), “h” : NumberLong(“8705872293286133938”), “v” : 2, “op” : “c”, “ns” : “admin.$cmd”, “ui” : UUID(“f87c55bd-dd8a-41f1-85e6-84243260c98e”), “wall” : ISODate(“2020-11-11T20:08:31.517Z”), “o” : { “create” : “system.keys”, “idIndex” : { “v” : 2, “key” : { “_id” : 1 }, “name” : “id”, “ns” : “admin.system.keys” } } }
{ “ts” : Timestamp(1605125311, 6), “t” : NumberLong(1), “h” : NumberLong("-5999876763283466920"), “v” : 2, “op” : “i”, “ns” : “admin.system.keys”, “ui” : UUID(“f87c55bd-dd8a-41f1-85e6-84243260c98e”), “wall” : ISODate(“2020-11-11T20:08:31.517Z”), “o” : { “_id” : NumberLong(“6893960716726829059”), “purpose” : “HMAC”, “key” : BinData(0,“A1Ndv6FB+V3lpL6mkM8rhyQAdhc=”), “expiresAt” : Timestamp(1612901311, 0) } }
{ “ts” : Timestamp(1605125311, 7), “t” : NumberLong(1), “h” : NumberLong("-5784316428664502705"), “v” : 2, “op” : “i”, “ns” : “admin.system.keys”, “ui” : UUID(“f87c55bd-dd8a-41f1-85e6-84243260c98e”), “wall” : ISODate(“2020-11-11T20:08:31.548Z”), “o” : { “_id” : NumberLong(“6893960716726829060”), “purpose” : “HMAC”, “key” : BinData(0,“0asUaoiuc7Ic8EwhsSUX16Ap91o=”), “expiresAt” : Timestamp(1620677311, 0) } }
{ “ts” : Timestamp(1605125331, 1), “t” : NumberLong(1), “h” : NumberLong("-7120119198156967109"), “v” : 2, “op” : “n”, “ns” : “”, “wall” : ISODate(“2020-11-11T20:08:51.516Z”), “o” : { “msg” : “periodic noop” } }
{ “ts” : Timestamp(1605125341, 1), “t” : NumberLong(1), “h” : NumberLong(“6009333138134714875”), “v” : 2, “op” : “n”, “ns” : “”, “wall” : ISODate(“2020-11-11T20:09:01.516Z”), “o” : { “msg” : “periodic noop” } }
{ “ts” : Timestamp(1605125347, 1), “t” : NumberLong(1), “h” : NumberLong(“7252269956932577630”), “v” : 2, “op” : “c”, “ns” : “rocketchat.$cmd”, “ui” : UUID(“e83d02b3-433f-4b51-adba-75e97eb5857a”), “wall” : ISODate(“2020-11-11T20:09:07.003Z”), “o” : { “create” : “users”, “idIndex” : { “v” : 2, “key” : { “_id” : 1 }, “name” : “id”, “ns” : “rocketchat.users” } } }
{ “ts” : Timestamp(1605125347, 2), “t” : NumberLong(1), “h” : NumberLong(“9127821719084357697”), “v” : 2, “op” : “n”, “ns” : “”, “wall” : ISODate(“2020-11-11T20:09:07.003Z”), “o” : { “msg” : “Creating indexes. Coll: rocketchat.users” } }
{ “ts” : Timestamp(1605125347, 3), “t” : NumberLong(1), “h” : NumberLong(“5629210181893576337”), “v” : 2, “op” : “c”, “ns” : “rocketchat.$cmd”, “ui” : UUID(“e83d02b3-433f-4b51-adba-75e97eb5857a”), “wall” : ISODate(“2020-11-11T20:09:07.006Z”), “o” : { “createIndexes” : “users”, “v” : 2, “unique” : true, “key” : { “username” : 1 }, “name” : “username_1”, “sparse” : true } }
{ “ts” : Timestamp(1605125347, 4), “t” : NumberLong(1), “h” : NumberLong("-920188230507739176"), “v” : 2, “op” : “n”, “ns” : “”, “wall” : ISODate(“2020-11-11T20:09:07.011Z”), “o” : { “msg” : “Creating indexes. Coll: rocketchat.users” } }
{ “ts” : Timestamp(1605125347, 5), “t” : NumberLong(1), “h” : NumberLong("-4938532207555349186"), “v” : 2, “op” : “c”, “ns” : “rocketchat.$cmd”, “ui” : UUID(“e83d02b3-433f-4b51-adba-75e97eb5857a”), “wall” : ISODate(“2020-11-11T20:09:07.011Z”), “o” : { “createIndexes” : “users”, “v” : 2, “unique” : true, “key” : { “emails.address” : 1 }, “name” : “emails.address_1”, “sparse” : true } }
{ “ts” : Timestamp(1605125347, 6), “t” : NumberLong(1), “h” : NumberLong(“5576663808441970140”), “v” : 2, “op” : “n”, “ns” : “”, “wall” : ISODate(“2020-11-11T20:09:07.015Z”), “o” : { “msg” : “Creating indexes. Coll: rocketchat.users” } }
{ “ts” : Timestamp(1605125347, 7), “t” : NumberLong(1), “h” : NumberLong("-506995488263622673"), “v” : 2, “op” : “c”, “ns” : “rocketchat.$cmd”, “ui” : UUID(“e83d02b3-433f-4b51-adba-75e97eb5857a”), “wall” : ISODate(“2020-11-11T20:09:07.015Z”), “o” : { “createIndexes” : “users”, “v” : 2, “unique” : true, “key” : { “services.resume.loginTokens.hashedToken” : 1 }, “name” : “services.resume.loginTokens.hashedToken_1”, “sparse” : true } }
{ “ts” : Timestamp(1605125347, 8), “t” : NumberLong(1), “h” : NumberLong(“5478677978425177032”), “v” : 2, “op” : “n”, “ns” : “”, “wall” : ISODate(“2020-11-11T20:09:07.017Z”), “o” : { “msg” : “Creating indexes. Coll: rocketchat.users” } }
{ “ts” : Timestamp(1605125347, 9), “t” : NumberLong(1), “h” : NumberLong(“6351077962552245885”), “v” : 2, “op” : “c”, “ns” : “rocketchat.$cmd”, “ui” : UUID(“e83d02b3-433f-4b51-adba-75e97eb5857a”), “wall” : ISODate(“2020-11-11T20:09:07.017Z”), “o” : { “createIndexes” : “users”, “v” : 2, “unique” : true, “key” : { “services.resume.loginTokens.token” : 1 }, “name” : “services.resume.loginTokens.token_1”, “sparse” : true } }
{ “ts” : Timestamp(1605125347, 10), “t” : NumberLong(1), “h” : NumberLong("-1739124622549197922"), “v” : 2, “op” : “n”, “ns” : “”, “wall” : ISODate(“2020-11-11T20:09:07.020Z”), “o” : { “msg” : “Creating indexes. Coll: rocketchat.users” } }
{ “ts” : Timestamp(1605125347, 11), “t” : NumberLong(1), “h” : NumberLong("-520141280118157264"), “v” : 2, “op” : “c”, “ns” : “rocketchat.$cmd”, “ui” : UUID(“e83d02b3-433f-4b51-adba-75e97eb5857a”), “wall” : ISODate(“2020-11-11T20:09:07.020Z”), “o” : { “createIndexes” : “users”, “v” : 2, “key” : { “services.resume.haveLoginTokensToDelete” : 1 }, “name” : “services.resume.haveLoginTokensToDelete_1”, “sparse” : true } }
{ “ts” : Timestamp(1605125347, 12), “t” : NumberLong(1), “h” : NumberLong("-486078367645424687"), “v” : 2, “op” : “n”, “ns” : “”, “wall” : ISODate(“2020-11-11T20:09:07.022Z”), “o” : { “msg” : “Creating indexes. Coll: rocketchat.users” } }