Just wanted to say thanks for building it, and keep up the great work!
And then some more general questions - Can I hook a CI into the deploy loop? (Maybe that doesn't quite make sense given the model is something like Jupyter notebook meets Glitch.) Also, is there a repo being managed behind the scenes like GitHub does in Gist, and if so, any plans to open access to those?
A bit of context: for every language/environment we have a Dockerfile (naturally) and a JSON configuration that describe how it runs, how it install packages, how it runs unit tests, how it formats code, etc. When we build the container we insert a program that we call pid1, it's the container's interface to the rest of the world.
The container manager creates pools of these containers with some rudimentary predictive logic to make sure we have enough containers to deliver on our promise of "loads in 2 seconds". When we take a container out of the pool, if we're reviving a container, we mount a GCS-backed fuse filesystem with the user code (it needs to be backed by GCS to handle persistence, say you're writing to a log file, it should be there next time you load your project). We then send the relevant setup command to pid1 (either init, or wakeup) which sets up the repl to start the user app, the repl, or what have you.
> What actually happens behind the scenes to make a deploy go live
We poll the container for published ports and the moment we see an open port we add a record to an etcd which stores the routing state. We then send a command to the client that we published a port, which will react by opening an iframe. Then the iframe or any request to the published url will hit our outer reverse proxy which will query etcd to find the container and if the container is alive we will send the traffic to the relevant container manager which has another reverse proxy which sends the traffic to the container.
If the container however is dead (from idling or because of an error) we revive via picking a container out of one the pools and going through the initialization phase described above.
Finally, we also host our own docker image registery so that we can push new images, whether new languages, new versions or what have you.
There is a lot more to talk about here so I or someone on the team will write a post soon.
0. No docs. There's plenty of odd and unexplained behavior that needs documenting - at least until stuff is less broken.
1. Can't eval single forms from editor. Whole files only.
2. Can't eval anything from files other than main.
3. Lots of delays and hangs. Very slow. Every eval takes multiple seconds. Some repl starts take 30 seconds.
4. Weird inconsistent behavior. Sometimes it will render function return values from editor eval to the repl, sometimes not.
5. Once you drop a new file, stuff breaks in strange ways. E.g. main.clj no longer seems connected to the user namespace.
6. Can't load other files, (load "other.clj") doesn't find it.
I could go on, but it's currently a mess from my perspective. I swear it used to work pretty well and now it's super broken. Any way I can log these issues and get them worked on?To address your points but please feel free to add this to our feedback board too.
>0. No docs. There's plenty of odd and unexplained behavior that needs documenting - at least until stuff is less broken.
This is definitely an area we need to fix but to your other comment there shouldn't be any unexplained behavior. If there is it's a bug. Please report it here: https://repl.it/bugs
>1. Can't eval single forms from editor. Whole files only.
Meaning you want to highlight code and eval it? That's something we've seen requested before and would love to implement.
> 2. Can't eval anything from files other than main.
Yes so if you start adding files we switch to executing code via `lein exec main.clj`. We should probably drop the REPL in the same namespace as well. Do you know if there is an easy way to connect the REPL to a running program?
> 3. Lots of delays and hangs. Very slow. Every eval takes multiple seconds. Some repl starts take 30 seconds.
should be fixed now.
>4. Weird inconsistent behavior. Sometimes it will render function return values from editor eval to the repl, sometimes not.
This should be consistent. It's the first time we hear about this, can you please report it with some repro steps?
> 5. Once you drop a new file, stuff breaks in strange ways. E.g. main.clj no longer seems connected to the user namespace.
Related to point #2
> 6. Can't load other files, (load "other.clj") doesn't find it.
It works, you shouldn't add the extension in `load`. See working example: https://repl.it/@amasad/Load-example
Is this an avenue you're at all perusing / interested in -- or else, do you have any sense of how other business could rely on your product?
I noticed two small issues. First, if you enable gzip on static assets, it will help images load faster. Second, Mason's picture is 2MB, bigger than everything else combined!
In particular, it would be great update a function or class select it and press a button to run the updated version in the REPL so that you wouldn't have to copy and paste it there manually.
Additionally, and perhaps counter-intuitively the server-side solution was better for folks in areas with bad internet and computers. Downloading 10mb of JavaScript is a lot for some people and sometimes their computers would run out of memory parsing the JS.
Is a Typescript option in the pipeline? It's my favorite :)
This would make Repl.it a fantastic product for API example code testing.
At the time, Emscripten -- the predecessor to ASM.js that compiles native code to JavaScript -- was coming on the scene so we tried using it to compile Python, Ruby, and Lua and more to JavaScript. Much to our surprise it actually worked and we became the first production app to use Emscripten. We launched on HN in 2011 (https://news.ycombinator.com/item?id=3056490) and the reception was nothing short of amazing. Programmers used Repl.it as a portable repl and a bunch of learn-to-code and MOOC companies used our open-source stuff to build interactive coding experiences in the browser.
Unfortunately soon after that, we got busy with work and life and the project lingered for almost 5 years. I went to work at Codecademy as the #1 employee (which at the time was using open-source parts of Repl.it) and then left for Facebook where I worked on JavaScript Infrastructure and React Native. Around 2016 Haya (cofounder and wife) and I were looking for a new side-project but then decided that since no-one really built our vision for what Repl.it could become we decided to give it another shot. As soon as we started improving it we started seeing growth, within a few months it got to a point where we were spending a considerable sum just keeping the service up. We didn't want to start a company but we were faced with the choice of either shutting down something that users obviously love or we quit our jobs and start a startup. We chose the latter.
One thing that's interesting about our small team is that we've built expertise in both the frontend (IDE) and the infrastructure (container management and remote development environment protocols). For the IDE, we recently shipped a big rewrite that allowed us to do server-side rendering (important since we're committed to speed) and a plugin architecture based on the ideas behind Redux with a very small core (https://repl.it/blog/ide). Everything in the IDE is a plugin, which is simply a reducer, a receiver, and a React component. The reducer builds up the state required for the plugin to work, the receiver dispatches actions in response to other actions flowing through the system, and the component renders. Even something as core to the IDE as the file tree is built as a plugin with no privileged hooks into the core. For the backend, we've designed a set of protocols and hooks for remote development. The protocol can expand capabilities as you require them. For example, every program starts out using the simple (loop (print (eval (read)))) protocol and then if you decide to use files/modules then it will switch to something that knows how to handle file manipulation and change events. The IDE can also react to what you require, for example, if you open a port then it will open a webview would pop open so you can see the result.
Last but not least, Repl.it has a growing community of aspiring programmers. Some of our hardcore fans are teenage programmers and so we've built a place for them to share, vote on, and discuss their projects (https://repl.it/ibuiltthis?sort=top). One interesting thing that we've noticed about kids on our platform is that they continue to build 90's-style website. I've commented on a recent HN thread with links to some of their creations (https://news.ycombinator.com/item?id=16506825).
Happy to answer any questions.