Deploy app - Galaxy and Atlas:Mongodb

Hi,

I’d like to finally deploy the first version of my first meteor app. It’s an app with mongodb and file upload and those files need a persistent storage (I’m using Meteor-files).

I’d like to use Galaxy to deploy the app and Atlas:mongodb for the db. First Question: Would I need something else to save the files persistently?

I’m confused about the database configuration. Following this https://galaxy-guide.meteor.com/environment-variables.html I tried setting up a settings.json.

First I went to atlas and created an cluster and did the “Get started”-introduction

help4

Now the part about connect your cluster is what I have to do next?
When it came to the options I clicked on “Connect your Application” - I don’t know if that would be the right thing to do. I know from PHP that there are database-connectors, would be a connection string the same thing?

I took the string it gave me and created a settings.json file inside my app-directory

{
  "galaxy.meteor.com": {
     "env": {
       "MONGO_URL": "mongodb+srv://Kuroki:<password>@ddc-eyolr.mongodb.net/test?retryWrites=true&w=majority"
     }
   }
}

Is this string the MONGO_URL it wants? At this point this project is still in an local environment. If all of that would be right, is there still something missing regarding configuring access to the Mongodb?

Setup

Before you begin, configure access to your MongoDB database and set up any environment variables your app depends on.

Thanks for any guiding, I’m … really confused

For your first question, for file uploads you will need another service where the files can be stored.

For Galaxy you want something like the following setup. Disregard any additional parameters in the connection string after the database name and you should be fine.

"galaxy.meteor.com": {
    "env": {
      "ENV": "production",
      "ROOT_URL": "www.mypage.com",
      "MONGO_URL": "mongodb+srv://<user>:<password>@something-something.mongodb.net/<database>",
      "MONGO_OPLOG_URL": "mongodb+srv://<user>:<password>@something-something.mongodb.net/local"
    }
  },

You can try connecting to the production database locally using command like this (don’t forget to whitelist your local ip):

MONGO_URL='<your connection string>' MONGO_OPLOG_URL='<your oplog connection string>' meteor --settings settings.production.json

Thanks. I whitelisted my local IP, that fortunately was part of the get started-thing of atlas!


The connection string here looks like this:

mongodb+srv://Kuroki:<password>@ddc-eyolr.mongodb.net/test?retryWrites=true&w=majority

I changed the your code to this


 {
  "galaxy.meteor.com": {
    "env": {
      "ENV": "production",
      "ROOT_URL": "www.mypage.com",
      "MONGO_URL": "mongodb+srv://Kuroki:<password>@ddc-eyolr.mongodb.net/DDC",
      "MONGO_OPLOG_URL": "mongodb+srv://Kuroki:<password>@ddc-eyolr.mongodb.net/local"
    }
  },
 }

But what means that part of the string test?retryWrites=true&w=majority ?

Also, next up on deploying, I’m reading this:

https://themeteorchef.com/tutorials/deploying-with-meteor-galaxy#tmc-rigging-up-our-npm-script

On my package.json file I created this npm script, trying to follow this tutorial

    "production": "DEPLOY_HOSTNAME=eu-west-1.galaxy.meteor.com meteor deploy ddcalpha.com --owner Kuroki --settings settings.json"

But when I try to “npm run production”, an error occurs

> DEPLOY_HOSTNAME=eu-west-1.galaxy.meteor.com meteor deploy ddcalpha.com --owner Kuroki --settings settings.json

Der Befehl "DEPLOY_HOSTNAME" ist entweder falsch geschrieben oder
konnte nicht gefunden werden. // translation: The command "DEPLOY_HOSTNAME" is written wrong or couldn't be found
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ddc@ production: `DEPLOY_HOSTNAME=eu-west-1.galaxy.meteor.com meteor deploy ddcalpha.com --owner Kuroki --settings settings.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ddc@ production 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!     C:\Users\NERV\AppData\Roaming\npm-cache\_logs\2019-08-27T23_01_40_963Z-debug.log

C:\Users\NERV\Desktop\Projekte\DDCFull>

Makes me think that you’re on Windows?

Yep, there it is.

Because environment variables are set differently between *nix and windows, you’ll need to use a tool like cross-env to set the env var inline in your script.
After installing with npm npm i cross-env, you’ll need to use it in your script like so:

    "production": "cross-env DEPLOY_HOSTNAME=eu-west-1.galaxy.meteor.com meteor deploy ddcalpha.com --owner Kuroki --settings settings.json"

Also, I think you accidentally copied your connection string including your password in the last post. I’ve edited it out and hidden the edit so others can’t see the original, but you should probably change the mongo password anyway

1 Like

Jeez, I shouldn’t ask for help when I’m that tired. Thank you … l changed it right away.

Now it does something but it gives me this error:

Error deploying application: Your account is not authorized to deploy to Galaxy.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ddc@ production: `cross-env DEPLOY_HOSTNAME=eu-west-1.galaxy.meteor.com meteor deploy ddcalpha.com --owner Kuroki --settings settings.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ddc@ production 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!     C:\Users\NERV\AppData\Roaming\npm-cache\_logs\2019-08-28T04_38_51_368Z-debug.log

I logged in with my meteor account, so I’m not sure what the authorization problem could be?

