Sharedchromeos / 2018-06-15-notes.mdOpen in CoCalc
CoCalc + Pixelbook

Installation

  1. Switch to the developer channel

  2. Install Linux support (search for linux in settings and enable)

  3. In termina, type sudo apt-get install tmux dpkg-dev

  4. Install Docker as here:

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

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

    You can now connect to https://penguin.linux.test to use your own private copy of CoCalc!

  6. Install vscode via Debian instructions:

    curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
    sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
    sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
    sudo apt-get update
    sudo apt-get install code # or code-insiders
    

    And make it so sudo is not required: sudo usermod -aG docker $USER, and close termina and re-open it.

  7. Install Node:

    curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    sudo apt-get install -y nodejs
    
  8. Other stuff: apt-get install inkscape gimp

Usage

Stopping Linux

Type ctrl+shift+t in Chrome, then type

vmc stop termina

Configure Cocalc (docker)

  1. Visit https://penguin.linux.test and make an account (click through security warning).

  2. Make the user you just made an admin:

    [email protected]:~$ sudo docker exec -it cocalc bash
    [email protected]:/# cd /cocalc/src/
    [email protected]:/cocalc/src# coffee
    coffee> require './c.coffee'
    coffee> db.make_user_admin(email_address:'[email protected]', cb:done())
    
  3. Make a dev project for local development:

    • Create a new project called "dev".

    • Create a terminal in it and open.

    • Make an ssh key in it: ssh-keygen -t ed25519 and copy it to your github account, so you can clone (and push) the cocalc code properly:

      ~$ cat .ssh/id_ed25519.pub
      ssh-ed25519 AAAAC3NzaC1lZDI1NTE...
      
    • Clone the cocalc repo:

      git clone [email protected]:sagemathinc/cocalc.git
      
    • (Alternative:) If you don't want to mess with ssh keys above, do

      git clone https://github.com/sagemathinc/cocalc.git
      
    • Build CoCalc (this should take around 5 minutes):

      $ cd ~/cocalc/src/; time npm run make
      
    • Add all this to the bottom of ~/.bashrc.

      # Cocalc dev setup
      export PATH=/usr/lib/postgresql/10/bin:$PATH
      export CUR=`pwd`
      cd $HOME/cocalc/src
      . smc-env
      cd "$CUR"
      
    • Exit and restart your shell. Then do the following from cocalc/src (in various tmux shells):

      dev/project/start_postgres.py
      ...
      dev/project/start_hub.py
      ...
      ./w
      
    • Type dev/project/info.py and get a URL like https://cocalc.com/[project_id]/port/34817/app/. Change cocalc.com to penguin.linux.test and visit that URL.