Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy different Meteor settings per site #59

Closed
WayneUong opened this issue Jul 2, 2018 · 22 comments
Closed

Deploy different Meteor settings per site #59

WayneUong opened this issue Jul 2, 2018 · 22 comments
Assignees

Comments

@WayneUong
Copy link

Is there a way to deploy the same meteor app to multiple web apps, but with different settings, without having to rebuild them every time? Thank you.

@ramijarrar
Copy link
Member

ramijarrar commented Jul 3, 2018

Yes - this is implemented in v2.1.0-rc.6 (we've been using it in production for the last few months to deploy across multiple regions).

Just format the meteor-azure key as an array of objects with the regular format - so e.g

{
  // ... keys for Meteor.settings
  "meteor-azure": [
    {
      "siteName": "app name",
      "resourceGroup": "resource group",
      "subscriptionId": "subscription ID",
      "tenantId": "tenant ID",
      "deploymentCreds": {
        "username": "username",
        "password": "password"
      },
      "envVariables": {
        "ROOT_URL": "https://<app name>.azurewebsites.net",
        "MONGO_URL": "MongoDB URL"
      }
    },
    {
      // ... site 2 settings
    },
    {
      // ... site 3 settings
    },
    // ...
  ]
}

Let me know if you have any issues - this should be released officially in the next couple weeks with proper docs.

@WayneUong
Copy link
Author

@ramijarrar can I specify a different a meteor setting object for each app?

@ramijarrar
Copy link
Member

ramijarrar commented Jul 3, 2018

Not at this stage - what's the use case? I can definitely add an option to override specific keys per site, but it might be cleaner to just allow an array of paths in the CLI.

@ramijarrar ramijarrar reopened this Jul 3, 2018
@ramijarrar ramijarrar changed the title Deploy the same repo to multiple web apps Deploy different Meteor settings per site Jul 3, 2018
@ramijarrar ramijarrar self-assigned this Jul 3, 2018
@WayneUong
Copy link
Author

We have the same app in multiple regions and also a staging app and several development apps for developers. Each has its own set of keys stored in meteor settings. With meteor up, we could deploy the same bundle to different server/meteor settings with --cached-build.

@ramijarrar
Copy link
Member

Okay, I think the cleanest solution will be to accept a list of paths in the deploy command. We have a similar need for an upcoming project so might have some time to work on this later tonight.

On a separate note - what service are you using to route traffic between regions?

@WayneUong
Copy link
Author

WayneUong commented Jul 3, 2018

Each region has its own subdomain and a separate login server to redirect users to the right one. We also have a AWS load balancer for each region, which balances multiple servers. Azure web apps should make that process much simpler.

@WayneUong
Copy link
Author

@ramijarrar If this feature takes too long to finish, can you add a quick option to ignore meteor settings? We can always set the METEOR_SETTINGS variable manually in Azure.

@ramijarrar
Copy link
Member

Have just released v2.1.0-rc.7 which accepts a comma separated list of settings files e.g

meteor-azure --settings 'foo/bar.json,baz.json'

Also - we've implemented an option to select Node architecture (assuming you are on Meteor 1.6+):

meteor-azure --settings 'foo/bar.json,baz.json' --architecture 64

Let me know if you have any issues with the above.

@WayneUong
Copy link
Author

WayneUong commented Jul 4, 2018

I these errors when deploying just 1 app:

meteor-azure --settings dev.json --architecture 64

Wed Jul 04 2018 07:36:33 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
Error: Missing binary. See message above.
    at Object.<anonymous> (D:\home\site\wwwroot\programs\server\node_modules\fibers\fibers.js:20:9)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\home\site\wwwroot\programs\server\boot.js:1:75)
    at Module._compile (module.js:652:30)
Wed Jul 04 2018 07:36:40 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
Error: Missing binary. See message above.
    at Object.<anonymous> (D:\home\site\wwwroot\programs\server\node_modules\fibers\fibers.js:20:9)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\home\site\wwwroot\programs\server\boot.js:1:75)
    at Module._compile (module.js:652:30)
