Coder Social home page Coder Social logo

sagemathinc / cocalc-docker Goto Github PK

View Code? Open in Web Editor NEW
396.0 19.0 102.0 1.69 MB

DEPRECATED (was -- Docker setup for running CoCalc as downloadable software on your own computer)

Home Page: https://cocalc.com

License: Other

Shell 18.71% Python 32.65% Dockerfile 39.28% JavaScript 5.61% Makefile 3.75%

cocalc-docker's Introduction

DEPRECATED

This is deprecated. Old instructions below.


What is CoCalc-Docker? Run CoCalc for free for a small group on your own server or laptop!

This is a single or multiuser CoCalc server that you can very easily install on your own computer using Docker in a few minutes. If you need something to install on a cluster of servers using Kubernetes, see cocalc-cloud.

GitHub: https://github.com/sagemathinc/cocalc-docker

Docs: https://doc.cocalc.com/docker-image.html

Quickstart

Quickstart on a Mac or Linux server with Docker installed

  1. Make sure you have at least 25GB disk space free and Docker installed on your computer.
  2. Run something like this, depending on your requirements:
docker run --name=cocalc -d -v ~/cocalc:/projects -p 443:443 sagemathinc/cocalc-docker
  1. Wait a for the 22GB image to pull, decompress and the container to start, then visit https://localhost.

For other operating systems and way more details, see below.

NEW: It is now possible to run cocalc-docker directly on https://cocalc.com on extremely powerful dedicated compute resources as explained here.

NOTE: The above will work fine on both x86_64 and aarch64 (e.g., Apple Silicon M1 macs). Cocalc-docker used to have a different Docker image for aarch64, but now there is only on.

If the above doesn't work due to something else already using port 443 or you wanting to serve cocalc on a different port, you could use -p 4043:443 instead. There is extensive Docker documentation online. For example the following runs cocalc-docker on port 7100:

 docker run --name=cocalc -d -v ~/cocalc:/projects -p 7100:443 sagemathinc/cocalc-docker

VERSION NOTE: The sagemathinc/cocalc-docker image is currently not backward compatible with sagemathinc/cocalc, since sagemathinc/cocalc uses the deprecated PostgreSQL version 10, whereas cocalc-docker uses PostgreSQL version 14, and we haven't implemented an automated upgrade path yet. That said, using the standard pg_dumpall and psql tools to export and import the database works.

Connecting to https://localhost

The default cocalc-docker container of course has only a self-signed ssl certificate. Browsers have cracked down more and more on allowing connections to such servers. Because cocalc-docker is serving on localhost, you must explicitly tell your browser to allow the connection. Do a Google search for "chrome allow localhost https" to find out how; one result is https://communicode.io/allow-https-localhost-chrome/.

LICENSE AND SUPPORT:

SECURITY STATUS:

  • This is not blatantly insecure from outside attack: the database has a long random password, user accounts are separate, encrypted SSL communication is used by default, etc.
  • That said, a determined user with a CoCalc account could in theory easily access or change files of other users in the same container, and can definitely overload the server! Open ports are exposed to users for reading/writing to project files, these can be used by authenticated users for accessing any other project's open files. Requests should only connect to the main hub process, which proxies traffic to the raw server with an auth key created by the project's secret key changing on every project startup, see Issue 45. Also see the related issues for adding a user auth token to all requests required for each separate sub module, including JupyterLab server Issue 46 and classical Jupyter in an iframe Issue 47.
  • There is no quota on project resource usage, so users could easily crash the server both intentionally or accidentally by running arbitrary code, and could also overflow the storage container by creating excessive files.
  • Use this for personal use, behind a firewall, or with an account creation token, so that only other people you trust create accounts. Don't make one of these publicly available with important data in it and no account creation token! See issue 2031. Basically, use this only with people you trust.
  • See the open docker-related CoCalc issues.
  • The above security and resource problems are all solved by cocalc-cloud.

Instructions

Install Docker on your computer (e.g., apt-get install docker.io on Ubuntu). Make sure you have at least 25GB disk space free, then type:

docker run --name=cocalc -d -v ~/cocalc:/projects -p 443:443 sagemathinc/cocalc-docker

wait a few minutes for the image to pull, decompress and the container to start, then visit https://localhost. (If you are using Microsoft Windows, instead open https://host.docker.internal/.) It is expected that you'll see a "Your connection is not private" warning, since you haven't set up a security certificate. Click "Show advanced" and "Proceed to localhost (unsafe)".

NOTES:

  • If you get an error about the Docker daemon, instead run sudo docker ....

  • CoCalc will NOT work over insecure port 80. A previous version of these directions suggested using -p 80:80 above and visiting http://localhost, which will not work.

  • If you are using Microsoft Windows (or possibly MacOS!), instead make a docker volume and use that for storage for vastly better performance:

    docker volume create cocalc-volume
    docker run --name=cocalc -d -v cocalc-volume:/projects -p 443:443 sagemathinc/cocalc-docker
    
  • IMPORTANT: If you are deploying CoCalc for use over the web (so not just on localhost), it is probably necessary to obtain a valid security certificate instead of using the self-signed unsafe one that is in your Docker container. See this discussion.

  • If you are using Ubuntu as a host and would like the CoCalc instance to use your host's time and timezone, you can amend the run command as follows, which will use your host's timezone and localtime files inside the container:

    docker run --name=cocalc -d -v ~/cocalc:/projects -v "/etc/timezone:/etc/timezone" -v "/etc/localtime:/etc/localtime" -p 443:443 sagemathinc/cocalc-docker
    
  • Here's a new Step-by-Step Guide to Setting up Cocalc-Docker on a Custom Domain with a valid SSL Certificate in case you want to go beyond just running something locally on your laptop, and want to provide an integrated solution for your community.

The above command will first download the image, then start CoCalc, storing your data in the directory ~/cocalc on your computer. If you want to store your worksheets and edit history elsewhere, change ~/cocalc to something else. Once your local CoCalc is running, open your web browser to https://localhost. (If you are using Microsoft Windows, instead open https://host.docker.internal/.)

The docker container is called cocalc and you can refer to the container and use commands like:

$ docker stop cocalc
$ docker start cocalc

You can watch the logs:

$ docker logs cocalc -f

However, these logs sometimes don't work. In that case get a bash shell in the terminal and look at the logs using tail:

$ docker exec -it cocalc bash
$ tail -f /var/log/hub.log

Using a custom base path

If you want cocalc-docker to serve everything with a custom base path, e.g., at https://example.com/my/base/path then you have to do two things.