The mentioned log in this error message is this:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'production' ]
2 info using npm@6.4.1
3 info using node@v10.11.0
4 verbose run-script [ 'preproduction', 'production', 'postproduction' ]
5 info lifecycle ddc@~preproduction: ddc@
6 info lifecycle ddc@~production: ddc@
7 verbose lifecycle ddc@~production: unsafe-perm in lifecycle true
8 verbose lifecycle ddc@~production: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\NERV\Desktop\Projekte\DDCFull\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Oculus\Support\oculus-runtime;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Common Files\Adobe\AGL;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\WorldPainter;C:\Program Files (x86)\Brackets\command;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\ProgramData\chocolatey\bin;C:\Users\NERV\AppData\Local\Microsoft\WindowsApps;C:\Users\NERV\AppData\Roaming\npm;C:\Users\NERV\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\NERV\AppData\Roaming\Composer\vendor\bin;C:\Users\NERV\AppData\Local\.meteor;C:\Users\NERV\AppData\Local\GitHubDesktop\bin;C:\Program Files\heroku\bin
9 verbose lifecycle ddc@~production: CWD: C:\Users\NERV\Desktop\Projekte\DDCFull
10 silly lifecycle ddc@~production: Args: [ '/d /s /c',
10 silly lifecycle   'cross-env DEPLOY_HOSTNAME=eu-west-1.galaxy.meteor.com meteor deploy ddcalpha.com --owner Kuroki --settings settings.json' ]
11 silly lifecycle ddc@~production: Returned: code: 1  signal: null
12 info lifecycle ddc@~production: Failed to exec production script
13 verbose stack Error: ddc@ production: `cross-env DEPLOY_HOSTNAME=eu-west-1.galaxy.meteor.com meteor deploy ddcalpha.com --owner Kuroki --settings settings.json`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:962:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid ddc@
15 verbose cwd C:\Users\NERV\Desktop\Projekte\DDCFull
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "production"
18 verbose node v10.11.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error ddc@ production: `cross-env DEPLOY_HOSTNAME=eu-west-1.galaxy.meteor.com meteor deploy ddcalpha.com --owner Kuroki --settings settings.json`
22 error Exit status 1
23 error Failed at the ddc@ production script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Galaxy specific issues I can’t help with, I’ve never used it sorry!

1 Like

Alrite, thanks. I already contacted the support. Could I ask what approach you take to deploy meteor apps?

Those are additional settings for MongoDB that are set properly inside the Meteor mongo packages when the connection is initialized. If you left it there you would run into errors.

Not sure why the deploy script is failing. The only strange thing I can see is that there is Node 10 being used, while current Meteor uses Node 8, but in this instance I don’t think that should matter. But since its Windows I have no clue.

Atlas has given you a modern connection string (‘mongodb+srv…’). I’ve had issues with this. In the Atlas UI, there’s an option to get a connection string in an older format. I’d give that a shot. Has helped me in the past.

I’m not sure if it’s a problem with the string but I’ll try and report, thank you.

I either do deployments completely manually on an EC2 instance or use MUP, depending on the project lifetime and scale.
We often do once-off projects that only last a few days or weeks and it’s easier to just whack it up on an existing EC2 with a wildcard DNS record pointing to it.
Things that last a bit longer or will be regularly updated get their own instance and deployed with MUP

For the larger project we’re working on, we’re looking at hosting it on Galaxy when it’s ready

I deployed a new app 2 weeks ago with Galaxy + Atlas. No problems

Make sure to have the M10 package from Atlas and the Pro level from Galaxy. With the correct IP addresses whitelisted in Atlas

My connection/build string:

{
  "galaxy.meteor.com": {
    "env": {
      "MONGO_URL": "mongodb+srv://dbUser:<password>@staging1-x9fb7.mongodb.net/meteor?retryWrites=true&w=majority",
      "MONGO_OPLOG_URL": "mongodb+srv://oplogUser:<password>@staging1-x9fb7.mongodb.net/local?retryWrites=true&w=majority"
    }
  },
  "public": {},
  "private": {}
}
4 Likes

Hi, thanks -

but where exactly can I find the M10 package from atlas?
Tried googling: https://www.google.com/search?q=atlas+m10+package&rlz=1C1CHBD_deDE811DE811&oq=atlas+m10+package&aqs=chrome..69i57.4312j0j7&sourceid=chrome&ie=UTF-8 But there’s no result.

And what is meant by Pro level from Galaxy?

M10 is a size of an instance. You see it when setting size of the container on Atlas.

You can set Galaxy Professional in your deployment settings on Galaxy. The most important thing it gives you is IP whitelisting, which you need for Galaxy and performance monitoring. It is a bit more expensive than Galaxy Essential, but worth it given the increased security and monitoring.

Ah, thanks, thought it was some kind of npm package.

I whitelisted my own IP address in atlas already. I mean, I just want to test my app, it’s not even done yet. I would like to stay on Essential. It almost sounds like I need this pro Level to deploy my app? Since I want to have the costs as low as possible for now, I also want to stay at the Sandbox cluster for now. If this wouldn’t work, I don’t see why that would be an offer.

No, essential works just fine. You won’t have IP addresses to whitelist in Atlas, so you will have to open that to every IP if you want to connect to Atlas from your Galaxy deployment.

1 Like

I applied this

and this

and it deployed successfully. I looks like I still have some things to do but thats a good start. Thank you to everyone!

1 Like

Keep an eye on your first billing. I just moved away from Atlas as there seems to be issues with huge bandwidth amounts

Thanks, I’m still on sandbox-tier right now. I plan to change that once my app is finished. What kind of issues though? They charge false amounts?