Freigeben über


Meteor 1.2 app on Azure Web Apps (OS X)

Refer Below link for running Meteor 1.4 App on Azure App Services

https://blogs.msdn.microsoft.com/azureossds/2016/08/24/meteor-1-4-on-azure-app-services/

 

Meteor is a full-stack JavaScript platform for developing modern web and mobile applications. Meteor includes a key set of technologies for building connected-client reactive applications, a build tool, and a curated set of packages from the Nodejs and general JavaScript community.

Support for Meteor on Azure WebApps has been a big ask. This Blog would help you create a sample meteor app in local environment and later we would help you move sample app to Azure Web Apps - https://feedback.azure.com/forums/169385-web-apps-formerly-websites/suggestions/6848937-add-support-for-meteor-on-azure-websites

Below steps are valid for MAC OS X. If you have windows OS, please refer https://github.com/christopheranderson/azure-demeteorizer

Azure by default doesn't support meteor but we can convert your meteor app into Nodejs level using demeteorizer https://github.com/onmodulus/demeteorizer .

Creating Sample Meteor App:

  • Use Below command to install meteor on local environment
 > curl https://install.meteor.com/ | sh
  • Use Below command to create a sample meteor app
 > meteor create simple-todos

1

  • Above command would create a new folder with few files for our sample app as in below screenshot

2

  • Now check if you have node v0.10.40 using below cmd. You can't use latest version of nodejs for this process
 > node -v

3

 

Why i can't use latest version of Nodejs ?

  • Meteor has a dependency on fibers module which cant be installed with newer version of nodejs

issue tracker : https://github.com/laverdet/node-fibers/issues/248 fibers@1.0.5 install /Users/prashanth/workspace/meterosample/simple-todos/.demeteorized/bundle/programs/server/node_modules/fibers > node ./build.js (node) child_process: options.customFds option is deprecated. Use options.stdio instead. CXX(target) Release/obj.target/fibers/src/fibers.o ../src/fibers.cc:132:44: error: too many arguments to function call, expected at most 2, have 4 return Signature::New(isolate, receiver, argc, argv); ~~~~~~~~~~~~~~ ^~~~~~~~~~ /Users/prashanth/.node-gyp/4.1.2/include/node/v8.h:4675:3: note: 'New' declared here static Local New( ^ ../src/fibers.cc:140:3: error: no member named 'SetResourceConstraints' in namespace 'v8'; did you mean simply 'SetResourceConstraints'? v8::SetResourceConstraints(isolate, constraints);

 

How to change my existing Nodejs version ?

  • Use Below command to install nvm(node version manager) on local environment. This would help us change nodejs version easily
 > curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash

NVM - https://github.com/creationix/nvm

  • Use Below command to install node v0.10.40
 > nvm install 0.10.40
  • Check your nodejs version again using below cmd
 > node -v

 

Using Demeteorizer to convert app into node.js format

  • Use below cmd to install Demeteorizer
 npm install -g demeteorizer
  • Navigate to your meteor app root folder and enter below cmd
 > demeteorizer

5

  • Navigate to .demeteorized/bundle/programs/server using below cmd
 > cd .demeteorized/bundle/programs/server
  • Enter below cmd to install all the required node.js modules
 > npm install

 

Running App on Local Env

- Use below cmd to execute demeteorized/converted nodejs app in local environment

 > PORT=8080 ROOT_URL=https://localhost:8080 npm start

6

 

Moving App to Azure

  • Create a sample web app on azure and Setup continuous deployment and get the git url. Below link has details on it

https://azure.microsoft.com/en-us/documentation/articles/web-sites-nodejs-develop-deploy-mac/

  • Add ROOT_URL with value as your web app url(ex: https://Your_APP_Name.azurewebsites.net/) and set WEBSITE_NODE_DEFAULT_VERSION to 0.10.40 as in below screenshot inside Azure portal App Settings

7

  • Create a web.config file @ .demeteorized/bundle/  folder and insert below link content

https://raw.githubusercontent.com/christopheranderson/azure-demeteorizer/master/resources/web.config 9

  • Navigate to .demeteorized/bundle/  folder and Commit your changes to web app git url
 > git init
> git add .
> git commit -m "initial commit"
> git remote add samplemeteorapp WEB_APP_GIT_URL
> git push samplemeteorapp master
  • Navigate to your azure web app

8

 

Troubleshoot :

1) Unaught exception: Error: `D:\home\site\wwwroot\programs\server\node_modules\fibers\bin\win32-ia32-v8-4.5\fibers.node` is missing. Try reinstalling `node-fibers`?

  • Check if you are using node v0.10.40 on azure web apps
  • Default node.exe on azure webapps are 32-bit. check if there is  bin\win32-ia32-v8-4.5\ in fibers module