(1) Set the BASE_PATH environment variable:

docker run -e BASE_PATH=/my/base/path --name=cocalc -d -v ~/cocalc:/projects -p 443:443 sagemathinc/cocalc-docker

This sets the base path correctly for most of CoCalc, but not for everything, unfortunately.

(2) Rebuild the next.js package

The next package in CoCalc itself is the only thing that hardcodes the basepath. You have to rebuild it exactly once with the BASE_PATH environment variable set, as follows:

~/cocalc-docker/aarch64$ docker run -e BASE_PATH=/my/base/path --name=cocalc -d -v ~/cocalc:/projects -p 443:443 sagemathinc/cocalc-aarch64
034cf17482a467537addd8ef8db0406277a7f76789eac4b03e0535d8e0d9ccfc
~/cocalc-docker/aarch64$ docker exec -it cocalc bash
root@034cf17482a4:/# umask 022
root@034cf17482a4:/# cd /cocalc/src/packages/next
root@034cf17482a4:/cocalc/src/packages/next# echo $BASE_PATH
/my/base/path
root@034cf17482a4:/cocalc/src/packages/next# time npm run build
real    2m12.900s
# Expect this to take a LONG TIME, e.g., up to 10 minutes, though it
# just took 2 minutes on a fast server for me.

Now exit the docker container and restart it to switch to the new version:

~/cocalc-docker/aarch64$ docker stop cocalc; docker start cocalc

Now visit: https://localhost:443/my/base/path/ and it should fully work.

We do much of the development of CoCalc itself on https://cocalc.com using a BASE_PATH. So fortunately BASE_PATH functionality does get used frequently.

Completely disable idle timeout

Projects will stop by default if they are idle for 30 minutes. Admins can manually increase this for any project. If you want to completely disable the idle timeout functionality, set the COCALC_NO_IDLE_TIMEOUT environment variable. Note that the user interface will still show an idle timeout -- it's just that it will have no impact.

docker run -e COCALC_NO_IDLE_TIMEOUT=yes --name=cocalc -d -v ~/cocalc:/projects -p 443:443 sagemathinc/cocalc-docker

Running a server without SSL -- plain http

By default, cocalc-docker creates services on 3 ports:

  • 22 -- ssh
  • 80 -- a simple http redirect that sends the user to https
  • 443 -- the main site, served over https, but by default with a self-signed certificate

If you would like the following configuration instead, pass the --env NOSSL=true option when you create the Docker container:

  • 22 -- ssh
  • 80 -- the main site, served over htttp
docker run --name=cocalc --env NOSSL=true -d -v ~/cocalc:/projects -p 8080:80 sagemathinc/cocalc-docker

You might want to do this if you are doing your ssl termination via some sort of external server, e.g., haproxy or nginx.

Installing behind an Nginx Reverse Proxy

If you're running multiple sites from a single server using an Nginx reverse proxy, a setup like the following could be useful.

Instead of mapping port 443 on the container to 443 on the host, map 443 on the container to an arbitray unused port on the host, e.g. 9090:

docker run --name=cocalc -d -v ~/cocalc:/projects -p 9090:443 sagemathinc/cocalc-docker

In your nginx sites-available folder, create a file like the following called e.g. mycocalc:

map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
}

server {
    listen 443 ssl;
    server_name             mycocalc.com;

    #These need to be obtained independently for example from https://letsencrypt.org/, by running "certbot certonly" on the docker host after DNS is setup
    ssl_certificate         /etc/letsencrypt/live/mycocalc.com/fullchain.pem;
    ssl_certificate_key     /etc/letsencrypt/live/mycocalc.com/privkey.pem;

    location / {
        # push traffic through the proxy to the port you mapped above, in this case 9090, on the localhost:
        proxy_pass https://localhost:9090;

        # this enables proxying for websockets, which cocalc uses extensively:
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header Host $host;
    }
}

And soft-link it to your sites-enabled folder, e.g. sudo ln -s /etc/nginx/sites-available/mycocalc /etc/nginx/sites-enabled/mycocalc

If you're using certbot and letsencrypt, you can then get a certificate for your domain using something like sudo certbot --nginx and selecting "mycocalc.com", which will automatically set up an ssl cert and modify your nginx server file.

MacOS (running on localhost)

Clock skew

I have tested a lot in November 2021, and did NOT have any problems with clock skew with Docker Desktop, so this appears to be fixed. If not -- It is critical that the Docker container have the correct time, since CoCalc assumes that the server has the correct time. On a laptop running Docker under MacOS, the clock may get messed up any time you suspend/resume your laptop. This workaround might work for you: https://github.com/arunvelsriram/docker-time-sync-agent/.

Apple Silicon M1 / Linux aarch64/arm64 is fully supported via a different image

I regularly post an Apple Silicon Aarch64 cocalc-docker image. This runs natively. It should also work on other aarch64 Linux systems.

https://hub.docker.com/r/sagemathinc/cocalc-aarch64

Browser Issues with MacOS

Cocalc-docker by default uses a self signed certificate on localhost.

  • Firefox -- works fine: With Firefox you can click through some warnings and use CoCalc-docker just fine.
  • Chrome -- does NOT work: With Chrome, you can try to use the workaround here, which involves visiting chrome://flags/#allow-insecure-localhost , but I've found that the websocket connection to the project is still blocked.
  • Safari -- works fine: With current Safari, you can click through to "accept the risks", and it works really well.

Chromebook

You can run CoCalc locally on your Chromebook as long as it supports Crostini Linux.

  1. Install (Crostini) Linux support -- search for Linux in settings and enable.

  2. In the Linux terminal, type

    sudo su
    
    apt-get update && apt-get upgrade && apt-get install tmux dpkg-dev
    
  3. Install Docker as here:

    sudo su
    
     apt-get install -y \
     apt-transport-https \
     ca-certificates \
     curl \
     gnupg2 \
     software-properties-common &&  \
    curl -fsSL https://download.docker.com/linux/debian/gpg |  apt-key add - && \
     apt-key fingerprint 0EBFCD88  && \
     add-apt-repository \
     "deb [arch=amd64] https://download.docker.com/linux/debian \
     $(lsb_release -cs) \
     stable" && \
     apt-get update  && apt-get install -y docker-ce
    
  4. Install cocalc-docker:

    sudo docker run --name=cocalc -d -v /cocalc:/projects -p 443:443 -p 80:80 sagemathinc/cocalc-docker
    

    Type /sbin/ifconfig eth0|grep inet in the terminal, and use whatever ip address is listed there -- e.g., for me it was https://100.115.92.198/

