Deploy to Azure + integration with slingshot for Azure


#1

Hi guys,
is there a standardized way how to deploy to Azure servers already? Also, does anyone have experience with extending the slingshot package to work with Azure servers?


#2

If you can get Linux VM. (Ubuntu).
You can use Meteor Up to deploy that: https://github.com/arunoda/meteor-up

Don’t know they support Docker, If so, you can use MeteorD.

Not sure about Slingshot, may be try to submit an issue on their issue list.


#3

Azure does support Docker containers. Using the Docker VM Extension with the Azure Portal

also: An Azure Marketplace VM for Ubuntu + Docker


#4

Don’t know about slingshot but I have an app on Azure and I couldn’t be happier. Uptime is 100%. I just created an Ubuntu vm and used meteor up to deploy. It does take some trial and error to configure the mup script correctly but once you get it right redeploying is a breeze.


#5

Do you happen to be dealing with image/file uploads to blobs as well? If so, how do you do it? With a package or programmed yourself?


#6

I send images to S3 with a very old package which I haven’t bothered to update. There are many packages that take care of sending files to S3 and also storing them as blobs. I haven’t stored images as blobs so I can’t recommend anything.


#7

@manuel or anyone else, have you implemented multiple meteor servers with azure? This msdn articles seems to indicate server’s support sticky sessions.

Also, if you used meteor cluster or any autoscaling with azure I’d be interested to hear how it went!


#8

I did it just for testing but it was very easy to spin up multiple instances and use Azure’s load balancer. I used Meteor Up to deploy to all servers at once and used a MongoDB service (don’t remember which).


#9

Steps for “meteor build”:
Please use a 32 bit windows install with VC2013. A 64 bit build will fail on the node fibers package, because azure node is executed 32 bit only.

Note: this will not work if you’r using for example the spiderable package which relays on PhantomJS. PhantomJS can not be executed in a webapp on azure?

In your project “meteor build …\buildOut” and extract the file located in “…\buildOut”.
Place/create in “…\buildOut” a “package.json” containing:

{
    "name": "App name",
    "version": "0.0.1",
    "main": "main.js",
    "scripts": {
        "start": "node main.js"
    },
    "engines": {
        "node": "0.12.6"
    }
}

On your favorite shell, goto “…\buildOut\programs\server” and run “npm install”. This will pre download all the requirements an build them.
Now open the file “…\buildOut\programs\server\packages\webapp.js” and search for “process.env.PORT”.
it looks like this:

var localPort = parseInt(process.env.PORT) || 0;

alter this line into this:

var localPort = process.env.PORT || 0;

This is needed so your meteor project can accept a named socket as soon as it runs in node. The function “parseInt” will not let not an string go thru, the named socket is a string located in your webapp’s environment. This my be done for a reason, a warning here! Now save this change an we are almost done…

Solve the bcrypt issue: Download this file and extract it somewhere: https://registry.npmjs.org/bcrypt/-/bcrypt-0.8.4.tgz Extract it.
Now replace the files located: “…\buildOut\programs\server\npm\npm-bcrypt\node_modules\bcrypt*”

with the directory’s and file’s located somewhere: “.\bcrypt-0.8.4\package*”

Now go on the shell in the directory “…\buildOut\programs\server\npm\npm-bcrypt\node_modules\bcrypt” and make sure you remove the “node_modules” directory. If the node_modules directory is not removed npm will not build the package the files in it again for some reason.

Run on the shell “npm install”.

If every thing worked without an error, you can deplay your app to git repository, in a deployment slot off your webapp. Go to “…\buildOut” commit this to deployment slot’s repository. This will course the deploy on the deployment slot.

Make sure you set the “Environment” variables: “MONGO_URL” and “ROOT_URL” in the portal for you webapp.

Now wait a little and your app should fire after some time… Your app should be running and you can access it on the *.azuresites.net

Thanks to all that made this possible.