Tuesday, December 2, 2014

Diving into Codenvy

Recently I have been getting into Codenvy.  I have really enjoyed getting to know and use the product/service.  Also the company is fantastic - really responsive and helpful support folks.  I am currently on a mission to make Codenvy my standard development environment for my personal projects.  And I also want to see what it could look like for my professional development (which will be impressive).  Here is how I got to this point.

On April 9th of 1999 I stopped using Windows as my primary operating system. The virus that completely took out my Windows system, which I loathed anyway, gave me the kick in the pants I needed to commit to using Linux as my primary operating system which significantly pushed my technical abilities.  I was studying computer engineering and I figured it could only help me.

Fast forward years later into marriage and family life.  Forcing my wife to use Linux on her laptop lasted longer than I expected but her software requirements started to become a real problem in the late 2000's.  I relented and bought her a Windows laptop in 2010 and prayed a blessing over her Windows installation which surprisingly lasted nearly three years.  In 2014 it was replaced with an HP Chromebook. I still noticed myself  often glancing over at her Chromebook... it's sleek body and instant resume... I began to envy such a web-based computing lifestyle.

"But I do serious development work," I gruffly declare in my head, "how could I survive with that!"  Then memories of looking into web-based IDEs a year earlier came back to my mind and I vaguely recalled my opinions of the options out there.  I only remembered that I stopped looking into it at one point.  Then this past July 1st I received an email to take part in the Codenvy 3 early access program.  I received a live demonstration of the new version and soon began using it myself.  For the first time I could finally see a path to having all my development be web-based from anywhere.

I have investigated multiple types of development with Codenvy.  The ones that interest me most are Ruby/Rails, Java, Go, and C++.  But for this article I will focus on two: Rails and C++.  Rails represents a project for my personal interests, and looking into a basic C++ project is the seed for my path to using Codenvy for professional work.

Rails

My wife and I are starting a non-profit organization soon and I am developing the website for it.  The website will need to grow into being a web application for several features we have planned.  I chose Rails because that is the most recent framework that I have extensive experience with.  It's been since 2009 that I have been deep in Rails development.  I was once on top of the Rails game very early on in Rails history and even co-founded a startup called giftsidesire.com (the domain has been taken over) - a social generic wishlist gift registry web application.  I could go on for a long time talking about a failed startup, but I would digress heavily - plenty of great lessons learned.

After that venture I still continued forward with Rails by writing a personal finance web application for myself that managed my complications of heavy business travel.  I always hosted on my own servers but continuous house moves became the death of my servers and my desire to keep maintaining them.

Getting back into Rails in this era is pretty nice - plenty of blogs, forums, github projects, etc to feed from to get the status quo Rails stack up and running.  And I have done that several times across several machines now.  That has been enough to make me think about not having to maintain my own Rails software stack.  The timeline of this thinking happened to coincide with the invitation to join the Codenvy 3 early access program.

Fig 1
With Codenvy3 (currently) the options (Fig 1) for creating a new Rails project will not generate a project for you as Codenvy 2 did - essentially a "rails new" command.  For me this was fine because I had already started the project on my local machine and pushed it to github.  For this situation I chose to use the Import Project feature.  I provide the github URL and the project type.  I am using a private repository on github and Codenvy sets up an SSH key to connect to github.  From there Codenvy creates a new project and pulls from the repository to populate it.  And there is my rails project sitting in Codenvy! (Fig 2)

Fig 2
Throwing caution to the wind I hit Run and to see what happens.  Being new to Docker I found it very fascinating watching the runner log.  First of all, the log is well formed with color coded message tags such a [INFO] [STDERR] [STDOUT] [DOCKER] etc to make it quite clear where the messages are coming from.  When I configured the project's runner on import I chose the ruby210_rails403 runner.  Sure enough I can see Docker starting with "FROM codenvy/ruby210_rails403".  From there it goes on to populate the runner with my project and run bundle to install the needed gems my project requires.  And at the end of the Docker recipe it runs "rails server" for my application.
Fig 3
Once that is running I get a blue Application hyperlink (Fig 4) at the top of my Runner pane which launches a new browser tab to the server/port of the running Rails application.  One more thing we command line lovers will like is that the runner supports a Terminal right next to the log Console (Fig 4).  For many reasons one might want to use this for debug or just navigating around the runner.

