open source MOOC platforms
I will attempt to break down your query as best I can:


MOOC open source that I could install on my servers to provision education: Canvas, Sakai or Moodle, BUT the downside of having these on your own servers are that you have to complete the updates yourself and many institutions do a "fresh install" each Summer during break.  It is worth considering a cloud version (LMS): you can get a Moodle account on Moodlecloud.com or try out canvaslms.com; Depending on your specific use-case, would Google Classroom work as an option?
ready to use CMS (content management system) type of software...  course content management, I used to upload all of my content to the LMS- these days I structure all my notes, exercises, files, presentations etc. into a folder in my DropBox/OneDrive/GoogleDrive.  I can folders of notes as a link in the LMS.  The advantage is that I can:


Add/Remove notes
Update content


all without having to delete old notes/upload new notes.  I can simply manipulate files on my computer which will synch with the online drive- the LMS acts as a repository of links and the content is elsewhere, and more easily managed.


This is a setup I suggested for a company that are planning to introduce an LMS where I also suggested hosting all the links on a thinklink as well- very little is actually in the LMS, but it's used as a repository.  The advantage (imho) is that is allows you to rebuild your course and use resources in other courses more easily, so you can update once in one location, and the "linked resource" is updated wherever it is used:



watch lectures, and interact with TAs.  All LMS allow you to embed videos (better to embed from YouTube or similar rather than upload large videos to your own server) and provide a chat or forum feature.  If the forum-type/chat in the LMS does not suit you, you will find something like Disqus that you can embed into the course.
students could run pieces of code.  This is the trickiest.  I sometimes write tests that the students can download and run to test their own code. It gives them a chance to look at "test code" and if they take the time to figure out what the code is doing, they will learn something.  

It is much more easy to use a MCQ quiz to autograde.  Cloze question types have words missing so this could work in a quiz format.

Another option is to use peer grading and to give each student a rubric to mark peers- often used in many MOOCs and I've done it in Moodle in the past.

Use a site like Rosalind or CoCodingBat for exercises and grading

If you want to write your own specific test conditions, then CodeHS might just give you the features and flexibility that you want.  Because these code graders are not (afaik) integrated into the more popular LMS, you could have the student post a screenshot of their code passing the tests (or not).

If you want something that will return the grade to the LMS gradebook, then there may be something that complies with the (relatively new) Common Cartridge but I am unaware of a tool to meet your requirements at this time.


Hope that this helps answer your question, and that it is of some benefit to you.

Sean.