Deploy to Azure button #124

Merged
merged 2 commits into from Jan 6, 2016

Conversation

Projects
None yet
2 participants
@jpoon
Contributor

jpoon commented Nov 25, 2015

What it looks like (feel free to click the button below, it works 馃帀 ):

Deploy to Azure

Uses ARM template to create a Standard_A0 sized VM (smallest/cheapest option). Upon startup, the VM will install Docker and run the slackin image. The slackin server will be reachable at {whatever-you-configured-as-your-dns-in-the-setup}.westus.cloudapp.azure.com.

Re: #96

@jpoon

View changes

package.json
@@ -11,7 +11,7 @@
"express": "4.11.0",
"hostenv": "1.0.1",
"opentype.js": "0.4.4",
- "socket.io": "1.3.5",
+ "socket.io": "1.3.6",

This comment has been minimized.

@jpoon

jpoon Nov 25, 2015

Contributor

1.3.6 addressed a build issue on Windows.

@jpoon

jpoon Nov 25, 2015

Contributor

1.3.6 addressed a build issue on Windows.

@jpoon jpoon referenced this pull request in VSCodeVim/Vim Nov 25, 2015

Merged

Add Slackin to Readme #31

@rauchg

This comment has been minimized.

Show comment
Hide comment
@rauchg

rauchg Nov 30, 2015

Owner

Pushed 0.7.3 bumping socket.io. Is there a way to fix the Azure button to that tag?

Owner

rauchg commented Nov 30, 2015

Pushed 0.7.3 bumping socket.io. Is there a way to fix the Azure button to that tag?

@jpoon

This comment has been minimized.

Show comment
Hide comment
@jpoon

jpoon Nov 30, 2015

Contributor

Rather than fixing it to a particular tag, the button will deploy the latest version that is available on npm (which is 0.7.3 right now).

Contributor

jpoon commented Nov 30, 2015

Rather than fixing it to a particular tag, the button will deploy the latest version that is available on npm (which is 0.7.3 right now).

@rauchg

This comment has been minimized.

Show comment
Hide comment
@rauchg

rauchg Nov 30, 2015

Owner

Standard_A0 sized VM (smallest/cheapest option)

Is there a free tier like Heroku?

Owner

rauchg commented Nov 30, 2015

Standard_A0 sized VM (smallest/cheapest option)

Is there a free tier like Heroku?

@jpoon

This comment has been minimized.

Show comment
Hide comment
@jpoon

jpoon Nov 30, 2015

Contributor

There is a free tier for web apps (PaaS). However, as slackin uses native node modules, we are forced to use virtual machines which does not have a free tier. New Azure signups have $200 credit which would pay for running a slackin instance deployed through this button for about 16 months.

Contributor

jpoon commented Nov 30, 2015

There is a free tier for web apps (PaaS). However, as slackin uses native node modules, we are forced to use virtual machines which does not have a free tier. New Azure signups have $200 credit which would pay for running a slackin instance deployed through this button for about 16 months.

@rauchg

This comment has been minimized.

Show comment
Hide comment
@rauchg

rauchg Nov 30, 2015

Owner

as slackin uses native node modules

We don't depend on them. Any way to force the free tier?

Owner

rauchg commented Nov 30, 2015

as slackin uses native node modules

We don't depend on them. Any way to force the free tier?

@jpoon

This comment has been minimized.

Show comment
Hide comment
@jpoon

jpoon Nov 30, 2015

Contributor

Looks like I'm mistaken. Web apps run node-gyp just fine. However, I think we'll need to tinker with the build as Windows doesn't come preinstalled with gnu make. So either we download/install gnu make on the web app (not even sure if the sandbox will allow me to execute a random exe) or replace the makefile with gulp + babel.

What do you think? Is there a reason why we are using make?

Contributor

jpoon commented Nov 30, 2015

Looks like I'm mistaken. Web apps run node-gyp just fine. However, I think we'll need to tinker with the build as Windows doesn't come preinstalled with gnu make. So either we download/install gnu make on the web app (not even sure if the sandbox will allow me to execute a random exe) or replace the makefile with gulp + babel.