Wed Jul 04 2018 07:37:19 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
Error: Cannot find module 'meteor-deque'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.resolve (internal/module.js:18:19)
    at Object.require (D:\home\site\wwwroot\programs\server\boot.js:288:32)
    at packages\meteor.js:739:32
    at packages\meteor.js:910:4
    at packages\meteor.js:1463:3
    at D:\home\site\wwwroot\programs\server\boot.js:411:36
    at Array.forEach (<anonymous>)
    at D:\home\site\wwwroot\programs\server\boot.js:220:19
    at D:\home\site\wwwroot\programs\server\boot.js:471:5
Wed Jul 04 2018 07:38:49 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
Error: Cannot find module 'meteor-deque'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.resolve (internal/module.js:18:19)
    at Object.require (D:\home\site\wwwroot\programs\server\boot.js:288:32)
    at packages\meteor.js:739:32
    at packages\meteor.js:910:4
    at packages\meteor.js:1463:3
    at D:\home\site\wwwroot\programs\server\boot.js:411:36
    at Array.forEach (<anonymous>)
    at D:\home\site\wwwroot\programs\server\boot.js:220:19
    at D:\home\site\wwwroot\programs\server\boot.js:471:5
Wed Jul 04 2018 07:39:14 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
Error: Cannot find module 'D:\home\site\wwwroot\programs\server\npm\node_modules\meteor\meteor\node_modules\meteor-deque'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.require (D:\home\site\wwwroot\programs\server\boot.js:284:20)
    at packages\meteor.js:739:32
    at packages\meteor.js:910:4
    at packages\meteor.js:1463:3
    at D:\home\site\wwwroot\programs\server\boot.js:411:36
    at Array.forEach (<anonymous>)
Wed Jul 04 2018 07:39:40 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
Error: Cannot find module 'D:\home\site\wwwroot\programs\server\npm\node_modules\meteor\meteor\node_modules\meteor-deque'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.require (D:\home\site\wwwroot\programs\server\boot.js:284:20)
    at packages\meteor.js:739:32
    at packages\meteor.js:910:4
    at packages\meteor.js:1463:3
    at D:\home\site\wwwroot\programs\server\boot.js:411:36
    at Array.forEach (<anonymous>)
Wed Jul 04 2018 07:40:05 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
Error: Cannot find module 'D:\home\site\wwwroot\programs\server\npm\node_modules\meteor\meteor\node_modules\meteor-deque'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.require (D:\home\site\wwwroot\programs\server\boot.js:284:20)
    at packages\meteor.js:739:32
    at packages\meteor.js:910:4
    at packages\meteor.js:1463:3
    at D:\home\site\wwwroot\programs\server\boot.js:411:36
    at Array.forEach (<anonymous>)
Wed Jul 04 2018 07:42:07 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
Error: Cannot find module 'D:\home\site\wwwroot\programs\server\npm\node_modules\meteor\meteor\node_modules\meteor-deque'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.require (D:\home\site\wwwroot\programs\server\boot.js:284:20)
    at packages\meteor.js:739:32
    at packages\meteor.js:910:4
    at packages\meteor.js:1463:3
    at D:\home\site\wwwroot\programs\server\boot.js:411:36
    at Array.forEach (<anonymous>)

@WayneUong
Copy link
Author

It suddenly just works, I did not change any settings. But I notice that websocket fails to connect occasionally, maybe 1 out of 10 times. It's much less frequent than deploying to linux/docker web apps though.

@ramijarrar
Copy link
Member

ramijarrar commented Jul 4, 2018

Have you changed the host architecture to 64-bit in the Azure portal? Also are you using a custom server initialization script?

(FYI, the multi-settings deployment is not dependent on architecture in any way)

@WayneUong
Copy link
Author

WayneUong commented Jul 4, 2018

Yeah I changed the platform architecture to 64-bit and used --architecture 64 to deploy.

screen shot 2018-07-04 at 9 15 56 am

No I did not customize any script. But is there a way to install non-npm dependencies like wkhtmltopdf or phantomjs?

@WayneUong
Copy link
Author

When I tried using 32-bit, I got these errors:

