The hub CoCalc web server
This code is part of https://github.com/sagemathinc/cocalc and isn't currently designed to be used standalone. Our plan is to refactor this code into smaller useful modules that are published under the @cocalc npm organization.
This is a node.js process that serves all of the following (possibly simultaneously):
static content - our mirror of the cdn and the results of webpack (packages/static)
a proxy server that connects client browsers to projects
project control server that creates, starts and stops projects running locally
Running the server
Run the dev server, suitable for use inside a CoCalc project:
Using a different BASE_PATH and PORT
Just set either the BASE_PATH or PORT environment variables when starting thehub, and it will use what you set. If you do not set a BASE_PATH it uses either"/" by default, or something involving the project id if you're inside a CoCalcproject.
If you don't set the PORT then 5000 is used by default. The only way to set the port is via the PORT environment variable.
You can use the --hostname
command line options if you are starting the hub directly via the cocalc-hub-server
script and need to specify a different interface (e.g., 0.0.0.0 instead of localhost).
Listening on https
As a quick test, you can do
to create self-signed key and cert. You can then start the hub with these two files as options:
and the hub will use https instead of http. Simple as that.
Conat
To run each component of conat separately. Do each of these in DIFFERENT terminals, with the env variables as possible examples in dev mode.
Run the conat-core socketio server on port 5000:
Run the conat-api server on port 5002, but pointed out our port 5000 socketio server
Run one or more persist servers: