Coder Social home page Coder Social logo

command-line-bootcamp / cli-boot.camp Goto Github PK

View Code? Open in Web Editor NEW
101.0 10.0 52.0 1.73 MB

:computer: command-line bootcamp adventure in your browser

Home Page: https://cli-boot.camp/

License: Other

JavaScript 93.49% HTML 6.03% CSS 0.39% Dockerfile 0.09%
unix learning teaching command-line terminal

cli-boot.camp's Introduction

Command-line bootcamp

Learn the unix command-line by using it in your browser.

contributors

Contributing

build and deploy the frontend

You'll need node.js

# install and set up nvm and node
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash
source ~/.bashrc

# some dependencies don't work with node 1+, so stick with 0.12
nvm install 0.12
nvm use 0.12

Once you've got node installed, grab this repo and let node install the dependencies:

git clone https://github.com/Blahah/command_line_bootcamp.git
cd command_line_bootcamp
npm install

Make your changes (if any) and then deploy:

npm run deploy

setup and run the docker server backend

Instructions for running on digitalocean:

Create a new instance of the Ubuntu+docker image.

then ssh in and...

# keep it running
tmux

# need some basics
apt-get update
apt-get install -y build-essential g++

# install and set up nvm and node
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash
source ~/.bashrc

# use node version 4.1
nvm install 4.1
nvm use 4.1

# major dependencies
npm install --global docker-browser-server

# setup docker
docker pull ubuntu
git clone https://github.com/Blahah/command_line_bootcamp.git
cd command_line_bootcamp
docker build -t "command_line_bootcamp" .
docker-browser-server command_line_bootcamp -p 8080

Maintainers

* probably only relevant for maintainers or if you run a public version of this site somewhere else

public docker server backend

If you want to run this on a public site with https enabled then you'll need to setup the websocket backend run run on ssl too (wss://).

  • set up a certificate for the address that points to the backend

  • set up nginx as an ssl terminator and install the new certificates

  • run docker-browser-server on a differnt port so it doesn't conflict with nginx (8000 here)

server {
    listen 8080;
    listen 8443 ssl;
    server_name command-line-bootcamp-backend.alexmorley.me

    # Cloudflare can generate al of these files for you.
    ssl on;
    ssl_certificate         /etc/nginx/ssl/command-line-bootcamp-backend.alexmorley.me/server.pem;
    ssl_certificate_key     /etc/nginx/ssl/command-line-bootcamp-backend.alexmorley.me/server.key;
    ssl_trusted_certificate /etc/nginx/ssl/command-line-bootcamp-backend.alexmorley.me/cloudflare_origin_rsa.pem;

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_http_version 1.1;

        # Need these headers to upgrade http connection to websocket
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;

        # These you might not need
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

cleaning up long-running containers

Sometimes people leave their browser windows open for a really long time. If you don't want to fund the docker container running for that time, you can clean up long-running containers:

docker stop $(docker ps | grep hours | cut -d ' ' -f1 | paste - - - - )

cli-boot.camp's People

Contributors

abremges avatar alexmorley avatar blahah avatar cpursley avatar gedankenstuecke avatar jessicalumian avatar stuntspt 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

cli-boot.camp's Issues

reliance on node v0.12

Hey there,
I wanted to set this thing up for my lab, as we'll teach a class on shell & python next week and would have liked to spare the load to your public instance for the initial shell introduction. So I followed the README.md for setting up the docker backend, but I ran in some trouble with the node 0.12 requirement:

When you use node 0.12 you'll get the following when trying to run docker-browser-server:

/home/bastian/.nvm/versions/node/v0.12.18/lib/node_modules/docker-browser-server/node_modules/ws/index.js:9
const WebSocket = require('./lib/WebSocket');
^^^^^
SyntaxError: Use of const in strict mode.
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/home/bastian/.nvm/versions/node/v0.12.18/lib/node_modules/docker-browser-server/index.js:3:23)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

I think it's because docker-browser-server was significantly updated since the release of the CL Bootcamp and now makes use of much newer versions of all dependencies. Fetching an older version of docker-browser-server didn't help either, largely because all dependencies are listed as . When using the latest node version I can get docker-browser-server to run.

