Am I Using "ros init" properly?



I have an app that works fine with Realm currently; I’ve got the ROS 2.0.18 running on an AWS EC2 instance, which started with a “blank” Ubuntu AMI onto which I installed/started ROS using, I believe, curl -s | bash. It’s possible I started it with npm install -g realm-object-server; however I’m pretty positive I’ve never typed ros init, or any versions of ros init my-app, at any point in any process.

I’m preparing to integrate Google Authentication, and the ROS documentation says "To include the Google provider, create a Realm Object Server project via ros init" and then has some code.

I imagine this means I need to SSH into my server (which is already up and running for ROS) and enter ros init. And then put the code from the documentation in the window that I imagine will pop up.

But I don’t really know anything about ros init or what an ros project actually is (or node or anything like that for that matter), so I’m a little trepidatious, and these questions come up:

  1. Will ros init mess anything up that’s currently on my server? Does it “initialize” or reset anything?
  2. Assuming the answer to #1 is “no”, what do I do once I’ve pasted the code into this file (assuming I’m correct about what to do wit the code)? Do I need to make my app or my ROS instance aware of it somehow?
  3. Anything else I’m missing?

Thank you.


hey @tuzmusic if you’ve already have ROS running you do not need to run ros init - just go to the folder running realm object server and you can add the GoogleAuth to the RealmObjectServer app


Thanks a lot @ianward! I actually don’t know how to do that. When I SSH into my server, I’m assuming that puts me in the folder you’re referring to? It contains:
data realm-object-server ros-install.log

The realm-object-server directory contains
io.realm.object-server-recovered-realms io.realm.object-server-utility listener
And a ton of directories that start with

What do I do? I’m very new (completely, really!) to the server aspect of this, if you couldn’t tell!


@tuzmusic This does not seem right - I think you are running an old version. It would probably be best to bring up a new version of ROS with the latest install instructions and stop your old one


I’m running 2.0.18. That seems pretty current, no?

By the way, the prompt reads [email protected]:~$. Is that where I should be looking?

Oh also by the way; in case it wasn’t clear, in the listing I provided under that root prompt, the first two are directories, the last is a file.

Am I trying to find an index.ts file? (a bit of research finally turned that up for me as the place to edit the ros app! finally!)


@tuzmusic Yes you should be looking for an index.ts or an index.js file - that is where you want to put in your code for your new auth provider


Yes, as stated I don’t see that anywhere. Where should I expect to see it in my folder hierarchy?

Or, rather, given that it’s not there currently, what should I do? As I mentioned, accessing the realm from my app and realm studio works fine.


@tuzmusic If you used ros init myROS to start the server and then npm start for the server the folder structure would be ~/myROS/src/index.ts

You may have to look through the processes on your server and work backward if it is running and you don’t know where you installed it.


I don’t think I ever used ros init. Is that even possible? Was it maybe embedded in the curl script?

I’ll check out that path though, thanks!


An update:

I tried running ros backup and it just gives me the basic help output.

So I went for broke and ran ros init YpbServer and got a whole bunch of stuff which I’m sure is familiar to you:

> [email protected] install /home/ubuntu/YpbServer/node_modules/realm-object-server/node_modules/realm-one/node_modules/realm
> node-pre-gyp install --fallback-to-build

[realm] Success: "/home/ubuntu/YpbServer/node_modules/realm-object-server/node_modules/realm-one/node_modules/realm/compiled/node-v57_linux_x64/realm.node" is installed via remote

> [email protected] install /home/ubuntu/YpbServer/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

[bcrypt] Success: "/home/ubuntu/YpbServer/node_modules/bcrypt/lib/binding/bcrypt_lib.node" is installed via remote

> [email protected] install /home/ubuntu/YpbServer/node_modules/realm
> node-pre-gyp install --fallback-to-build

[realm] Success: "/home/ubuntu/YpbServer/node_modules/realm/compiled/node-v57_linux_x64/realm.node" is installed via remote

> [email protected] install /home/ubuntu/YpbServer/node_modules/uws
> node-gyp rebuild > build_log.txt 2>&1 || exit 0

 created a lockfile as package-lock.json. You should commit this file.

 [email protected] requires a peer of [email protected]~3.5.0 but none is installed. You must install peer dependencies yourself.

 [email protected] No repository field.

 [email protected] No license field.

+ re[email protected]
added 476 packages in 20.606s

 [email protected] requires a peer of [email protected]~3.5.0 but none is installed. You must install peer dependencies yourself.

 [email protected] No repository field.

 WARN [email protected] No license field.

added 1 package in 3.007s

then, after going into the directory, a few errors…

[email protected]:~/YpbServer$ npm start

> [email protected] start /home/ubuntu/YpbServer
> npm run build && node dist/index.js

> [email protected] build /home/ubuntu/YpbServer
> rm -rf dist; ./node_modules/.bin/tsc

info: Loaded feature token capabilities=[Sync], expires=Wed Apr 19 2017 14:15:29 GMT+0000 (UTC)
info: Realm Object Server version 2.8.1 is starting
      throw er; // Unhandled 'error' event

Error: listen EADDRINUSE
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at Server.setupListenHandle [as _listen2] (net.js:1351:14)
    at listenInCluster (net.js:1392:12)
    at doListen (net.js:1501:7)
    at _combinedTickCallback (internal/process/next_tick.js:141:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
npm ERR! errno 1
npm ERR! [email protected] start: `npm run build && node dist/index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2018-03-14T18_59_58_963Z-debug.log


[email protected]:~/YpbServer/src$ open index.ts
Couldn't get a file descriptor referring to the console
[email protected]:~/YpbServer/src$ edit index.ts
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%{ <-- HERE (.*?)}/ at /usr/bin/edit line 528.
Error: no "edit" mailcap rules found for type "video/mp2t"

So I’m pretty lost. Thanks for your help!


@tuzmusic You are probably on an older 1.x version try systemctl list-units | grep realm

Can you wipe the server and start over?


Not sure where I would execute that. I tried it at ~ and at ~/YpbServer and nothing happened at all. Also, note that in the log it said “Realm Object Server version 2.8.1 is starting”

Either way, please tell me there’s a way to back up everything that’s currently stored in my synced realm? Also, I don’t know how to wipe the server anyway… 0:-)