3

I'm currently working on a fork of the Meteor application Rocket Chat. I have a requirement to stand up the application for testing and development on an isolated network, so no internet access whatsoever.

I can't just get it running on a connected system and then copy it wholesale into the disconnected lab. Rather, I need to be able to check out a copy of the source code (from a local SCM) and then run Meteor, letting it perform all necessary compilation and dependency resolution on the fly.

Even though it is a huge kludge, I was hoping that I could just copy the .meteor folder from a working system directly onto the target system so that it would already have a cache of all required packages and therefore not need to reach out to any repositories. However, from what I have found, that only works for Meteor dependencies downloaded from Atmosphere.

Within Rocket Chat, there are several private packages (such as rocketchat-ldap) that have dependencies on NPM packages (in this case, ldapjs). When the application is run and these packages are built, the .npm folder in the user's home directory gets populated with those NPM packages. So, I tried to package that folder up along with the .meteor folder to accomplish the same task.

Unfortunately, when I tested it on the offline system, despite having the populated .npm folder, Meteor spits out the following error:

While building package rocketchat:ldap: error: Can't install npm dependencies. Are you connected to the internet?

Obviously, I'm not connected - by design.

So, I am currently looking into Sinopia to stand up an NPM repository mirror on our local network that can host these dependencies. However, I have no idea how I'm supposed to point Meteor to the alternate server. The Meteor documentation includes information about the Npm.depends and Npm.requires directives, which the application uses, but I can't find anything about specifying a URL from which to find said packages.

Further, is it possible to do something similar with the Atmosphere packages? Or is copying the .meteor folder the only way? As in, is there some application out there that I can use to host some of the Meteor packages? Or am I going about this in the wrong way?

Douglas Rapp
  • 115
  • 1
  • 9
  • 1
    What about `meteor build`? Is that an option for you? Since you won't be able to do any serious development on that offline machine anyways, it probably doesn't make sense to deploy anything but the bundle. I believe it will be easier (trivial?) to get the bundle to run offline. – Christian Fritz Sep 25 '15 at 23:05
  • That may just be the only way to go, but I was hoping it wasn't. It's frustrating that having internet access is required to run the application otherwise. – Douglas Rapp Sep 28 '15 at 17:51
  • I guess I don't see what's wrong with running the bundle created by `build`. Running `meteor` directly is meant for development, and I can't see why you would like to develop on a machine without internet. – Christian Fritz Sep 28 '15 at 17:56
  • Just unique (government) requirements in which some lab activities have to occur and stay there. – Douglas Rapp Sep 28 '15 at 17:58
  • 1
    well, I guess you could always "spoof" npm and overwrite npmjs.com in your /etc/hosts file to a local server of your choice where you've replicated the packages you require (not saying that latter part would be easy, though). – Christian Fritz Sep 28 '15 at 20:17

1 Answers1

0

The solution I went with, which isn't as elegant as I'd hoped was the following:

First, I copied the .meteor folder from the user account of a "working" system (this contains the Meteor executable and all of the Meteor packages downloaded from Atmosphere) to the user account of the disconnected target system. This allowed the target system to run Meteor.

Second, the NPM packages in question were being downloaded directly into the private packages in the source, but the .gitignore file on the source was set to ignore the node_modules folders. So I altered that and then checked those node_modules folders into the source with the rest of the application.

So, for example, the application source included a /packages/rocketchat-ldap/.npm/package folder. Then, when the application was run using meteor, the associated NPM packages (such as ldapjs) would get downloaded directly into a node_modules folder in that folder structure, at which point the private packages could be built.

Now, the source code in Git already contains those downloaded packages, so when a copy is checked out onto the disconnected target system, there is no need to download them.

Fortunately, this did not increase the size of the source very much (just a few hundred kilobytes).

The result is that when running meteor to run the application on the target system, all dependencies are already in place, and no internet connection is required.

Douglas Rapp
  • 115
  • 1
  • 9