SSH port forwarding

If you're running this docker image on a remote server and want to use ssh port forwarding to connect, type:

ssh -L 8080:localhost:443 username@remote_server

then open your web browser to https://localhost:8080

For enhanced security, make the container only listen on localhost:

docker stop cocalc
docker rm cocalc
docker run --name=cocalc -d -v ~/cocalc:/projects -p  127.0.0.1:443:443 sagemathinc/cocalc-docker

Then the only way to access your CoCalc server is to type the following on your local computer:

ssh -L 8080:localhost:443 username@remote_server

and open your web browser to https://localhost:8080

SSH into a project

IMPORTANT: The ssh directions for cocalc.com involving key management, etc., do not apply to cocalc-docker. cocalc.com uses an "ssh gateway", and uniform key management across all of your projects. Cocalc-docker doesn't implement any of that, and just does ssh access directly, in exactly the same standard way as a generic Linux install.

In order to ssh into cocalc-docker, you must expose port 22 of your cocalc-docker container to the outside world. To do that you have to create the container with the option -p <your ip address>:2222:22 (say). Thus, instead of doing:

docker run --name=cocalc -d -v ~/cocalc:/projects -p 443:443 sagemathinc/cocalc-docker

do this instead:

docker run --name=cocalc -d -v ~/cocalc:/projects -p 443:443 -p <your ip address>:2222:22  sagemathinc/cocalc-docker

NOTES:

  • You can use a different port instead of port 2222. That's just an arbitrary port that you'll ssh to (i.e., you pass -p 2222 to ssh.)

  • If you have an existing cocalc-docker, and just want to expose port 22 without otherwise changing it, that is a massive pain -- that sort of dynamic reconfiguration is just not something that Docker is any good at. Instead, your best bet is to stop and delete that cocalc-docker and create a new one. Hopefully you are using the -v option, so all your data is stored on your filesystem, rather than in the Docker container!

Then you can do the following, but it won't succeed until you configure the .ssh directory in your project, as explained below:

~$ ssh projectid@<your ip address> -p 2222

Note that projectid is the hex id string for the project without hyphens. One way to show the project id in this format is to open a .term file in your CoCalc project and run the following command:

~$ echo $USER

To use SSH key authentication with the Docker container, have your private key file in the usual place in the host computer, for example ~/.ssh/.id_ed25519, and copy the matching public key into your project's home directory. For example, you could do the following in a .term in your project:

~$ cd
~$ mkdir .ssh
~$ vi .ssh/authorized_keys
... paste in contents of ~/.ssh/id_cocalc.pub from host computer ...

After doing that, you can then ssh to your project. Here's a less abstract example showing what this looks like.

wstein@studio ~ % docker run --name=cocalc-docker -d -p 127.0.0.1:4043:443 -p 127.0.0.1:2022:22 sagemathinc/cocalc-docker
wstein@studio ~ % more ~/.ssh/id_ed25519.pub
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA1bwpB7b7TVIexZxW003FCbDqzyFurSwZlljmT7sWzo wstein@studio
# I then sign in via my web browser and create a project, and make the above key the
# contents of ~/.ssh/authorized_keys inside my project. After doing that, the following works:
wstein@studio ~ % ssh 65b5a3c0e4d046329854f3d3db725f0b@localhost -p 2022
The authenticity of host '[localhost]:2022 ([127.0.0.1]:2022)' [...]
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes [...]
Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.10.124-linuxkit aarch64)
[...]
~$ hostname
6456fb9c78a8
~$ echo $USER
65b5a3c0e4d046329854f3d3db725f0b
~$ more .ssh/authorized_keys
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA1bwpB7b7TVIexZxW003FCbDqzyFurSwZlljmT7sWzo [email protected]

To use rsync to copy files to your project, make sure to include the -e 'ssh -p 2222' option (more discussion).

Make a user an admin

Get a bash shell insider the container, then connect to the database and make a user (me!) an admin as follows:

$ sudo docker exec -it cocalc bash
root@17fecb49c5c2:/# cd /cocalc/src/scripts
root@17fecb49c5c2:/cocalc/src/scripts# ./make-user-admin [email protected]
UPDATE 1

Obviously, you should really make the user you created (with its email address) an admin, not me!Refresh your browser, and then you should see an extra admin tab and the top of your browser window; you can also open any project by directly visiting its URL, and change the idle timeout and always running settings. In the Admin tab you can search for users, impersonate any user, ban users, configure dozens of things about CoCalc, send a notification that all signed in users see, and more. One thing admin users can't do is get a root shell -- for that you have to use sudo docker exec -it cocalc bash (of course, CoCalc is just Ubuntu linux, so you could make it so a specific project can become root via sudo).

Note that the make-user-admin script is in /cocalc/src/scripts. Take a look at it:

root@17fecb49c5c2:/cocalc/src/scripts# more ./make-user-admin
...
echo "update accounts set groups='{admin}' where email_address='$1'" | psql

As you can see, aside from some error checking, the entire script is just a 1-line PostgreSQL query. If you know basic SQL, you can very easily do all kinds of interesting things.If you type psql as root, you'll get the PostgreSQL shell connected to the database for CoCalc. Type \d to see the tables, and \d tablename for more about a particular table. For example,typing \d accounts shows all the fields in the accounts table, and groups is one of them.Here's where in the source code ofCoCalc itself all of these database tables are defined. In any case, being aware of all this can be very helpfulif you want to do some batch action, e.g., :

  • delete all accounts that are old or inactive
  • query to get the status of projects or accounts

Make a project have sudo access (root with no password)

You can also make it so that running sudo su in a CoCalc terminal allows a project to gain root access. First as above, from outside of CoCalc, dodocker exec -it cocalc bash, then type visudo:

$ docker exec -it cocalc bash
root@931045eda11f:/# visudo

Then run this echo command, but replace 0630f773c01847e79c0863c0118fe0de by the project id with all dashes removed:

echo '0630f773c01847e79c0863c0118fe0de ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

Alternatively, you can get the username by typing whoami in a terminal from the project:

~$ whoami
0630f773c01847e79c0863c0118fe0de

After the above echo command, go to a terminal in your project and try sudo su:

~$ sudo su
root@121119037fd4:/projects/0630f773-c018-47e7-9c08-63c0118fe0de# ls /root
run.py

Bam, you're root!

NOTE: A project having sudo access is completely unrelated to a user in CoCAlc being an admin. Neither implies the the other.

NOTE: You can also use visudo to edit the file (which is better), or EDITOR=emacs visudo to edit it using emacs.