Fig 4
One thing I love about Rails development is that you can start the server, make changes to your code and reload the browser to see your changes take place.  It's good to know that is still the case with Codenvy.  When you edit and save files in Codenvy it send the updated files to the runner.  Reload the web application tab and the changes are seen.

Speaking of editing code, I really appreciate the effort to support vi and emacs key bindings for the editors.  I have put in a lot of hours on vim for many years.   My mind and fingers are more in tune with vi bindings.  Plus it is significantly more productive for me.

EDA (C++)

I mentioned that I also want to see how far I can go to use Codenvy for my professional endeavors as well.  My professional life is EDA (Electronic Design Automation) development.  Plainly put, that is developing software that engineers use to build and test ASICs.  But there is nothing plain about it.  It's quite the riveting lifestyle!

I started by looking at what a really basic Codenvy C++ project looks like, what the runner expects, and how to use my own builder/runner.  Then the major task at hand is to put together a Docker image that has the environment I need.  So that means getting together a trimmed down install of the simulator for only SystemC (C++) simulation.  Once I have that I can push it to my Docker Hub account and then use that Docker image from Codenvy in a custom run (Docker recipe) - hopefully not exceeding my resource quotas.

The resource challenges in EDA can grow to be quite extensive.  If you have been in ASIC development for even a little while you know the tools are quite beastly in the resources department.  I have seen full chip simulations needing as much as 64 GB of RAM, not to mention the storage footprint of the tools is quite large.  In addition to these challenges there is also the challenge of licensing, which can be the most difficult to get past in the classic web-based usage of Codenvy.  The license servers are onsite only, not be accessed outside the walls of the company.  But there is a solution for that.  Codenvy also has an onsite option where you can have the web-based IDE be served from inside your network where it can have access to the private license servers and other private resources.  Until I have such luxuries I can test the Docker image by running Docker locally so that I have access to the license servers.  It should be very interesting.  I can see a lot of value in handing over a clone of a Codenvy project to a field engineer who just wants it to work and not have to replicate all the environment settings and tool versions that the given project is dependent on.

So someday soon I can be anywhere with my lean Chromebook, or any web browser, and be working on all kinds of development projects.  As for professional development... that might take a few more hoops, but I can see the path to it and that is a great thing.

Since this is a Command Line blog, I will close with one more feature I really like that Codenvy has implemented.  Command line (CLI) access to Codenvy projects from your local command line.  It mentions Windows and Unix in the getting started section, but since it is implemented in Java I would be surprised if it did not work on Macs as well.  The CLI interface is pretty self explanatory in the screenshot (Fig 5) below.  Basically, you have access to Codenvy workspace and projects.  I tested this out using the "codenvy login" command and then the "codenvy list" command to get the ID of my Rails project.  And finally I used the "codenvy clone-local <id>" to pull the project to my local file system.  It downloaded in a snap.  I ran "rails server" and it came up exactly as I had left it in the web-based Codenvy IDE.
Fig 5

6 comments:

  1. The CLI works great on Mac Stephen, as you'd expect!

    ReplyDelete
  2. Very cool! Thank you for posting that info.

    ReplyDelete
  3. Hi. Nice post. Do you know how to set breakpoints and debug inside codeenvy? Thanks

    ReplyDelete
  4. Great information shared, thanks a lot. Cryptex Technologies is one of the best Ruby on Rails development companies in India. If you are looking for such type of companies email us at: info@cryptextechnologies.com

    ReplyDelete
  5. Have you ever mentioned how to execute the program?

    ReplyDelete
  6. How can I debug Python code in Codenvy or Eclipse Che other than pdb.set_trace()?

    ReplyDelete