What do you think? Is there a reason why we are using make?

@rauchg

This comment has been minimized.

Show comment
Hide comment
@rauchg

rauchg Nov 30, 2015

Owner

Totally down for ditching make

Owner

rauchg commented Nov 30, 2015

Totally down for ditching make

@jpoon

This comment has been minimized.

Show comment
Hide comment
@jpoon

jpoon Dec 1, 2015

Contributor

馃憤 I'll update the PR (hopefully over the weekend)

Contributor

jpoon commented Dec 1, 2015

馃憤 I'll update the PR (hopefully over the weekend)

@jpoon jpoon closed this Dec 7, 2015

@jpoon

This comment has been minimized.

Show comment
Hide comment
@jpoon

jpoon Dec 7, 2015

Contributor

Will re-open PR with new changes in a bit.

Contributor

jpoon commented Dec 7, 2015

Will re-open PR with new changes in a bit.

@jpoon jpoon reopened this Dec 8, 2015

@jpoon

This comment has been minimized.

Show comment
Hide comment
@jpoon

jpoon Dec 8, 2015

Contributor

Here's what it looks like so far with the following implemented:

  • - Replace Make with Gulp
  • - Upgrade to Babel6 (#122)
  • - Add Deploy to Azure button to readme which deploys master branch to an Azure Web App (on the Free Tier)
  • - Provide option to deploy a stable release
Contributor

jpoon commented Dec 8, 2015

Here's what it looks like so far with the following implemented:

  • - Replace Make with Gulp
  • - Upgrade to Babel6 (#122)
  • - Add Deploy to Azure button to readme which deploys master branch to an Azure Web App (on the Free Tier)
  • - Provide option to deploy a stable release
@rauchg

This comment has been minimized.

Show comment
Hide comment
@rauchg

rauchg Dec 9, 2015

Owner

wow

Owner

rauchg commented Dec 9, 2015

wow

@rauchg

This comment has been minimized.

Show comment
Hide comment
@rauchg

rauchg Dec 9, 2015

Owner

Provide option to deploy a stable release

this would be awesome. I love reproducible and predictable builds.

Owner

rauchg commented Dec 9, 2015

Provide option to deploy a stable release

this would be awesome. I love reproducible and predictable builds.

@jpoon

This comment has been minimized.

Show comment
Hide comment
@jpoon

jpoon Dec 11, 2015

Contributor

I hope that's a good wow 馃槒
Been slammed at work. Will get around to finishing this off soon.

Contributor

jpoon commented Dec 11, 2015

I hope that's a good wow 馃槒
Been slammed at work. Will get around to finishing this off soon.

@rauchg

This comment has been minimized.

Show comment
Hide comment
@rauchg

rauchg Dec 11, 2015

Owner

It was an amazing wow

Owner

rauchg commented Dec 11, 2015

It was an amazing wow

@rauchg

This comment has been minimized.

Show comment
Hide comment
@rauchg

rauchg Dec 14, 2015

Owner

@jpoon can we also get a retina button (SVG)? The button above looks blurry

Owner

rauchg commented Dec 14, 2015

@jpoon can we also get a retina button (SVG)? The button above looks blurry

@jpoon

This comment has been minimized.

Show comment
Hide comment
@jpoon

jpoon Dec 14, 2015

Contributor

They don't seem to have one at the moment: projectkudu/slingshot#28. 馃槥. In the meantime, as suggested by the bug, we can use a shields.io one.

Contributor

jpoon commented Dec 14, 2015

They don't seem to have one at the moment: projectkudu/slingshot#28. 馃槥. In the meantime, as suggested by the bug, we can use a shields.io one.

@jpoon

This comment has been minimized.

Show comment
Hide comment
@jpoon

jpoon Dec 16, 2015

Contributor

馃帀 All done.

If you press the deploy button, it'll bring you to this screen:

image

You can choose what Slackin Release you want:

  • Stable = deploys latest published slackin npm package
  • Latest = will deploy whatever is in the git repo (e.g. latest code)

After going through the deployment wizard, it'll bring you to this screen:

image

I manually verified that both stable and latest work. Having deployed our VsCodeVim slackin instance via the Azure button. 馃槃

Sidenote: As stable installs slacking through npm, we'll need to update the npm package with the gulp/babel build in order for it to work on Windows/Azure. For testing, I had published my own gulpified-slackin version.

Contributor

jpoon commented Dec 16, 2015

馃帀 All done.

If you press the deploy button, it'll bring you to this screen:

image

You can choose what Slackin Release you want:

  • Stable = deploys latest published slackin npm package
  • Latest = will deploy whatever is in the git repo (e.g. latest code)

After going through the deployment wizard, it'll bring you to this screen:

image

I manually verified that both stable and latest work. Having deployed our VsCodeVim slackin instance via the Azure button. 馃槃

Sidenote: As stable installs slacking through npm, we'll need to update the npm package with the gulp/babel build in order for it to work on Windows/Azure. For testing, I had published my own gulpified-slackin version.

@rauchg

This comment has been minimized.

Show comment
Hide comment
@rauchg

rauchg Dec 16, 2015

Owner

Super awesome work.

Owner

rauchg commented Dec 16, 2015

Super awesome work.

@rauchg

View changes

gulpfile.js
+});
+
+gulp.task('clean', function() {
+ return gulp.src(paths.out_js, { read: false })

This comment has been minimized.

@rauchg

rauchg Dec 16, 2015

Owner

The indentation doesn't seem to match the project's?

@rauchg

rauchg Dec 16, 2015

Owner

The indentation doesn't seem to match the project's?

This comment has been minimized.

@jpoon

jpoon Dec 16, 2015

Contributor

Fixed.

@jpoon

jpoon Dec 16, 2015

Contributor

Fixed.

@rauchg

View changes

package.json
- "babel": "4.7.1",
+ "babel-core": "^6.3.15",
+ "babel-preset-es2015": "^6.3.13",
+ "babel-polyfill": "^6.3.14",

This comment has been minimized.

@rauchg

rauchg Dec 16, 2015

Owner

We pin dependencies

@rauchg

rauchg Dec 16, 2015

Owner

We pin dependencies

This comment has been minimized.

@jpoon

jpoon Dec 16, 2015

Contributor

Pinned.

@jpoon

jpoon Dec 16, 2015

Contributor

Pinned.

@jpoon

This comment has been minimized.

Show comment
Hide comment
@jpoon

jpoon Dec 16, 2015

Contributor

Addressed comments and squashed commits.

Contributor

jpoon commented Dec 16, 2015

Addressed comments and squashed commits.

@rauchg

This comment has been minimized.

Show comment
Hide comment
@rauchg

rauchg Dec 16, 2015

Owner

My only oustanding concern is how many files we have now for cloud deployment in source control. After this deploy we'll end up with:

  • app.json
  • Procfile
  • Dockerfile
  • azuredeploy.json
  • .deployment
  • deploy.sh
  • web.config

in order to support Docker, Heroku and Azure.

Owner

rauchg commented Dec 16, 2015

My only oustanding concern is how many files we have now for cloud deployment in source control. After this deploy we'll end up with:

  • app.json
  • Procfile
  • Dockerfile
  • azuredeploy.json
  • .deployment
  • deploy.sh
  • web.config

in order to support Docker, Heroku and Azure.

@jpoon

This comment has been minimized.

Show comment
Hide comment
@jpoon

jpoon Dec 16, 2015

Contributor

For each cloud provider, you'd need to define a minimum set of deploy/setup logic regardless. In the case of Azure, I did my best in limiting the amount of files that I need to touch.

Edit: Actually, I might be able to eliminate one file. Testing out my theory. Will update in a sec.

Contributor

jpoon commented Dec 16, 2015

For each cloud provider, you'd need to define a minimum set of deploy/setup logic regardless. In the case of Azure, I did my best in limiting the amount of files that I need to touch.

Edit: Actually, I might be able to eliminate one file. Testing out my theory. Will update in a sec.

@rauchg

View changes

package.json
@@ -29,7 +34,7 @@
},
"scripts": {
"test": "mocha",
- "postinstall": "make",
- "start": "./bin/slackin $SLACK_SUBDOMAIN $SLACK_API_TOKEN"
+ "postinstall": "./node_modules/.bin/gulp",

This comment has been minimized.

@rauchg

rauchg Dec 16, 2015

Owner

I think you can just write gulp here.

@rauchg

rauchg Dec 16, 2015

Owner

I think you can just write gulp here.

This comment has been minimized.

@jpoon

jpoon Dec 16, 2015

Contributor

That assumes it is installed globally which may not be the case.

@jpoon

jpoon Dec 16, 2015

Contributor

That assumes it is installed globally which may not be the case.

This comment has been minimized.

@rauchg

rauchg Dec 17, 2015

Owner

I thought NPM aliased the local binaries as globals for the script declarations?

@rauchg

rauchg Dec 17, 2015

Owner

I thought NPM aliased the local binaries as globals for the script declarations?

This comment has been minimized.

@jpoon

jpoon Dec 17, 2015

Contributor

TIL. Fixed.

@jpoon

jpoon Dec 17, 2015

Contributor

TIL. Fixed.

@rauchg

View changes

package.json
- "postinstall": "make",
- "start": "./bin/slackin $SLACK_SUBDOMAIN $SLACK_API_TOKEN"
+ "postinstall": "./node_modules/.bin/gulp",
+ "start": "node ./bin/slackin"

This comment has been minimized.

@rauchg

rauchg Dec 16, 2015

Owner

Isn't this a breaking change?

@rauchg

rauchg Dec 16, 2015

Owner

Isn't this a breaking change?

This comment has been minimized.

@jpoon

jpoon Dec 16, 2015

Contributor

I moved this to inside slackin to make it more cross-platform:

var org = program.args[0] || process.env.SLACK_SUBDOMAIN;
var token = program.args[1] || process.env.SLACK_API_TOKEN;

as there are different ways of getting env variables depending on the shell (ie. windows would be %SLACK_SUBDOMAIN%)

@jpoon

jpoon Dec 16, 2015

Contributor

I moved this to inside slackin to make it more cross-platform:

var org = program.args[0] || process.env.SLACK_SUBDOMAIN;
var token = program.args[1] || process.env.SLACK_API_TOKEN;

as there are different ways of getting env variables depending on the shell (ie. windows would be %SLACK_SUBDOMAIN%)

This comment has been minimized.

@rauchg

rauchg Dec 17, 2015

Owner

Awesome.

@rauchg

rauchg Dec 17, 2015

Owner

Awesome.

@rauchg

View changes

gulpfile.js
+ .pipe(rimraf());
+});
+
+gulp.task('default', ['es6to5', 'copyassets']);