WARNING: Obviously having a user able to run as root in a Docker container introduces additional security issues.

Reset a user's password

Sign in as a user that is an admin (see the previous section above). Click on the Admin tab at the top, search for the user, and then click the "Password" toggle, and click "Request Password Reset Link...".

This does NOT set the password. It just makes a password reset link, which you send your user via some communications channel that works. You may need this because:

  • You do not have email setup. It is possible to setup Sendgrid so your cocalc-docker image sends out email, but we haven't documented that yet...
  • You have email setup, but it sometimes fails for users with aggressive spam filtering.

Registration Tokens

After making your main account an admin as above, search for " Registration Tokens" in the Admin tab. Create one or more tokens and share them with people who you want to use your server. Nobody else will be able to make an account.

Public Sharing of Files

By default users are NOT allowed to share files publicly, and the server at your_server/share is disabled. You can enable the share server and public file sharing in Admin --> Site Settings --> "Allow public file sharing".

Anonymous Accounts

Similar to public file sharing, users are not allowed to make an account without entering an email address and password. You can further restrict users by requiring a registration token or via disabling "Allow email signup" in Admin --> Site Settings. On the other hand, you can allow anybody to use your server without even creating an account by going to Admin --> Site Settings --> "Allow anonymous signup". You probably don't want to do this.

Terminal Height

If docker exec -it cocalc bash doesn't seem to give you the right terminal height, e.g. content is only displayed in the uppper part of the terminal, this workaround may help when launching bash:

docker exec -e COLUMNS="`tput cols`" -e LINES="`tput lines`" -it cocalc bash

More information on this issue is in moby issue 33794.

Installation for SELinux (Fedora, etc.)

In order to build and run CoCalc on an SELinux box, first set SELinux to permissive:

$ setenforce 0

Tell docker and SELinux to "play nicely":

$ chcon -Rt svirt_sandbox_file_t cocalc

return SELinux to enabled:

$ setenforce 1

-- via discussion

More docs

See the docs directory for some additional documentation.

Your data

If you started the container as above, there will be a directory ~/cocalc on your host computer that contains all data and files related to your projects and users -- go ahead and verify that it is there before upgrading. It might look like this:

Williams-MacBook-Pro:~ wstein$ ls cocalc
be889c14-dc96-4538-989b-4117ffe84148	postgres    conf

The directory postgres contains the database files, so all projects, users, file editing history, etc. The directory conf contains some secrets and log files. There will also be one directory (like be889c14-dc96-4538-989b-4117ffe84148) for each project that is created.

External PostgreSQL server

CoCalc-Docker includes a PostgreSQL server. However, you can also use your own external PostgreSQL server.

Upgrade

WARNING (APRIL 2023): The sagemathinc/cocalc Docker image is currently not backward compatible with sagemathinc/cocalc-docker, since sagemathinc/cocalc uses the deprecated PostgreSQL version 10, whereas cocalc-docker uses PostgreSQL version 14, and we haven't implemented an automated upgrade path yet. Here are user contributed instructions for manually upgrading the database, though.

New images are released regularly, as you can see on the SageMath, Inc. Dockerhub page.

To get the newest image, do this (which will take some time):

docker pull  sagemathinc/cocalc-docker

Once done, you can delete and recreate your CoCalc container: (This will not delete any of your project or user data, which you confirmed above is in ~/cocalc.)

docker stop cocalc
docker rm cocalc
docker run --name=cocalc -d -v ~/cocalc:/projects -p 443:443 sagemathinc/cocalc-docker

Now visit https://localhost to see your upgraded server.

Upgrade just the CoCalc source code (potentially tricky)

Instead of upgrading the Docker image, you could upgrade the source code of cocalc to the latest master version (or any other commit or branch) as follows.

First become root in your container: docker exec -it cocalc bash, then:

root@...:~# umask 022
root@...:~# cd /cocalc/src
root@...:/cocalc/src# git pull
root@...:/cocalc/src# npm run build
root@...:/cocalc/src# cd /root; python -c "import run; run.start_hub()"

This could take about 15 minutes. It could randomly fail if some npm package is temporarily not available; if that happens, try again. Upgrading this way does not upgrade any system-wide Ubuntu packages or configuration, so it might result in a broken Docker container. In that case, your data should be fine, and you can upgrade as described in the section above.

Cocalc-Personal

There is a minimal version of cocalc-docker that is built to run in personal mode, in which absolutely everything in the container runs as a single non-root user named user.

Adding custom software to your CoCalc instance

The CoCalc Docker images at Docker Hub contain a subset of all the software in at cocalc.com. At present, the images are about 12 GB while the cloud service has hundreds of GB of packages and libraries.

Suppose you'd like to add software to your local CoCalc instance after installing and starting the Docker container. Here's an example of how to add an install of texlive-full, in case you need more than the minimal texlive installation in the published image:

The Docker image is Ubuntu 18.04. You can do

sudo docker exec -it [container name] bash

to become root in the container, then do

apt-get install texlive-full

to install the package.

Note that the texlive-full package is over 3 GB. So you will need the additional disk space to install it, and it could take several minutes to over an hour to install, depending on your connection to the internet and the speed of your computer.

Additional notes:

  • Be sure to type umask 022 first before you install software if you are using a method other than apt-get. This step is needed to ensure that permissions are set properly. The default umask is 007. If you use pip3 or pip2 without setting the umask to 022, the package gets installed, but it is not visible to normal users as a result.
  • Most instructions for adding packages to Ubuntu 18.04 should work for CoCalc-Docker, for example pip install for Python 2 packages, and pip3 install for Python 3 packages.
  • Whenever you upgrade your CoCalc image from Docker Hub as described in Upgrade above, you will need to repeat the above steps.

User-contributed scripts

  • See the contrib subdirectory here for scripts contributing by people that are running their own cocalc-docker servers. For example, there is a Python script for removing old accounts and old or deleted projects.

Troubleshooting

Building your own Docker image

The cocalc-docker images are not some black box images that are built in some mysterious way. You can see exactly what recipe is used to build them by looking at Dockerfile. Moreover, you can modify Dockerfile if you want and build your own image.

It is easy (but time consuming) to build the cocalc-docker image from scratch. We do this regularly using the update-the-build-stage-0.sh scripts, e.g., for x86_64:

$ make cocalc-docker

Some reasons to build your own image:

  • You want to run the most up-to-date version of the cocalc source code, or your own special branch. Though you can also easily do that starting with our premade image, as explained in the section on upgrading.
  • You want to change what software is installed in your cocalc-docker image, e.g., remove Julia and add something else like Tensorflow that we don't include by default.