But that doesn't fully help either: I then deployed my fork of the CL bootcamp with the updated address and I can see that docker-browser-server tries starting the container, but immediately kills it again. Any ideas on what the easiest way would be to get a working local copy of the command_line_bootcamp? 😄

Update URL in description

@blahah can you pls update the url in the description to https://alexmorley.me/command_line_bootcamp/?secure=T. If I find time I'll update so it doesn't need the query param but its how it still works on https (and wss) for now.

File browser fails intermittently

There are long windows of time during which if I start a new session, the file browser doesn't work.

Console shows something like:

Failed to load resource: net::ERR_EMPTY_RESPONSE
bundle.js:167 Error: Error: Internal XMLHttpRequest Error(…)onerror @ bundle.js:167

http://46.101.11.144:8080/files/9thqidu2q1uivn29/

However, visiting the address manually gives a sensible JSON response:

[{"path":"/.bash_logout","mountPath":"/home/learner/.bash_logout","type":"file","size":220},{"path":"/.bashrc","mountPath":"/home/learner/.bashrc","type":"file","size":3366},{"path":"/.fs.err","mountPath":"/home/learner/.fs.err","type":"file","size":0},{"path":"/.fs.out","mountPath":"/home/learner/.fs.out","type":"file","size":72},{"path":"/.npm","mountPath":"/home/learner/.npm","type":"directory","size":4096},{"path":"/.nvm","mountPath":"/home/learner/.nvm","type":"directory","size":4096},{"path":"/.profile","mountPath":"/home/learner/.profile","type":"file","size":140},{"path":"/a_directory","mountPath":"/home/learner/a_directory","type":"directory","size":4096},{"path":"/another_directory","mountPath":"/home/learner/another_directory","type":"directory","size":4096}]

This suggests that perhaps the request is happening before the file server is setup.

websocket connection error

Hello,
I've gotten the websocket connection error every time I try to run the bootcamp. Different days and different times, so I'm not sure if it's a traffic issue or something else.

Thanks.

"Shell window" input issues

Just wanted to point out that copy&paste does not work on the command line window, nor does input from mobile browsers (tested on chrome for android and the Ubuntu touch browser).
Not quite sure how to further debug, though.

server down

Getting error: WebSocket connection error. Open DevTools for more information.

"man" command doesn't show much (referenced in page 12)

Hi there!

I've just reached page 12 and tried out the commands and I can see that the examples don't show much information:

learner@:~$ man ls                                                                                  
No manual entry for ls                                                                              
See 'man 7 undocumented' for help when manual pages are not available.                              
learner@:~$ man cd                                                                                  
No manual entry for cd                                                                              
learner@:~$ man man                                                                                 
No manual entry for man                                                                             
See 'man 7 undocumented' for help when manual pages are not available.                              
learner@:~$ man find                                                                                
No manual entry for find                                                                            
See 'man 7 undocumented' for help when manual pages are not available.                              
learner@:~$ man 7 undocumented                                                                      
No manual entry for undocumented in section 7

also from these examples, "cd" and "ls" are usually builtin commands in bash, or other shells and so on linux you probably wouldn't get too much information from "man ls" or "man cd". maybe it would be interesting to show one more command that does usually have a man page before reaching examples for the "man" command?

Remove query parameter requirement when hosted over ssl

At the moment we have to use a query param secure=T to make sure that the websocket uses the wss protocol (ws with ssl). It just needs a quick patch of adventure-time but to allow setting this some other way: https://github.com/maxogden/adventure-time/blob/9d814c6190bc6434c2278b5d3772b8470b6d9321/terminal.js#L14

or we can just add the param ourselves in before that call is made (even easier).

Controlling timeout / unresponsive terminal

Hi. I have set up a command-line bootcamp server (commit: bee2f50) for an online course. I am finding that the terminal pane becomes unresponsive after a while. The setup includes Nginx which proxies the connection to docker-browser-server. I am not using ssl.