Wed Jul 04 2018 16:45:25 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
Error: Cannot find module 'double-ended-queue'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\home\site\wwwroot\programs\server\npm\node_modules\meteor\meteor\node_modules\meteor-deque\index.js:1:18)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
Wed Jul 04 2018 16:45:48 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
Error: Cannot find module 'double-ended-queue'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\home\site\wwwroot\programs\server\npm\node_modules\meteor\meteor\node_modules\meteor-deque\index.js:1:18)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

screen shot 2018-07-04 at 10 01 19 am

The app was basically delayed to launch for 4 minutes due to these errors. This is not an issue when deploying a new app, but a problem for updating existing apps.

@ramijarrar
Copy link
Member

ramijarrar commented Jul 5, 2018

Did you see these errors previously with the single setting deploy? Looks to me like a bundling issue - this can happen if local node_modules is inconsistent (best way to prevent this is by running meteor npm install before each deploy).

Regarding wkhtmltopdf/similar tools - you can manually install/configure most of these with the Kudu console (there are some sandbox restrictions which are described here).

@WayneUong
Copy link
Author

Yes I always run meteor npm install before each deploy. Do I have to deploy from an windows environment? I'm using Mac so there might be a difference in the binary build? This happens for both single and multi servers.

@ramijarrar
Copy link
Member

ramijarrar commented Jul 6, 2018

There shouldn't be any issue building from Mac/Linux.

From what I can tell, the errors are only happening once the server boots up which indicates these are likely reproducible in a local meteor build (and hence outside the scope of support for this tool).

There seems to be some related threads on github (meteor/meteor#8004) and forums (here and here) - can you confirm which version of Meteor you're using and what the command output looks like in debug mode?

I'm also investigating the possibility that this could be happening as a result of cached packages not switching architecture properly - can you confirm if the errors go away when deploying to an empty app service with default architecture?

@ramijarrar
Copy link
Member

@WayneUong Just wondering if you are still seeing these issues / if you had a chance to investigate further? We have started using this across a few production applications in the last few weeks and are probably looking to release officially in the coming days.

@WayneUong
Copy link
Author

@ramijarrar Sorry for the late reply. I just tested this today on a fresh web app, with 64-bit enabled, and deployed with --architecture 64 and I'm still running into this error:

Mon Jul 30 2018 21:42:59 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
Error: Cannot find module 'meteor-deque'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.resolve (internal/module.js:18:19)
    at Object.require (D:\home\site\wwwroot\programs\server\boot.js:288:32)
    at packages\meteor.js:739:32
    at packages\meteor.js:910:4
    at packages\meteor.js:1463:3
    at D:\home\site\wwwroot\programs\server\boot.js:411:36
    at Array.forEach (<anonymous>)
    at D:\home\site\wwwroot\programs\server\boot.js:220:19
    at D:\home\site\wwwroot\programs\server\boot.js:471:5

screen shot 2018-07-30 at 2 47 06 pm

This is for a single app. No scaling or any additional options. We also deployed fine using docker.

@WayneUong
Copy link
Author

It would eventually deploy, but not without restarting a few times due to the above error.

screen shot 2018-07-30 at 2 55 12 pm

@WayneUong
Copy link
Author

So I deployed a bare app with meteor create and the error still appear once before the app is started:

Application has thrown an uncaught exception and is terminated:
Error: Cannot find module 'D:\home\site\wwwroot\programs\server\npm\node_modules\meteor\meteor\node_modules\meteor-deque'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.require (D:\home\site\wwwroot\programs\server\boot.js:284:20)
    at packages\meteor.js:854:32
    at packages\meteor.js:1025:4
    at packages\meteor.js:1578:3
    at D:\home\site\wwwroot\programs\server\boot.js:411:36
    at Array.forEach (<anonymous>)

@ramijarrar
Copy link
Member

ramijarrar commented Jul 30, 2018

I'll see if I can reproduce with a bare meteor create (based on meteor/meteor#8556 it seems like it might be an issue with the local environment)

@ramijarrar
Copy link
Member

Closing - moved to #60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants