Recently, I was engaged to build “high-fidelity” prototypes of web applications for a client. Because I knew I would be re-using components, I decided to build a simple framework in Node.js. After several weeks, I had a relatively smart system that allowed for more rapid prototyping, and I was feeling fairly proud of it. Then it came time to provide the client access for usability testing, and I said, “Ok, I’ll work with your DevOps team to get this deployed.”
So naive…
Due to a plethora of constraints, it turned out to be practically impossible to deploy this self-rolled application through any of the channels available within the client’s organization. So, I had to painstakingly figure out how to export the application as a series of HTML files, rewrite the frontend javascript logic to not rely on server state, and adjust all asset references upon each export. This allowed the application to be compressed and passed around as a .zip file, solving the issue of accessing the prototypes on desktop. Mobile was still an issue.
When I discussed this problem with our Node practice lead at our home office, he casually suggested a free service offered by Zeit called Zeit Now. After a brief investigation, I realized this would have saved me days of futility.
From the first paragraph of their website:
[Zeit Now] allows you to take your JavaScript (Node.js) or Docker powered websites, applications, and services to the cloud with ease, speed, and reliability. In practical terms, any directory that contains a package.json or Dockerfile can be transported to the cloud with one command: now.
(In addition to Node.js and Docker, Now also supports static HTML/CSS/JS sites.)
It took all of two minutes to set up Now using their OSS, deploy, and receive a generated URL that allowed me to view a test application in the wild. Their own instructions are simple and straightforward, but I will recap my own process here.
Install the Now CLI:
Deploy:
Seriously, that’s it. I received a randomly generated, publicly available URL, which included the project name at the beginning. I navigated to that URL in all of my browsers on desktop and mobile, and it worked as I expected.
Of course, the application I used to test this had a simple start script and hardly any build process. For more complicated setups, Zeit Now can be configured to run build processes, run in different environments, utilize environment variables, connect to databases, etc. If public availability is an issue, one can acquire a paid subscription that allows for private deployments and aliasing to a predetermined domain. Check out the docs for everything you can do!
If you would like to see a base-level deployment in action, you can check out my über-quick walkthrough demonstrating the use of Zeit Now with an express application.
Before I close, there is one last feature that I believe is worth mentioning here. By default, the URLs generated by deployments are forever (relatively speaking). However, you can use the now rm command to delete any deployment you specify. The docs say to pass an “id” to now rm, which can be retrieved by listing all of your deployments with the now list command. Personally, I did not see any ids listed, but now rm also accepts the unique URL of a deployment.
Zeit Now provides a range of options, from quick single-instance deployments (great for things like usability testing) to multi-instance, scalable, production-level deployments. I am looking forward to future opportunities to work more with this technology on a deeper level, and, perhaps, to share those experiences.
Leave a Reply