Installation Problems

52 views
Skip to first unread message

Robert Lowe

unread,
Aug 18, 2016, 7:17:08 PM8/18/16
to sage-cloud
I have been trying, for about 2 weeks off and on, to install sage math cloud on a single node server.  I have found that there is a lot missing from the install documentation, and have managed to piece together what I needed to do by reading the coffee scripts.  However, I have some weirdness going on in that it does not work.  I can get as far as signing up for an account and logging in, and I can create projects but those projects cannot start.  Also, no files are created in /projects (even though permissions match).  Also, I cannot run the hub as a daemon, it immediately quits.  Running it in the foreground, however works.

Anyway, here's where I'm at right now.  I can create a project, but when I try to start a project I get the following on my foreground hub (as the last action):

2016-08-18T23:12:53.319Z - debug: [1 concurrent]  [0 modified]  rethink: query time using (00ed2d2d-7f26-41df-93a8-c8bb5b8cf5a5) took 7ms; average=5ms;  -- 'r.db("smc").table("projects", {"readMode": "outdated"}).get("7c84ab6d-8a67-4466-97dc-8ab1eb2b3cdd").replace(r.row.without({"host": {"host": true}}))'
2016-08-18T23:12:53.319Z - debug: ProjectClient(project_id='7c84ab6d-8a67-4466-97dc-8ab1eb2b3cdd','undefined').open: request to open on 'mccs'
2016-08-18T23:12:53.320Z - debug: ProjectClient(project_id='7c84ab6d-8a67-4466-97dc-8ab1eb2b3cdd','undefined')._storage_request(action='open',target='mccs'): 
2016-08-18T23:12:53.320Z - debug: ProjectClient(project_id='7c84ab6d-8a67-4466-97dc-8ab1eb2b3cdd','undefined')._storage_request(action='open',target='mccs'): no storage servers -- so all _storage_requests trivially done
2016-08-18T23:12:53.320Z - debug: ProjectClient(project_id='7c84ab6d-8a67-4466-97dc-8ab1eb2b3cdd','undefined').open: succeeded in opening; wait until host set

That sequence then repeats itself over and over again, so this leads me to some questions:

1.) Does compute need to run as root?  I've tried it both ways, nothing seems to change though.
2.) How does SMC create new accounts on the server?  When I run things like "who -u" on cloud.sagemath.org, I appear to be alone on the server,
though I know I'm not because the load is usually somewhere around 8 or 10.  
3.) Is there some critical package, like some sort of virtualization software, that I'm missing?

I would like to get up and running so I can begin trying to do some dev work, but a lot of the code surrounding the areas in question
is highly convoluted, which makes it difficult to figure out.  Has anyone else managed to install SMC?

Thanks,

Robert Lowe
Assistant Professor
Maryville College

Harald Schilly

unread,
Aug 18, 2016, 7:55:38 PM8/18/16
to sage-cloud
Hi, if you want to do dev work, then you should run it via the
instructions in src/dev/laptop

The projects are all isolated, such that you do not get any
information like processes and stuff for who on the compute nodes.
There is nothing special going on, except for cgroups. The real
problem might be, that you have to do additional configuration in the
database, but I'm not sure what you really did.

One day in the future, there will be configurations for kubernetes.
You can check that progress in the k8s subdirectory.

-- harald

Robert Lowe

unread,
Aug 18, 2016, 8:00:07 PM8/18/16
to sage-cloud
What I'm really after is running my own SMC installation for my students.  The commercial servers are far too bogged down, even with paid tiers.  Ultimately, I will be running a customized version which will only allow maryvillecollege.edu addresses to sign up, and have a few other changes that I have in mind.

I can run the laptop one just fine, I want to set up a real installation though.

Robert Lowe

unread,
Aug 19, 2016, 9:52:41 AM8/19/16
to sage-cloud
I am making progress!  I have discovered the secret handshake which starts the hub on a single server, and how to run the compute daemon.  I'm basically just running them as they are in the dev/single directory.

So project starts, I can use the terminal, and I can create and edit files.  Now, though, I can't view latex previews.  It builds the latex documents just fine, but preview does not work.  Looking under the hood a bit, I see that the rendered png files cannot download over the /raw links.  I did a little more checking and discovered that raw download does not work for any file, regardless of where it is!  The error I get when I go to one of these raw links is:

502 Bad Gateway

I looked in the nginx and haproxy logs and saw no errors.  The hub and compute similarly report what looks like should be successful.  Has anyone got any ideas where I should look?

Robert Lowe

unread,
Aug 19, 2016, 1:09:47 PM8/19/16
to sage-cloud
Another part of the puzzle has emerged.  I can get access to raw files through the proxy if they are in a publicly shared folder.  However, if I'm doing a raw pull within a project in a non-public folder I get a bad gateway.  

This tells me something is going on inside smc, probably with an authentication token of some kind.  I noticed in proxy.coffee that it looks like that is how it determines if it serves a file or not.  The section in question reads:

                if not misc.path_is_in_public_paths(path, public_paths)
                    # The requested path is not public, so nothing to do.
                    cb()
                else
                    # The requested path *is* public, so we get the file
                    # from one (of the potentially many) compute servers
                    # that has the file -- (right now this is implemented
                    # via sending/receiving JSON messages and using base64
                    # encoding, but that could change).
                    ....

It's non-obvious whether the earlier code in proxy.coffee can handle an authenticated user's files.  I assume it can, as this capability exists in the live cloud.sagemath.org server.  Alternatively, perhaps the master branch code is not actually the code currently running on SMC.  When I try manually talking to the proxy, and I send the same header sent by my web browser, I get a blank response.  The proxy doesn't even send a header back, which tells me that we are likely visiting this segment of the code even while authenticated.

I'm also beginning to think I'm alone in this, and once I do figure it out I will join an elite group of individuals who have managed to install SMC.  

Robert Lowe

unread,
Aug 19, 2016, 4:36:14 PM8/19/16
to sage-cloud
Ahahaha!  I figured it out!

My server's hostname is read by compute and that is the hostname it uses.  However, when the localhub runs, it binds to the first ip address on my server, but the hostname resolved to 127.0.0.1.  So I had to change /etc/hosts so that the hostname (mccs) resolved to that domain and then bingo I have the ability to pull raw files from within running projects.  The reason why it worked with public folders when I was logged out is that in those instances the traffic passes from compute to hub, whereas with a running project it goes from localhub to hub.  

The upshot of all this is, I have now read like 90% of the hub source code and I feel a lot more confident in administering the system now.  Perhaps if time permits I may contribute some more detailed documentation to the project.  The code itself is reasonably well organized, but without details of its design it can be a bit like unraveling a cable knit sweater when it comes to diagnosing issues.  (Such is the reality of all distributed applications!)

Now I just have to to get jupyter going and then I can spend the weekend writing custom code!

William Stein

unread,
Aug 20, 2016, 6:30:23 PM8/20/16
to sage-cloud
Rob,

Thanks for everything. I made a tiny doc change just now to address
the first issue you had:

https://github.com/sagemathinc/smc/commit/ecfa2b66b8b602ff7fd98c3a686a03e985d06880
> --
> You received this message because you are subscribed to the Google Groups
> "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cloud/c73ec5c7-9f2f-41a7-acbe-57be0cab59fe%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--

Best Regards,
William Stein

CEO, SageMath, Inc.
Reply all
Reply to author
Forward
0 new messages