Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy to Azure button #124

Merged
merged 2 commits into from
Jan 6, 2016
Merged

Deploy to Azure button #124

merged 2 commits into from
Jan 6, 2016

Conversation

jpoon
Copy link
Contributor

@jpoon 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

@@ -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",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.3.6 addressed a build issue on Windows.

@rauchg
Copy link
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
Copy link
Contributor Author

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
Copy link
Owner

rauchg commented Nov 30, 2015

Standard_A0 sized VM (smallest/cheapest option)

Is there a free tier like Heroku?

@jpoon
Copy link
Contributor Author

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
Copy link
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
Copy link
Contributor Author

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
Copy link
Owner

rauchg commented Nov 30, 2015

Totally down for ditching make

@jpoon
Copy link
Contributor Author

jpoon commented Dec 1, 2015

👍 I'll update the PR (hopefully over the weekend)

@jpoon jpoon closed this Dec 7, 2015
@jpoon
Copy link
Contributor Author

jpoon commented Dec 7, 2015

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

@jpoon jpoon reopened this Dec 8, 2015
@jpoon
Copy link
Contributor Author

jpoon commented Dec 8, 2015

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

  • - Replace Make with Gulp
  • - Upgrade to Babel6 (Upgrade babel #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
Copy link
Owner

rauchg commented Dec 9, 2015

wow

@rauchg
Copy link
Owner

rauchg commented Dec 9, 2015

Provide option to deploy a stable release

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

@jpoon
Copy link
Contributor Author

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
Copy link
Owner

rauchg commented Dec 11, 2015

It was an amazing wow

@rauchg
Copy link
Owner

rauchg commented Dec 14, 2015

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

@jpoon
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Owner

rauchg commented Dec 16, 2015

Super awesome work.

});

gulp.task('clean', function() {
return gulp.src(paths.out_js, { read: false })
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@jpoon
Copy link
Contributor Author

jpoon commented Dec 16, 2015

Addressed comments and squashed commits.

@rauchg
Copy link
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
Copy link
Contributor Author

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.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just write gulp here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL. Fixed.

.pipe(rimraf());
});

gulp.task('default', ['es6to5', 'copyassets']);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@rauchg
Copy link
Owner

rauchg commented Dec 16, 2015

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

@rauchg
Copy link
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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Owner

rauchg commented Jan 5, 2016

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

@jpoon
Copy link
Contributor Author

jpoon commented Jan 6, 2016

@rauchg done! Also:

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

* 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']);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants