Pluto on the web?

Hello

My aim is to share Pluto notebooks with other people without any hassle for them.
I mean, without asking them to install Julia and Pluto on their computer.
Also without long explanations about opening an account, setting up CPUs.

Jupyter notebooks can be used extremely easily on nextjournal.com .
Unfortunately, Pluto notebooks are not yet available on nextjournal .

I had a look at JuliaHub, but I could not figure out how to do that “easily”.
Frigthened by the “credits”.
I don’t see that Pluto notebooks could be given a single url.
I don’t see how to make it just like open a web page for the end user.

Any suggestion?

Thanks

Michel

1 Like

Hi there!

So, there are multiple solutions possible here, depending on what you need. I will include below the one that I think is most rational for a quick demo that you want to run on your machine and share with others, rather than something that is expected to be up all the time.

There is this command line utility called ngrok, which generates a URL pointing to a service running on a localhost port on your machine. You would have to start the notebook like this:

Pluto.run(;host="127.0.0.1",port=9999)

The port can be set to anything, I’m just using 9999 arbitrarily. Host has to be pointing to 127.0.0.1, because that’s localhost. Then you would run ngrok like this in your shell:

ngrok http 9999

That will generate a url that looks like a bunch of letters and numbers then ngrok.io. To the end of that ngrok url, you want to append a secret that appears at the end of the Pluto notebook link that shows up after you spin up a Pluto service, it looks something like this “/?secret=k9j9YWvT”.

As long as the Pluto notebook and ngrok are both running, you should be able to share that ngrok link with anyone, and they should be able to access your Pluto notebook. Definitely don’t share this link on any public forum, as those who have it will be able to execute any code on your machine. Only give it to those whom you trust.

Finally, this is just something that I tried out, and that worked for me. Depending on your network setup, operating system, etc etc, your mileage may vary. Goes without saying lol.

Good luck!

4 Likes

Te easiest way is to use Binder, see Hosting interactive pluto notebook on web/Github

3 Likes

Thanks Dictino!

stiven, thanks!
Thats’ funny, maybe not what I need right now, but sure something I will try sometimes.
Michel

1 Like

Looks like an intersting solution!
But be aware that you can execute any arbitrary Julia code inside a notebook, therefore exposing a notebook running on your local machine is a security risk. Running Pluto in a Docker container (official image: Docker Hub ) is more secure (but probably also not 100%). Thus, for public web sites I would rather go for a cloud hosting solution.

3 Likes

Damn stupid question from me. Can only one session at a time access a Pluto notebook? If this is hosted on the web I guess it is a positive thing that two or more can access a note book - maybe an instructor and a learner seeing what happens as things are changed. Let’s say the gravity on the earth then on the moon as a ball is bounced.

1 Like

Per default, multiple sessions to the same Pluto notebook are supported, but are synchronized, i.e. every change of one viewer is propagated to all others. This may or may not be what you want - for a public web page probably not.
There, the recommended way is to combine a static web page with a Pluto Slider Server, see PlutoSliderServer.jl -- notebooks as interactive websites | Fons van der Plas | PlutoCon 2021 - YouTube

@lungben, thankyou. The synchronized updates are good for the use case I was thinking about - interactive science labs where an instructor could (say) change the angle of the roof for snow to fall off like Alan Edelmann’s example. The students then can try their own setups and see what happens.

Thanks Dictino
The post by fonsp, where you told me, will probably be my best track!
Michel

1 Like