2) Unaught exception: Error: Must pass options.rootUrl or set ROOT_URL in the server environment

  • You need to define ROOT_URL in App Settings at Azure Portal (ex: https://Your_APP_Name.azurewebsites.net/)

Comments

  • Anonymous
    February 11, 2016
    very helpful overview of the options and steps to deploy meteor onto azure. There are a lot of minor things that must all be handled precisely...down to the node architecture version (32 instead of 64) so it is good to have it all in one place.Microsoft really needs to formally invest committed resources into getting support for Meteor on Azure streamlined though (if you look around, some employees have voluntarily started in their own time...those efforts should be supported more formally if the interest is to survive.) Azure has one of the best seamless/quick deployment experiences for some web tech (like MVC), but supporting a seamless & quick development framework like Meteor natively would probably bring a lot of converts....until then it is hard to take Azure seriously as a production hosting platform for node-based frameworks
  • Anonymous
    February 17, 2016
    Hi!This might usefull for others... https://github.com/christopheranderson/azure-demeteorizer
  • Anonymous
    April 24, 2016
    The comment has been removed
    • Anonymous
      May 05, 2016
      Thanks for the feedback.looking at the error message looks like 260 char limit error. I will try a deployment with newer version of meteor and update this blog soon.
  • Anonymous
    April 28, 2016
    Would this deploy method also work if using a mongoDB ?
    • Anonymous
      May 05, 2016
      I haven't tried that but It should work. we have converted a meteor application to nodejs level using demeteorizer.
  • Anonymous
    May 17, 2016
    This all azure thing s a nightmare1. WEBSITE_NODE_DEFAULT_VERSION is ignored (i passed 0.10.41 and it's still 0.10.28 :| )2. as Ashish said filenames are too long - so don't even think azure is good for meteor3. I spent 3h flattening npm/node_modules, it said it's deployed but visiting app url shows 403 :|4. Nothing in logs5. Seriously - I'm wasting whole day installing meteor on azure while installing it on any linux system take me 15 minutes - come on!
    • Anonymous
      May 17, 2016
    1. WEBSITE_NODE_DEFAULT_VERSION is ignored (i passed 0.10.41 and it’s still 0.10.28 :| ) - This is because there is no 0.10.41 in azure installed. check below link on how to find installed nodejs versionshttps://blogs.msdn.microsoft.com/azureossds/2016/04/20/nodejs-and-npm-versions-on-azure-app-services/2. as Ashish said filenames are too long – so don’t even think azure is good for meteor - This has been resolved in npm>33. I spent 3h flattening npm/node_modules, it said it’s deployed but visiting app url shows 403 :|- Feel free to open a service request/ send me an email with details @ prmadi@microsoft.com. I would be happy to help you resolve issue.4. Nothing in logs- check below link on how to debug nodejs app in azurehttps://blogs.msdn.microsoft.com/azureossds/2015/08/19/debug-node-js-web-apps-on-azure/ Let me know if you need more help :)
      • Anonymous
        May 19, 2016
        Thanks for reply - after twenty exhausting hours I managed to run it ...1. I hate silent fails - it was misleading. I managed to set proper version with bin/node.exe and iisnode.yml. One thing still bothers me - if I set node version with WEBSITE_NODE_DEFAULT_VERSION to any supported by Azure it's used for app, and in Kodi CMD console. But when I use my custom node version from bin/node.exe app runs with custom node, but in console I still have 0.10.282. Npm 3 wont make the difference because meteor uses it's own npm 2 to build its dependencies - it's the programs/server/npm/node_modules build by meteor build tool makes the problem not programs/server/node_modules which is built with my npm. I found too long path names with dir \s \b | sort /+261 > out.txt which showed me too long path names. Also I had to remove node_modules from .gitignore and upload whole node_modules directory to azure (after I manually move dependencies upper to programs\server\npm\node_modules). git add . also shows which paths are too long. In my case it was 5-10 dependencies that needed to be moved upper3. 403 was my mistake, as demeteorier replaces whole bundle folder (which had web.config) and after flattening node_modules I didn't noticed web.config is missing.One note here. It's awful that when you do demeteorizer -> go to bundle > git add . -> git commit -> git push. For the first time it's ok. But later when azure git repo isnt' empty you have to do git push azure master --force to replace all. And remember all things with custom node version, iisnode.yml, and web.config, and flattening node_modules.
        • Anonymous
          May 19, 2016
          Good to hear that your issue is resolved. :)
          • Anonymous
            July 08, 2016
            The comment has been removed
            • Anonymous
              July 08, 2016
              Hi Darren, are you running demeteorizer on mac or windows laptop?
          • Anonymous
            August 22, 2016
            Meteor released 1.4 which uses npm 3 for internal purpose so it shouldn't be an issue any more
  • Anonymous
    June 26, 2016
    I get this error running demeteorizer:/Users/philipp/.nvm/v0.10.40/lib/node_modules/demeteorizer/node_modules/hoek/lib/index.js:5const Crypto = require('crypto');^^^^^SyntaxError: Use of const in strict mode.I can only run it with a higher node version (6.2.2) but then I get the fibers error when I try to start the app.Would be great if someone can help me how to fix this? :)
    • Anonymous
      June 28, 2016
      can you manually edit const to var instead. Check if that helps. If possible send me repro scenario to prmadi@microsoft.com.