Reasoning that a network timeout might be causing the terminal to become unresponsive, I increased proxy_read_timeout setting of Nginx to to 3,600 (1 hr). It helped to an extent. But the terminal pane does not stay responsive for 1 hr (in one test the terminal stayed responsive for ~25 minutes).

I was wondering if I might just be experiencing a 'network blip' causing the websocket connection to drop, or if it is something that can be controlled in the setup. I will try a few other Nginx timeout options, but just wanted to check with you first. A colleague was wondering if docker-browser-server uses ssh to run commands in the docker container and if so the timeout we might be seeing is coming from the ssh server. Do you think that is possible? Anything else I should consider?

Small inconsistencies from a first pass

Recently went through the bootcamp up through page 18 and I have a few tidbits. I'd be happy to PR these if you agree about them.

On page 08, prompt should read “learner@:learning_unix” because location is /home/learner/learning_unix

On page 11, "man cd" gives error “No manual entry for cd” (which I didn't know!). Probably should change the example to something else.

On page 17, "mv temp/riches temp/rags" is at end of page 16, so having it again at top of 17 gives the error that temp/riches doesn't exist

On page 18, there is some weird character encoding on first code block around files earth.txt, heaven.txt, and rags. also, might want to say “type y (for yes, vs n for no) press enter” after every rm: …. ? line. Also, in 17, told to make temp3 and mv into temp. so, rmdir temp2/temp3 doesn’t work because temp2/temp3 doesn’t exist (both temp2 and temp3 are in temp)

WebSocket connection error?

Hi folks,

I tried testing this again today (I've used it as a teaching tool during the first week of my Genomics and Bioinformatics class for the past few years, and it is GREAT!) and I noticed that the little terminal window in the browser says "WebSocket connection error. Open DevTools for more information." The interface doesn't respond when I type simple commands. Is this a bug that was introduced recently, or is this a problem on my end? (Tried this in Chrome, Firefox, and Safari. No dice.)

Thanks so much for putting this together! It's perfect for my students!
Rika

websocket connection error

Hello,

I'm trying to use this command-line bootcamp, but the docker container will not load. It says "WebSocket connection error. Open DevTools for more information."

Am I running it wrong? Do I need to use a different browser? I'm currently in chrome.

Conection error

Hi folks, I've been trying to use the server online, but the console never shows up. I have already tried several times, I think it directly does not respond.

WebSocket connection error

From this week (07 Jan 2019) I've received a websocket error on multiple browsers.

"WebSocket connection error. Open DevTools for more information."

I see this issue has come up before so hopefully it's an easy fix. Love using this tutorial for teaching command line basics!

Connection timeout.

Hi, I have worked my way through the setup instructions however I am unable to connect to the interface, chrome reports

This site can’t be reached IPADDRESS:8080 took too long to respond.

However docker-browser-server command_line_bootcamp -p 8080 is running Server is listening on port 8080

I am unsure if this is an issue with the server I am running it on (centos7), command line bootcamp, or docker-browser-server.

WebSocket connection error

This morning I'm getting "WebSocket connection error. Open DevTools for more information." When I try to use the command-line bootcamp. Is this temporary? I would like to use it for a class today if possible.

move this repo to an organisation

should we move this to an organisation?

This would remove the dependence on me which has been holding back usability when I'm unavailable. And would let you @alexmorley have full powers over the repo, along with anyone else who wants to help.

Thoughts? Suggested name for the org?

Connecting on a Mac

Hello, I am trying to learn command line bootcamp but keep seeing the following notification: "WebSocket connection error. Open DevTools for more information." When I enter in a command, the program does not respond. What do I do?

Question: cpu and memory requirement for ~30 users

Hello. Thanks for creating and maintaining this excellent resource.

I am planning to run a command line bootcamp server on Amazon Web Services for a class of approximately 30 students. I was wondering if know how much CPU and RAM should I allocate for the server. From what I understand, a tiny 1 CPU, 1 GB RAM node should be sufficient for this?

Error message now appearing in terminal pane

Hi this was working fine both on your public page and on my local installation up until last week.
However now the top right pane has this in it:
WebSocket connection error. Open DevTools for more information.
and you can't type in commands.
Has something changed recently?

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.