Create a web app with App Service on Linux – Save yourself hair and time

October 19, 2016, Microsoft announced “Hosting Azure Web Apps on Linux“. Finally I can deploy my Node.js app without running IIS! However, there is one small gotcha that is good to know, unless you want to spend an hour or two troubleshooting… I did, and I just want to share my learning to save you guys some time if you run into the same problem.

Microsoft have a short tutorial on how you set up a web app on Linux, which pretty much covers the basic. My problem was that I could not reach the site after it was set up and deployed. Frustrated, I started troubleshooting and finally resolved it. Here are a few things that I ran into when trying to setup a simple “Hello world”-app in Node.js.

  • Do not use a custom port – it wont work (only port 80 and 443 is accessible).
  • Instead, use process.env.PORT
  • DO NOT use process.env.port – it’s case sensitive!
  • Of course, you can always use classic fallback with process.env.PORT || 1337 (or any given port number).
  • If you begin changing ports: restart the app by pressing “restart” (tools menu under “Overview”). Deployment of a git commit didn’t solve this problem, so just restart the app instead (probably has something to do with caching or similar, e.g needing to do an IIS-reset after manipulating the hosts file in Windows)

So, if you deploy your app but you can’t access it – check your port settings!

 

Myself

My passion is building a product that users love. To make that happen, I strongly believe in agile ways of working, data-driven decisions and a MVP-approach to every problem you are trying to solve.

As developers, we tend to get involved too late in the development process. I want to be there from the beginning, from idea to production. I believe that early involvement leads to high engagement and strong motivation. Those are the core ingredients for any successful team.

I see programming as a true craftsmanship. Code is easy to write but hard to master. Beautiful code is rare. I am pragmatic, detailed but efficient in my work. I favour TDD because it allows me to create a foundation that I continuously can improve. I’m an expert with the .NET-stack but not afraid to try new tools. I love working with performance issues – it’s thrilling! I have worked extensively with frontend during my professional career and can transform ugliness to happiness. I really like the mobile first-approach and responsive web design, even though it can be challenging sometimes.

I also enjoy making our Kanban board a better place to go to every morning 🙂