This comment has been minimized.

@rauchg

rauchg Dec 16, 2015

Owner

The rest of the repo uses ES6. Sticks out a bit

@rauchg

rauchg Dec 16, 2015

Owner

The rest of the repo uses ES6. Sticks out a bit

This comment has been minimized.

@jpoon

jpoon Dec 17, 2015

Contributor

Needed to add a .babelrc but this is now es6.

@jpoon

jpoon Dec 17, 2015

Contributor

Needed to add a .babelrc but this is now es6.

@rauchg

This comment has been minimized.

Show comment
Hide comment
@rauchg

rauchg Dec 16, 2015

Owner

@jpoon some more comments. Sorry about the extensive review.

Owner

rauchg commented Dec 16, 2015

@jpoon some more comments. Sorry about the extensive review.

@rauchg

This comment has been minimized.

Show comment
Hide comment
@rauchg

rauchg Dec 16, 2015

Owner

re: my comment about the number of files. I was simultaneously ranting about the inherent tradeoff between supporting many cloud providers out-of-the-box and the cleanliness of the project root.

Things like deploy.sh concern me slightly because it's not clear whether it works for deploying anywhere or just for Azure. To the uninitiated, it might raise the question: why is it not npm install && np start? what's deploy.sh?

The fewer the files and the more succinct they are, the better for the project.

