How do I deploy a node.js app to azure if it contains private npm modules

290 views Asked by At

I have an app that uses several private npm modules, internal to the company. I can't make these modules public and I can't just copy the code in my own repo.

I'm trying to deploy the app to an Azure web site, but the problem is all tutorials I've found are about using git, and using FTP to upload is really slow (~60Mb app takes ~3 hours).

Is there another method that I'm missing that works reasonably fast (minutes) and can deploy the private modules? I'm specifically interested in doing that on an azure web site, not a VM or some other work-around.

1

There are 1 answers

0
taminov On

Check out this article, it shows a few approaches to your problem:

Dedicated user with pull permission

This is the simplest workaround by introducing a new dedicated user with pull permission to all related private repositories (main and submodules) required for deploying to Windows Azure and set an appropriate SSH key pair to this user and Windows Azure. There are two ways to achieve this depending on whether your main repository is public or private.

If the main repository is private, the private SSH key is already set to Windows Azure and you will only need to deal with public key part. Simply copy the deployment key (with name prefixed with Windows Azure ) and paste to this user as user key. Because GitHub only allows one unique key, you will have to copy, delete the deployment key and paste as a user key.

If the main repository is public, Windows Azure will not generate nor set any SSH key pair. In this case, you will have to generate the key pair manually (ssh-keygen). The public part (id_rsa.pub) should be set as user key of the dedicated user above. Upload the private key (id_rsa) part to Windows Azure (you may follow Giving the private key to the Kudu service instruction).

This is simplest and recommended way.