cogent3 / Cogent3Workshop

Materials for the Phylomania workshop
BSD 3-Clause "New" or "Revised" License
8 stars 4 forks source link

Create a screen cast for the process of setting up a machine #12

Open khiron opened 11 months ago

khiron commented 11 months ago

This issue is a placeholder to store an mp4 file in user assets

https://github.com/cogent3/Cogent3Workshop/assets/1835007/20e7ad50-d3aa-4c03-b0d8-5451ab6e1951

khiron commented 11 months ago

Script for the screen cast

g'day Richard here, we're going to get your PC set up to run a cogent3 workshop.

A couple of things you need to do to get started;

Firstly you'll need to have docker running on your machine. This will give us an isolated container that we can set up specifically to run cogent3 in. There are instructions in the wiki for how to set up a docker host on PC, Mac or Linux.

[PAUSE]

This is docker desktop, you can see there are 3 stopped containers.

[PAUSE]

If we switch to our terminal we can check that we have a docker daemon running with the command docker info ... and you can see 3 containers, 0 running.

Secondly you'll need the light weight code editor VS code installed on your machine. We're going to use that to work with code. Instructions are in the wiki for how to get that installed.

[PAUSE]

Thirdly, you'll need your own github account. Log into your github account. This is my account, and I'm logged in. OK now search github for cogent3workshop. This is the workshop repository. You should fork this repository which will create your own copy that you can make changes to and take advantage of githubs version control.

Hit the fork button, select the name for the repository (in my case it's my github name forward slash cogent3workshop. Unselect Copy the main branch only and press create fork.

Now you have your own copy of the repository. To get that on your machine, press the green code button and copy the HTTPS url.

[PAUSE]

Now go to the terminal on your machine, and navigate to the path you want the repository to be clone into.

Type git clone and paste the url in and hit enter

You should get a local clone of your repository in the folder cogent3workshop.

type code and the path to your repo, this will run VS code with the cogent3workshop folder loaded as the root folder for your project.

[PAUSE]

next thing you'll do is go to the VS code terminal with ctrl-backtick to build a docker image with the command docker build --tag cogent3workshop -f .\docker\DockerFile .

That takes about 2 minutes to run. what it is doing is building a custom version of debian linux, tu run in the container, installing cogent3 and it's prerequesites.

Next step is to run the docker container with docker run -it --rm -p 8888:8888 -v ${PWD}:/workspace cogent3workshop

This will create a container that has a workspace folder mapped to the root of your project in your host operating system, and a jupyter server running in that container - we'll use that to develop against cogent3.

[PAUSE]

If I switch over to docker desktop you can see I now have 4 containers, one running and it has a weird name. That is the default name that docker gives a container when you don't specify one.

[PAUSE]

Now we can work directly with that container in a browser, but first we have to grab a special token first from jupyter servers output.

[PAUSE]

We can go to a browser navigate to localhost:8888 and if we pass in that token we can work directly on code in our container.

[PAUSE]

We can also use visual studio inside the container, by attaching to the container. Go back to VS Code, click the remote window button in the lower left, select to attach to a container, and select from the running containers.

[PAUSE]

That will spawn a new VS code session attached to that container, and you can work with notebooks directly. And you can write some code to verify that you have connected to cogent3 by asking it for it's version.

Finally you can exit the container attached VS code. That doesn't stop the container, just your attachment to it.

[PAUSE]

To stop the container switch back to the terminal in the host OS version of VS code and stop the jupyter server with ctrl-C, and docker will remove the container. If you ever need it again just use the docker run command again.

OK I think you are all set up.

khiron commented 11 months ago

Note this is a first draft. Once the docker branch is merged it'll need to be redone. Plus I flubbed a few lines.

khiron commented 11 months ago

attach browser container_notebook default_zsh

khiron commented 11 months ago

Content from docker/README.md has been translated to https://github.com/cogent3/Cogent3Workshop/wiki/Computer-Setup