Owner

rauchg commented Dec 16, 2015

re: my comment about the number of files. I was simultaneously ranting about the inherent tradeoff between supporting many cloud providers out-of-the-box and the cleanliness of the project root.

Things like deploy.sh concern me slightly because it's not clear whether it works for deploying anywhere or just for Azure. To the uninitiated, it might raise the question: why is it not npm install && np start? what's deploy.sh?

The fewer the files and the more succinct they are, the better for the project.

@jpoon

This comment has been minimized.

Show comment
Hide comment
@jpoon

jpoon Dec 17, 2015

Contributor

Removed .deployment and renamed some stuff to make it a bit more obvious:

  • azuredeploy.json: used for the wizard to prompt user for their slack/slackin settings
  • azuredeploy.sh: needed in order to deploy stable. if we wanted to always deploy latest git repo, we can get rid of this.
  • web.config: azure by default looks for app.js or index.js as a startup file. Telling Azure that it's actually bin\slackin in web.config.

Re: Rant

Yeah, I feel ya... not sure what can be done though.

Contributor

jpoon commented Dec 17, 2015

Removed .deployment and renamed some stuff to make it a bit more obvious:

  • azuredeploy.json: used for the wizard to prompt user for their slack/slackin settings
  • azuredeploy.sh: needed in order to deploy stable. if we wanted to always deploy latest git repo, we can get rid of this.
  • web.config: azure by default looks for app.js or index.js as a startup file. Telling Azure that it's actually bin\slackin in web.config.

Re: Rant

Yeah, I feel ya... not sure what can be done though.

@jpoon

This comment has been minimized.

Show comment
Hide comment
@jpoon

jpoon Jan 5, 2016

Contributor

@rauchg anything else to address to get this merged?

To clean up the root path, we could create a deployment folder and put:

  • Dockerfile
  • azureDeploy.sh

Everything else (incl. Heroku Procfile) still needs to be in the root.

Contributor

jpoon commented Jan 5, 2016

@rauchg anything else to address to get this merged?

To clean up the root path, we could create a deployment folder and put:

  • Dockerfile
  • azureDeploy.sh

Everything else (incl. Heroku Procfile) still needs to be in the root.

@rauchg

This comment has been minimized.

Show comment
Hide comment
@rauchg

rauchg Jan 5, 2016

Owner

Maybe azureDeploy.sh goes into scripts/? Dockerfile in root is fine. Thanks!

Owner

rauchg commented Jan 5, 2016

Maybe azureDeploy.sh goes into scripts/? Dockerfile in root is fine. Thanks!

@jpoon

This comment has been minimized.

Show comment
Hide comment
@jpoon

jpoon Jan 6, 2016

Contributor

@rauchg done! Also:

  • fixed some babel error/warnings
  • updated readme to run gulp instead of make
Contributor

jpoon commented Jan 6, 2016

@rauchg done! Also:

  • fixed some babel error/warnings
  • updated readme to run gulp instead of make
Deploy to Azure Button
* Uses ARM template to create a Web App (Free Tier)
* When deploying, choose between `Latest` (deploys code from git repo) or
`Stable` (deploy from latest published npm package).
* Server will be accessible at `<sitename>.azurewebsites.net`
+ .pipe(rimraf());
+});
+
+gulp.task('default', ['es6to5', 'copyassets']);

This comment has been minimized.

@rauchg

rauchg Jan 6, 2016

Owner

this is great, thank you!

@rauchg

rauchg Jan 6, 2016

Owner

this is great, thank you!

rauchg added a commit that referenced this pull request Jan 6, 2016

@rauchg rauchg merged commit 90863ac into rauchg:master Jan 6, 2016

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