Building the image no longer rebuilds sage, since that would add hour(s) to the build. Instead, we use a build of Sage from here, so the build of cocalc-docker is much quicker (it's mostly just installing binaries and building Cocalc).

Adding Tensorflow-GPU or PyTorch-GPU support

This section assuming that your docker host has a GPUs and the nvidia-docker2 runtime is installed properly. For more information please see the NVIDIA Container Toolkit project.

Test of the docker with GPUs support should give a similar output:

(base) [root@gput401 cocalc-docker]# docker run --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all --rm nvidia/cuda:latest nvidia-smi
Tue Jun 16 17:52:16 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.64.00    Driver Version: 440.64.00    CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Tesla T4            Off  | 00000000:00:06.0 Off |                    0 |
| N/A   31C    P0    16W /  70W |      0MiB / 15109MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

If the test running w/o problems, you can start to rebuild your own cocalc docker image with tensorflow or pytorch support:

cp  Dockerfile Dockerfile-gpu

Simply change first line in the Dockerfile-gpu

#ARG MYAPP_IMAGE=ubuntu:22.04
ARG MYAPP_IMAGE=nvcr.io/nvidia/tensorflow:23.08-tf2-py3

to instead start with the official Tensorflow image. For the official PyTorch image, use:

#ARG MYAPP_IMAGE=ubuntu:22.04
ARG MYAPP_IMAGE=nvcr.io/nvidia/pytorch:23.10-py3

Then rebuild your image:

docker build  -t cocalc-gpu -f Dockerfile-gpu .

Run it with GPU support.

docker run -it --gpus all --name=cocalc-gpu -d -v ~/cocalc_test:/projects -p 443:443 -p 0.0.0.0:2222:22  --rm  cocalc-gpu  bash

Links

cocalc-docker's People

Contributors

alimirlou avatar arm2arm avatar billpage avatar charlesangus avatar djp3 avatar drxyzzy avatar haraldschilly avatar mperreir avatar schrodingersket avatar tmrlvi avatar tornaria avatar williamstein avatar zcesur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cocalc-docker's Issues

Question about account creation

Hi devs,

So I'm running my own remote installation of cocalc, and I can create users through the database.

However, I am having issues with having users make their own accounts (through the standard sign up window). Is there documentation regarding the user registration process or is this a bug?

Also, to provide context, the load server info and hub connector are both perpetually connecting.

make it possible to change the port that the Docker image listens on

E.g., Google Cloud Platform explicitly does not support remapping ports: "You cannot map a VM instance's ports to the container's ports (Docker's -p option)." -- see https://cloud.google.com/compute/docs/containers/deploying-containers?hl=en_US&_ga=2.82550550.-1411779717.1559661250

We would have to change the image so that the ports it uses can be optionally specified via an environment variable. Then -- in google cloud (say) -- one can set that variable however you want when creating the instance.

REQUESTED BY: David Stankiewicz

coffee hangs on `require 'c'`

When trying to reset a users password, coffee hangs on require 'c':

root@f98a06bd5f36:/# coffee
coffee> require 'c'

This is on an updated docker installation in a ubuntu host system. How can I debug this more?

make it so the raw server uses an authentication key

Project have a "raw server" that serves files from the project on localhost. In cocalc-docker this makes it so any one user could read and write files to any other project by playing around with wget and curl on localhost. They would have to work to find the right port, but with some effort it could be done. This is an explicitly documented "local exploit" in our README.md.

The point of this issue is to fix this by making it so that server has an authentication key that has to be used. Only the main hub process connects to the raw server (by proxying traffic), and it would know the auth key (which is the project's secret_token, which is long, random, and changed whenever the project starts). It would then include this auth key with http requests that it proxies along.

There is one other security issue involving Jupyter Notebook and Jupyter Lab: #46, #47.

Setup Julia Kernel on the Docker version of Cocalc

Hi,

I’ve downloaded the latest version of Cocalc from Docker Hub and I actually want to host a Cocalc server on my computer. I actually want to add Julia 1.0.3 has a new kernel. I’ve followed Marcelo Forets (https://github.com/mforets) tutorial about adding Julia (https://github.com/sagemathinc/cocalc/wiki/JuliaCustom), combined with the information given in the Cocalc Dockerfile :

# Install Julia
RUN cd /tmp \
&& wget https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.3-linux-x86_64.tar.gz \
&& tar xf julia-1.0.3-linux-x86_64.tar.gz -C /opt \
&& rm -f julia-1.0.3-linux-x86_64.tar.gz \
&& mv /opt/julia-* /opt/julia \
&& ln -s /opt/julia/bin/julia /usr/local/bin

# Install IJulia kernel
RUN echo '\
ENV["JUPYTER"] = "/usr/local/bin/jupyter"; \
ENV["JULIA_PKGDIR"] = "/opt/julia/share/julia/site"; \
Pkg.init(); \
Pkg.add("IJulia");' | julia \
&& mv -i "$HOME/.local/share/jupyter/kernels/julia-1.0" "/usr/local/share/jupyter/kernels/"

But wasn’t able to make it work.

Using “jupyter kernelspec list” command, I was able to see Julia :

Capture d’écran, le 2019-04-09 à 18 02 09

But it did not successfully appear in Cocalc Kernel lists :

Capture d’écran, le 2019-04-09 à 18 02 24

How can I make it appear?

Thanks!

Francis Forget

in cocalc-docker, make it so classical Jupyter Notebook and also Jupyter Hub both require authentication

First, we change the command line that is run when you click the "JupyterLab server" and "Classical Jupyter" server button in +New (and project settings), so it requires the use to authenticate somehow.

We will somehow have to then convey whatever the secret password is to the user, since I don't think it can be passed in the URL anymore.

Alternatively, we could make this functionality be completely disabled by default, and an admin user could optionally enable it (with a huge security warning).

update to sage-9.0

This definitely does not just work, even after sagemathinc/cocalc#4212

Some issues after building with sage-9.0:

  • smc-sage-server fails with this:

~$ smc-sage-server start
sage_server: starting...
sage_server: port=40663
sage_server: setting logfile to /projects/3b291300-23b1-4e26-90ba-4ab47e46676b/.smc/sage_server/sage_server.log
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/smc_sagews/sage_server.py", line 94, in <module>
    from . import sage_parsing, sage_salvus
  File "/usr/local/lib/python2.7/dist-packages/smc_sagews/sage_salvus.py", line 25, in <module>
    import sage.all
ModuleNotFoundError: No module named 'sage'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/smc_sagews/sage_server_command_line.py", line 73, in main
    start()
  File "/usr/local/lib/python2.7/dist-packages/smc_sagews/sage_server_command_line.py", line 41, in start
    from . import sage_server
  File "/usr/local/lib/python2.7/dist-packages/smc_sagews/sage_server.py", line 96, in <module>
    import sage_parsing, sage_salvus
ModuleNotFoundError: No module named 'sage_parsing'
  • The SageMath Jupyter kernel fails to start.

  • The kernel list includes Python2 (SageMath), which isn't meaningful anymore.

Issue with ant-design/colors when trying to rebuild cocalc

I'm trying to rebuild cocalc inside docker to apply some changes to landing page. I'm doing

cd /cocalc/src
git clean -xfd 
# applying changes here
. ./smc-env \
  && ./install.py all --web \
  && ./install.py all --compute

I fails with following error:

+ [email protected]
updated 1 package in 2.569s
TOTAL TIME: 3.2 seconds
npm WARN [email protected] had bundled packages that do not match the required version(s). They have been replaced with non-bundled versions.
npm WARN [email protected] requires a peer of webpack@^3.0.0 || ^4.0.0-alpha.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-dom@^15.4.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^15.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^15.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@^3.0.0 || ^4.0.0-alpha.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path /usr/lib/node_modules/.staging/smc-webapp-6843b03c/node_modules/@ant-design/colors
npm ERR! dest /usr/lib/node_modules/.staging/@ant-design/colors-139aecca
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/lib/node_modules/.staging/smc-webapp-6843b03c/node_modules/@ant-design/colors' -> '/usr/lib/node_modules/.staging/@ant-design/colors-139aecca'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-12-23T07_14_20_469Z-debug.log
npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated [email protected]: 👋 We've deprecated any official yearly presets in 6.x in favor or babel-preset-env. For 7.x it would be @babel/preset-env.
npm WARN deprecated [email protected]: Use uuid module instead
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
/usr/bin/smc-local-hub -> /usr/lib/node_modules/smc-project/bin/smc-local-hub
/usr/bin/smc-console-server -> /usr/lib/node_modules/smc-project/bin/smc-console-server

> [email protected] install /cocalc/src/smc-project/node_modules/gc-stats
> node-pre-gyp install --fallback-to-build

I've tracked down issue to following command:

npm --loglevel=warn --unsafe-perm=true --progress=false install ./smc-webapp -g

time to start project and see directory listing is way too long

  1. Start a project
  2. Wait 30 seconds.
  3. See the directory listing.

This is NOT due to compiling coffeescript or typescript, which is all done during the Docker build stage. Instead, this is very likely a side effect of the websocket proxying, and maybe some sort of retry timeout.

The actual expected time to start a project and see a directory listing with the Docker image should be more on the order of 2 seconds.

If you look at ~/.smc/local_hub/local_hub.log in any project in cocalc-docker you can see what's going on. It loads and starts most stuff up, but then waits about 20+ seconds for the websocket from the browser.

Request for Docker for Windows support

Hi,

Installing Docker for Windows on Windows 10, then run:

docker run --name=cocalc -d -v c:/cocalc:/projects -p 443:443 sagemathinc/cocalc

But page told "disconnecting...", with docker logs cocalc -f:

2017-08-27T00:36:10.617Z - debug: PostgreSQL.connect: "retry_until_success() -- err=command 'psql' (args=--user smc --host /projects/postgres/data/socket --port 5432 --list --tuples-only) exited with nonzero code 2 -- stderr='psql: could not connect to server: No such file or directory\n\tIs the server running locally and accepting\n\tconnections on Unix domain socket "/projects/postgres/data/socket/.s.PGSQL.5432"?\n'"
2017-08-27T00:36:20.623Z - debug: PostgreSQL.connect: "retry_until_success() -- try 71"
2017-08-27T00:36:20.623Z - debug: PostgreSQL._do_connect: undefined
2017-08-27T00:36:20.623Z - debug: PostgreSQL._do_connect: "first make sure db exists"
2017-08-27T00:36:20.624Z - debug: PostgreSQL._ensure_database_exists: "ensure database 'smc' exists"
2017-08-27T00:36:20.624Z - debug: PostgreSQL._ensure_database_exists: "psql --user smc --host /projects/postgres/data/socket --port 5432 --list --tuples-only"
2017-08-27T00:36:20.631Z - debug: PostgreSQL._do_connect: "Failed to connect to database -- command 'psql' (args=--user smc --host /projects/postgres/data/socket --port 5432 --list --tuples-only) exited with nonzero code 2 -- stderr='psql: could not connect to server: No such file or directory\n\tIs the server running locally and accepting\n\tconnections on Unix domain socket "/projects/postgres/data/socket/.s.PGSQL.5432"?\n'"
Failed to connect to database -- command 'psql' (args=--user smc --host /projects/postgres/data/socket --port 5432 --list --tuples-only) exited with nonzero code 2 -- stderr='psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/projects/postgres/data/socket/.s.PGSQL.5432"?

So, really support docker for Windows on Windows 10?
'

Adding Haskell kernel ?

Hello,
do you have an image with the Haskell kernel ?

If not which steps/documentation I could follow to add it ?

Many thanks for your help and this support of this amazing project.

Cannot Copy Files

When attempting to copy anything via. CoCalc Interface, only receive error "failed" in red balloon.

console log shows the following: (src MLA.tex, dest /Courses)

2018-07-03T05:39:57.945Z - debug: execute_code: "rsync -rltgoDxH Templates/Latex/Writing/MLA.tex Courses"
2018-07-03T05:39:57.945Z - debug: Spawning the command rsync with given args -rltgoDxH,Templates/Latex/Writing/MLA.tex,Courses and timeout of 120s...
2018-07-03T05:39:57.960Z - debug: Listen for stdout, stderr and exit events.
2018-07-03T05:39:57.964Z - debug: BUG ****************************************************************************
2018-07-03T05:39:57.964Z - debug: Uncaught exception: ReferenceError: to_json is not defined
2018-07-03T05:39:57.965Z - debug: ReferenceError: to_json is not defined
    at ChildProcess.<anonymous> (/cocalc/src/smc-util-node/execute-code.coffee:176:17)
    at emitOne (events.js:116:13)
    at ChildProcess.emit (events.js:211:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:196:12)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

2018-07-03T05:39:57.965Z - debug: BUG ****************************************************************************
[object Object]
    at process.<anonymous> (/cocalc/src/smc-project/local_hub.coffee:50:15)
    at emitOne (events.js:121:20)
    at process.emit (events.js:211:7)
    at process.emit (/cocalc/src/smc-project/node_modules/source-map-support/source-map-support.js:454:21)
    at process._fatalException (bootstrap_node.js:378:26)

ReferenceError: to_json is not defined
    at ChildProcess.<anonymous> (/cocalc/src/smc-util-node/execute-code.coffee:176:17)
    at emitOne (events.js:116:13)
    at ChildProcess.emit (events.js:211:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:196:12)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

error: Forever detected script exited with code: 1
error: Script restart attempt #4

Looks like it starts with missing to_json definition?

problem with cypari.h

In the last version of the docker image,
when using load() it seems like cython
has an issue.

It cannot compile because it cannot find "cypari.h".

The following foo.spyx shows the issue

cimport sage.rings.real_mpfi   
from sage.rings.real_mpfr cimport RealNumber, RealField_class
from sage.rings.real_mpfi cimport RealIntervalFieldElement, RealIntervalField_class

from cpython cimport bool

cdef float test_sum(float x, float y):
    return x+y

WebDriverException: Message: 'geckodriver' executable needs to be in PATH

Hi!

I tried to install geckodriver in ~/.local/bin as it is recommended, but when working in a Jupyter notebook with selenium, it doesn't find it in the path.

I tried to append the location to the path, and move the file to a place in the path (./local/lib/python3.6/site-packages), but it doesn't work either.

Is there any way to install that kind of drivers for use in Cocalc Jupyter notebooks?

Thanks in advance!

Singular doesn't work from CoCalc Jupyter notebook

  1. Open a CoCalc Jupyter notebook with the SageMath kernel.
  2. Run this code:
R.<x,y>=QQ[]
C=Curve(x*y)
C.singular_points()
  1. Get a big traceback involving Singular not starting.

Note, the same works fine a in Terminal running sage.

It does NOT work in the Terminal when running jupyter console --kernel=sagemath.

The error is weird:

RuntimeError: unable to start singular because the command 'Singular -t --ticks-per-sec 1000 --cntrlc=a' failed: The command was not found or was not executable: Singular.


In [2]: !which Singular
/usr/local/sage/local/bin/Singular

In [3]: Singular
Out[3]: <class 'sage.interfaces.singular.Singular'>

In [4]: !Singular
                     SINGULAR                                 /  Development
 A Computer Algebra System for Polynomial Computations       /   version 4.1.0
                                                           0<
 by: W. Decker, G.-M. Greuel, G. Pfister, H. Schoenemann     \   Nov 2016
FB Mathematik der Universitaet, D-67653 Kaiserslautern        \

In local docker installation - Library is stuck on Loading ...

On create new files for a python project I get the following:

library-loading

Also I am unable to install packages in the project. It is referring to system py2.
Is the project using some virtualenv mechanism?

~$ pip install --user arctic
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 22, in <module>
    from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
  File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 76, in <module>
    vendored("pkg_resources")
  File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
    __import__(modulename, globals(), locals(), level=0)
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 3088, in <module>
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 3072, in _call_aside
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 3101, in _initialize_master_working_set
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 565, in _build_master
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 558, in __init__
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 614, in add_entry
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 1964, in find_on_path
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2026, in distributions_from_metadata
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/virtualenv-16.1.0.dist-info'

Unable to view PDF files in projects and LaTeX editor

  • Click on any PDF file in project -> It is stuck in Loading loop forever

  • In LaTeX editor, PDF (Preview) sometimes does not show anything. Seem to be fixed by removing all auxilary files and recompiling document. When it works and document is updated, Preview does not reflect the changes.

nbextensions (3d plots) do not work in Jupyter in the Docker version

In the Docker version of SageMathCloud, enter the following in a Jupyter notebook running the SageMath 8.4 kernel:

var('x,y')
show(plot3d(x^2+y^2, (x,-1,1), (y,-1,1)), viewer="jmol")

This displays a "Load Viewer..." button. Clicking that button just displays a large blank space.

My browser's Javascript console says

GET https://sage4.ugent.be/nbextensions/jsmol/JSmol.min.js 404 (Not Found)

With the cocalc.com instance, the URL https://cocalc.com/nbextensions/jsmol/JSmol.min.js does work.

This looks related to sagemathinc/cocalc#159

Issue with Handout functionality in cocalc

I am using a docker image of Cocalc in Ubuntu 16.04 server. When I am trying to handout a file/folder its giving the following error:

Somebody may have moved the folder that should have contained the handout.
Project(project_id=3d9bd9e7-26d7-4245-8f35-70736c01ad18).cmd(...):
rsync --update --backup -zaxs --omit-link-times --chown=50869217:50869217 --ignore-errors --exclude=.sage/cache --exclude=.sage/temp --exclude=.trash --exclude=.Trash --exclude=.sagemathcloud --exclude=.smc --exclude=.node-gyp --exclude=.cache --exclude=.forever --exclude=.snapshots --exclude=.sage-backup --exclude=.sage-history -e 'ssh -o StrictHostKeyChecking=no -p 22' /projects/3d9bd9e7-26d7-4245-8f35-70736c01ad18/take/ localhost:/projects/9c3b6073-9e53-406e-9237-0895aac295bd/take/
Project(project_id=3d9bd9e7-26d7-4245-8f35-70736c01ad18).copy_path(...): rsync error: [Errno 2] No such file or directory
Traceback (most recent call last):
File "/usr/local/bin/smc-compute", line 12, in
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/smc_pyutil/smc_compute.py", line 1076, in main
args.func(args)
File "/usr/local/lib/python2.7/dist-packages/smc_pyutil/smc_compute.py", line 943, in g
result = getattr(Project(project_id=project_id, dev=args.dev, projects=args.projects, single=args.single, kucalc=args.kucalc), function)(**kwds)
File "/usr/local/lib/python2.7/dist-packages/smc_pyutil/smc_compute.py", line 915, in copy_path
raise RuntimeError(mesg)
RuntimeError: [Errno 2] No such file or directory

Setup Julia Kernel on the Docker version of Cocalc

Hi,

I’ve downloaded the latest version of Cocalc from Docker Hub and I actually want to host a Cocalc server on my computer. I actually want to add Julia 1.0.3 has a new kernel. I’ve followed Marcelo Forets (https://github.com/mforets) tutorial about adding Julia (https://github.com/sagemathinc/cocalc/wiki/JuliaCustom), combined with the information given in the Cocalc Dockerfile :

# Install Julia
RUN cd /tmp \
&& wget https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.3-linux-x86_64.tar.gz \
&& tar xf julia-1.0.3-linux-x86_64.tar.gz -C /opt \
&& rm -f julia-1.0.3-linux-x86_64.tar.gz \
&& mv /opt/julia-* /opt/julia \
&& ln -s /opt/julia/bin/julia /usr/local/bin

# Install IJulia kernel
RUN echo '\
ENV["JUPYTER"] = "/usr/local/bin/jupyter"; \
ENV["JULIA_PKGDIR"] = "/opt/julia/share/julia/site"; \
Pkg.init(); \
Pkg.add("IJulia");' | julia \
&& mv -i "$HOME/.local/share/jupyter/kernels/julia-1.0" "/usr/local/share/jupyter/kernels/"

But wasn’t able to make it work.

Using “jupyter kernelspec list” command, I was able to see Julia :

Capture d’écran, le 2019-04-09 à 18 02 09

But it did not successfully appear in Cocalc Kernel lists :

Capture d’écran, le 2019-04-09 à 18 02 24

How can I make it appear?

Thanks!

Francis Forget

CoCalc uses only one Core to compute

Hi everyone 😄

I’m not sure if that’s a bug or a feature, but I managed to run CoCalc on my own server that actually has an 8-Core Intel Core Xeon. What I’ve found is that a single ipynb won’t ever take more than a Core to compute, why is that?

image

My server has 8-Core but my calculations are bottlenecked because my notebook can only use one Core! I also saw that running 2 ipynb at the same time will use multiple cores. Is there a way to take advantage of it and use all cores for a single ipynb?

Thank you

implement support for the share server

  1. Start a docker instance running at url
  2. Try visiting url/share
  3. It doesn't work...

... because it was never implemented. Implement it. This means editing the haproxy stuff, etc., etc.,

Other port than 443

Could you please add instructions how to use other ports than 443? I want to set up cocalc alongside an already running apache2 server.

Connecting/disconnected cycle on sign-in page

Hi,

I hope I'm posting in the right place. I love having CoCalc locally via docker.

I've just pulled the latest version of cocalc as per the instructions, but now it won't log me in to the new version of the server due to connection problems. The connection never seems to get up and running and remains in a cycle of "connecting" and "disconnected".

I've just checked the cocalc-dev branch and that is working fine for me (same machine, running Ubuntu and using Chromium as browser) - that branch hasn't been pushed to dockerhub so recently.

Thanks for all your work on making this available,

Barrie.

X11 support on cocalc/docker

Based on the responses to my forum post with the same subject, here is the issue:

When having several users on a local cocalc/docker instance, only one ("the first") user can utilize the X11 support. X11 apps of all other users fail to open a display (xterm: Xt error: Can't open display: :9797250). The immediate reason clearly are the ownership/permissions of the X11 related files/sockets in /tmp, e.g.,

drwxrwxrwt 2 44ce141d1409467cadc9b9d66acb38bb 44ce141d1409467cadc9b9d66acb38bb 4096 Jan 8 16:24 .X11-unix

As a further observation, the files/sockets owned by the "first user" get neither removed upon the user logging out, nor upon a restart of the container.

Thanks for looking into this

I am testing the recent docker image with datashaders/holoviews w/o success.

Hello,
Are there any chance to get running cocalc with a datashader/holoviews?
I am testing the recent docker image with datashaders/holoviews w/o success.

import numpy as np
import pandas as pd
import holoviews as hv
from holoviews.plotting.bokeh.element import (line_properties, fill_properties,
                                              text_properties)
print("""
Line properties: %s\n
Fill properties: %s\n
Text properties: %s
""" % (line_properties, fill_properties, text_properties))

curve_opts = dict(line_width=10, line_color='indianred', line_dash='dotted', line_alpha=0.5)
point_opts = dict(fill_color='#00AA00', fill_alpha=0.5, line_width=1, line_color='black', size=5)
text_opts  = dict(text_align='center', text_baseline='middle', text_color='gray', text_font='Arial')
xs = np.linspace(0, np.pi*4, 100)
data = (xs, np.sin(xs))

(hv.Curve(data).options(**curve_opts) +
 hv.Points(data).options(**point_opts) +
 hv.Text(6, 0, 'Here is some text').options(**text_opts))

on the cocalc it produces:
holoview_demo

The result should be something like this:
holoview_demo

Connection issue when running CoCalc docker behind a reverse proxy

When I access my cocalc docker instance in my local network the connection to the hub server is established, but when trying to access it from the outside via the configured FQDN (which passes first through my reverse proxy via HTTPS), then the connection to the hub server cannot be established.

update to latest version

Right now this doesn't work too well, though the last binary I posted does work.

  1. Building works.

  2. The kernel for jupyter defaults to anaconda3, but the docker image doesn't have anaconda3 at all. Fix -- change kernel default to Sage, or install anaconda3. I think the later makes sense.

  3. The Jupyter kernel for sage (v 8.1) itself doesn't work at all (though sage worksheets work fine). The problem is:

~$ jupyter console --kernel=sagemath
Traceback (most recent call last):
  File "/usr/local/sage/local/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/local/sage/local/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/sage/local/lib/python2.7/site-packages/sage/repl/ipython_kernel/__main__.py", line 1, in <module>
    from ipykernel.kernelapp import IPKernelApp
  File "/usr/local/sage/local/lib/python2.7/site-packages/ipykernel/__init__.py", line 2, in <module>
    from .connect import *
  File "/usr/local/sage/local/lib/python2.7/site-packages/ipykernel/connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir
  File "/usr/local/sage/local/lib/python2.7/site-packages/IPython/__init__.py", line 48, in <module>
    from .core.application import Application
  File "/usr/local/sage/local/lib/python2.7/site-packages/IPython/core/application.py", line 16, in <module>
    from copy import deepcopy
  File "/usr/local/sage/local/lib/python2.7/copy.py", line 52, in <module>
    import weakref
  File "/usr/local/sage/local/lib/python2.7/weakref.py", line 14, in <module>
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref

cannot compute cell due to time out after "sage -pip pypyodbc"

  • After restarting project it doesn't answer.
  • Doing "restart worksheet" results in error.
root@505dfd72f5a8:~# sage -pip install pypyodbc
root@505dfd72f5a8:~# sage
Forcing sage-location, probably because a new package was installed.
Cleaning up, do not interrupt this.
Done cleaning.
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.2, Release Date: 2018-05-05                     │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
sage: import pypyodbc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.