tehmaestro
tehmaestro

Reputation: 1060

How to deploy an Ember CLI app to Azure Websites

I'm trying to deploy an ember-cli app to Azure Websites. When deploying to azure, you run a deployment script, which does the following:

 - npm install bower
 - npm install ember-cli
 - bower install
 - npm install
 - ember build

Well, it all seems to go well, until it hits the ember build step. I get an error:

this._handle.open(options.fd)

Error: EINVAL, Invalid argument
      at new Socket (net.js:156:18)
      at process.stdin (node.js:664:19)
      at ..... ember-cli\bin\ember:28:25

Searching around I found this link regardin the same problem with Grunt https://github.com/TryGhost/Ghost/pull/3608 So, how would I disable stdin in Ember CLI? Any way I can do that, or any workaround so I can deploy the app?

I'm trying to make the build process on the webserver, and somehow this doesn't work on Azure. Does anyone have any experience with Azure? Thank you so much!

UPDATE

Please one of the two methods posted below by Felix Rieseberg or Justin Niessner. Thank you to you both for the support and looking into this!

Upvotes: 6

Views: 1236

Answers (2)

Felix Rieseberg
Felix Rieseberg

Reputation: 712

I actually also figured out a way - and since I'm an Open Source guy at Microsoft, I just built a small npm module that takes care of everything. If you want a long explanation, check this out - if you just want the tl;dr version:

$ npm install ember-cli-azure-deploy --save-dev -g $ azure-deploy init

Upvotes: 6

Justin Niessner
Justin Niessner

Reputation: 245429

I'm in the final steps of attempting this myself. I'm not sure how you set your deployment up, but I wanted mine to build the dist folder in the %DEPLOYMENT_SOURCE% folder and then only copy the resulting folder as part of the deploy.

I was struggling with the same issue that you're having until I saw the link that you included in your post. That gave me the crazy idea to use grunt and grunt-shell to call ember build instead of calling it directly from my deploy.cmd.

My Gruntfile.js is exceedingly simple:

module.exports = function(grunt) {
  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
    shell: {
      build: {
        command: 'ember build -prod',
        options: {
          stdout: true,
          stdin: false
        }
      },
      test: {
        command: 'ember test',
        options: {
          stdout: true,
          stdin: false
        }
      }
    }
  });

  grunt.registerTask('default', ['shell:build'])
}

After that, I had a dist folder that could then be copied via the Kudu Sync command to wwwroot. If there's anything else you need to see, just let me know and I'll update my answer.

Update

I finally had a chance to clean things up and add some checks to make sure I'm not installing things that have already been installed. You can view my whole deploy.sh file at:

https://github.com/CrshOverride/EmberTodo/blob/master/deploy.sh

Upvotes: 4

Related Questions