SlideShare une entreprise Scribd logo
1  sur  46
Télécharger pour lire hors ligne
twitter : @JonJagger
email : jon@jaggersoft.com
blog : http://jonjagger.blogspot.co.uk/
charity : http://cyber-dojo.org
the design and
evolution of
cyber-dojo
Hi. I'm Jon Jagger, a self-employed software consultant. I love fly fishing for salmon fishing. If you hire me and you're near a salmon river I'll reduce my rate!
late 2009(about tea-time)
Late in 2009 I was doing some consultancy in Oslo.
One evening I attended a code dojo being held in the Scotsman pub.
In case you're not familiar with the word, Dojo is the Japanese name for the place where martial artists meet to practice their martial art. So a code dojo is where coders
meet to practice coding.

Uncle Bob was the guest of honour. He selected the battleships coding exercise and also specified the language (I think it was Ruby) and the test framework. There were
about 30 developers - split into 6 teams of 5 people. We then had about 90 mins to code, after which each team would connect their laptop to a projector and show their
work. At least, that was the plan.
Somewhat predictably, most of the groups struggled to connect their laptop to the projector. Quite a lot of time was wasted.
Two groups didn't have much to show as they had spent more than half the time struggling to install the language and test-framework Uncle Bob specified. But
eventually everyone had shown their work and Uncle Bob pronounced one group the winners. Which was a bit strange.
In my hotel room that night I was thinking about the wasted time. Suppose everyone had been working in a shared cloud-based environment? There would have been
nothing to install. Only Bob's laptop would need connecting to the projector. The more I thought about this idea the more I liked it.
At some points in your life there are times where you decide something is worth spending your time on. This was a moment for me. I decided to build an IDE, an
Interactive Dojo Environment.

I rolled my sleeves up and started learning lots of new stuff I'd need. I didn't know any Ruby, HTML, CSS, Rails, Javascript, etc.
https://github.com/cyber-dojo/web
It's called it cyber-dojo.

It's open-sourced on github.

The first commit was in January 2010. 

It's now 2016 and 8888 commits later.

Things don't come into existence instantly!
DEMO
Me demoing USING cyber-dojo.
Cyber-dojo is completely free for non-commercial use.

For commercial use you need to buy a license.
http://blog.cyber-dojo.org/2015/08/cyber-dojo-foundation.html
All license fees go to a registered charity (cyber-dojo Foundation) which buys Raspberry Pi computers for kids.
40,000+ practice-sessions
Of course, even if you're non-commercial, your welcome to make a donation too :-)
VALUE
SYSTEM?
That's a bit about its evolution. Now a bit about its design...
Interactive
Dojo
Environment
Integrated
Development
Environment
• make money
• individual based
• finish focused
• test driven?
• work faster
• time pressure
• don't repeat
• have fun
• team based
• learning focused
• test driven
• work slower
• no time pressure
• repeat
It was clear to me from the beginning that a cloud-based environment designed for coding dojos should be different to a regular development environment....
• team based • individual based
• no login
• anonymity
No login. No username, password. Anonymity is very important. When reviewing we cannot talk about Bert and Ernie's code. We can only talk about the Lion's code.
Bert and Ernie can decide whether or not they want to reveal that they are the Lion.
• learning focused • finish focused
I have come to realise that developers derive enormous value from simply having their steps replayed to them. For example this is a real example from some consulting I
did recently in Bangalore. From the burst of green traffic lights it looks like the koala is refactoring. They are refactoring the duplication out of their tests. Nice. Although,
as another developer pointed out, the use of the word if in the assert helper is a bit dubious.
tests ran
one or more failed
tests ran
all passed
tests did not run
I extend the standard red/green fail/pass colour scheme.

I complete the traffic-light by using amber for cases when the tests do not run (eg syntax error)
{
"visible_filenames": [
"README",
"Hiker.feature",
"Hiker.java",
"HikerStepDef.java",
"RunCukesTest.java",
"cucumber.xml",
"cyber-dojo.sh"
],
"filename_extension" : ".java",
"display_name": "Java, Cucumber-Spring",
"image_name": "cyberdojofoundation/java_cucumber_spring",
"red_amber_green" : [
"lambda { |output|",
" return :red if /FAILURES!!!/.match(output)",
" return :green if /OK ((d*) tests)/.match(output)",
" return :amber",
"}"
]
}
.../Java/Cucumber-Sprint/manifest.json
Determining the red/amber/green static happens in a simple function held in the language+test_framework's manifest. It's typically implemented using simple regular
expression matchers.
One of the things cyber-dojo is very effective at (which I had not anticipated) is how well a short 45 minute practice session can mimic problems normally associated with
large projects typically running for months and years. For example, waterfall development, when stuff is endlessly 90% done and overruns. 

In the above dashboard (from the same trip to Bangalore) note that the two animals with the fewest traffic lights are the frog and the snake. Note the time-gap (left to
right) before their first visible traffic-light, which, almost inevitably, is amber. Note too the burst of ambers following this initial amber as they try to "recover". The frogs
just got to green in time (lucky) but the snakes did not (very typical). Again, inevitably, the snakes ask for a little bit more time! They're almost done, they say. But no.
There is no more time. We are not shipping anything!
Reminder to drink so as not to lose my voice.
How does (and did) it work under the hood?
2010 - No security!
(frequent backups)
In cyber-dojo arbitrary code is written in the browser and run on the server!!!! This has obvious security implications.

Yet the first version had no security. Really!

It was the simplest thing that could possibly work.

I had mostly built cyber-dojo for myself. 

When I used cyber-dojo during paid consultancy I would simply spin up my own personal server.
Initially it was just a bare server with rails installed.
.py
Python
pytest
apt-get update && apt-get install --yes 
libsqlite3-dev 
sqlite3 
bzip2 
libbz2-dev 
wget
wget http://www.python.org/ftp/python/3.3.5/
Python-3.3.5.tar.xz
tar xJf ./Python-3.3.5.tar.xz
cd ./Python-3.3.5 && ./configure --prefix=/opt/
python3.3
cd ./Python-3.3.5 && make
cd ./Python-3.3.5 && make install
ln -s /opt/python3.3/bin/python3.3 /bin/python
apt-get update && apt-get install -y 
python-pip
pip install -U pytest
Python
pytest
It really was just the server. For example, to support Python using pytest (on the browser), then Python and pytest had to be installed on the server.
.py
.py
Python
pytest
Python
pytest
When the dev hit the test button on the browser the source files were copied on to the hard-disk of the server and run directly on the server! There was no security. No
chroot. Nothing!
$ cd /
$ rm -rf *
2013
This worked fine for several years on the public cyber-dojo.org server until one day someone ran the above code! They sent me a nice email saying how sorry they were,
that they had just assumed it wouldn't work!!

It was an ex server.
0.3
I looked for ways to provide security. A new, little known (at that time) technology called Docker caught my eye. It was at about 0.3 then. Docker went open source in
March of 2013.
FROM cyberdojofoundation/build-essential
MAINTAINER Jon Jagger <jon@jaggersoft.com>
RUN apt-get update && apt-get install --yes 
libsqlite3-dev 
sqlite3 
bzip2 
libbz2-dev 
wget
RUN wget http://www.python.org/ftp/python/3.3.5/Python-3.3.5.tar.xz
RUN tar xJf ./Python-3.3.5.tar.xz
RUN cd ./Python-3.3.5 && ./configure --prefix=/opt/python3.3
RUN cd ./Python-3.3.5 && make
RUN cd ./Python-3.3.5 && make install
RUN ln -s /opt/python3.3/bin/python3.3 /bin/python
RUN apt-get update && apt-get install -y 
python-pip
RUN pip install -U pytest
Dockerfile
Now the commands to install Python and pytest go into a file called Dockerfile.
cyberdojo/python_pytest
$ docker build -t cyberdojo/python_pytest .
FROM cyberdojofoundation/build-
essential
MAINTAINER Jon Jagger <jon@jaggersoft.com>
RUN apt-get update && apt-get install --yes

libsqlite3-dev 
sqlite3 
bzip2 
libbz2-dev 
wget
RUN wget http://www.python.org/ftp/python/
3.3.5/Python-3.3.5.tar.xz
RUN tar xJf ./Python-3.3.5.tar.xz
RUN cd ./Python-3.3.5 && ./configure --
prefix=/opt/python3.3
RUN cd ./Python-3.3.5 && make
RUN cd ./Python-3.3.5 && make install
RUN ln -s /opt/python3.3/bin/python3.3 /bin/
python
RUN apt-get update && apt-get install -y 
python-pip
RUN pip install -U pytest
Dockerfile
Then, on a system with docker installed, you build your named docker image from the Dockerfile.

You've then got your image.
cyberdojo/python_pytest
.py .py
Python
pytest
Every time the dev presses the test button in the browser, the rails server spins up a docker-container from the appropriate docker-image (in this case the one for python
+pytest), copies the files into the container, and runs the test inside the container, grabs the output, and then destroys the container (but not the image). Creating a new
container from an image is almost instantaneous!!
The images for the 50+ language&test_framework combinations offered on the setup page are all stored on the docker hub and can be pulled freely by anyone who has
installed docker.
more animals!
2015
At first there were only 16 animals. Several people asked to be able to run practice sessions with a hundred or so participants and 16 was not enough. I needed more
animal images! My friend Dymtro Mindra paid a professional artist (Nadya Sivers) to draw 64 new images. Aren't they great :-)
setting up
your own
server was
lengthy and
error-prone
The biggest remaining problem was for people who wanted to run their own servers. Installing the rails server was lengthy and error prone.
cyberdojo/python_pytest
.py cyberdojo/web
.py
Python
pytest
So I put the rails server into a docker image as well! 

(While I was at I put an nginx front end on too.)
cyberdojo/python_pytest
.py cyberdojo/web:1.12.1
.py
Python
pytest
1.12.1
Eagle eyed readers will spot there is a problem putting the rails server inside a docker image. The rails server issues docker commands to run the tests submitted from
the browser. But docker is installed on the server, not inside the image holding the rails server!

So I also had to install docker inside the web image. This is sometimes called docker-in-docker. This creates a version dependency. The version of docker installed on the
server (which spins up the web container) must match the version of docker installed inside the web container (which spins up the python_pytest container).

Now installation is mostly installing docker and pulling the pre-built cyber-dojo docker images.
FROM cyberdojo/user-base
MAINTAINER Jon Jagger <jon@jaggersoft.com>
...
USER root
RUN apk --update add 
ruby ruby-irb ruby-io-console ruby-bigdecimal tzdata 
bash
ARG CYBER_DOJO_HOME
USER root
RUN mkdir -p ${CYBER_DOJO_HOME}
COPY Gemfile ${CYBER_DOJO_HOME}
RUN apk --update 
add --virtual build-dependencies 
build-base 
ruby-dev 
openssl-dev 
postgresql-dev 
libc-dev 
linux-headers 
&& gem install bundler --no-ri --no-rdoc 
&& cd ${CYBER_DOJO_HOME} ; bundle install --without development test 
&& apk del build-dependencies
...
Dockerfile
cyberdojo/web:1.12.1
docker
build
Here's part of the Dockerfile for the cyber-dojo web image. It shows the commands to install ruby and setup the rails server.
FROM cyberdojo/user-base
MAINTAINER Jon Jagger <jon@jaggersoft.com>
...
ARG DOCKER_VERSION
USER root
RUN apk --update add curl 
&& curl -OL https://get.docker.com/builds/Linux/x86_64/
docker-${DOCKER_VERSION}.tgz 
&& tar -xvzf docker-${DOCKER_VERSION}.tgz 
&& mv docker/* /usr/bin/ 
&& rmdir /docker 
&& rm /docker-${DOCKER_VERSION}.tgz 
&& apk del curl
...
Dockerfile
cyberdojo/web:1.12.1
docker
build
Here's part of the Dockerfile for the cyber-dojo web image. It shows the commands to install docker!
A bit about testing.
#!/bin/sh
set -e
my_dir="$( cd "$( dirname "${0}" )" && pwd )"
cd ${my_dir}/../docker/web-base
./build-image.sh
cd ${my_dir}/../docker/web
./build-image.sh
cd ${my_dir}/../cli
./cyber-dojo down
./cyber-dojo start-point ls --quiet | grep 'languages' && ./cyber-dojo start-point rm languages
./cyber-dojo start-point ls --quiet | grep 'exercises' && ./cyber-dojo start-point rm exercises
./cyber-dojo start-point ls --quiet | grep 'custom' && ./cyber-dojo start-point rm custom
./cyber-dojo start-point ls
./cyber-dojo start-point create languages --dir=./../../start-points-languages
./cyber-dojo start-point create exercises --dir=./../../start-points-exercises
./cyber-dojo start-point create custom --dir=./../../start-points-custom
./cyber-dojo start-point ls
./cyber-dojo up
cid=`docker ps --all --quiet --filter "name=cyber-dojo-web"`
docker exec ${cid} sh -c "cd test && ./run.sh"
done=$?
exit $done
test/build_and_run.sh
I have rails installed locally on my macbook. However, I do not run the tests locally. That would be simple, but it would be a trap. This is because the code being tested
would not be running inside a docker container. Yet when the code really runs (after being deployed) it always runs inside a docker container. So instead I run a script
which rebuilds the docker web image, starts a new web container, shells into this container, and runs the tests.
...
env:
global:
- DOCKER_ENGINE_VERSION=1.12.1
- DOCKER_COMPOSE_VERSION=1.8.0
- DOCKER_DIR=${TRAVIS_BUILD_DIR}/docker
before_install:
# list docker-engine versions
- apt-cache madison docker-engine
# install specific version of docker-engine
# install specific version of docker-compose
...
.travis.yml
github has an excellent feature whereby every commit can trigger a Travis continuous integration (CI) pipeline. I use this on the cyber-dojo web repo. The script github
runs installs specific versions of docker and docker-related tools...
...
script:
# Build the cyber-dojo web image
- cd ${DOCKER_DIR}/web
- ./build-image.sh ${DOCKER_ENGINE_VERSION}
- cd ${TRAVIS_BUILD_DIR}/cli
- ./cyber-dojo up
- cid=`docker ps --all --quiet --filter "name=cyber-dojo-web"`
- docker logs cyber-dojo-web
- docker inspect -f {{.State.Running}} ${cid}
- docker ps -a
- docker pull cyberdojofoundation/gcc_assert:latest
- docker pull cyberdojofoundation/ruby_test_unit:latest
.travis.yml
- docker exec ${cid} sh -c "cd test && ./run.sh"
...and then builds the web image, starts a new web container, shells into this container, and runs the tests. Just like when I run the tests myself :-)
Here's an example of the output you get from travis CI when the tests are run inside the docker container.
This is the dashboard for the Travis Continuous Integration. The various github repos are listed on the left. On the right are results from recent commits on the selected
github repo (web).
thank yous
Byran Wills-Heath Nadya Sivers Seb Rose
Olve Maudal Dymtro Mindra Mike Long
A big thank you also to these people who have all helped with cyber-dojo in various ways.
twitter : @JonJagger
email : jon@jaggersoft.com
blog : http://jonjagger.blogspot.co.uk/
charity : http://cyber-dojo.org
that's all
folks
That's it. Thanks for listening. I hope I've sowed a few seeds. Have a great conference.

Contenu connexe

En vedette

Cyber-dojo: How to perform deliberate practice
Cyber-dojo: How to perform deliberate practiceCyber-dojo: How to perform deliberate practice
Cyber-dojo: How to perform deliberate practiceJon Jagger
 
Cергей Зеленин. Aлександр Баглай "Tetris coding dojo"
Cергей Зеленин. Aлександр Баглай "Tetris coding dojo"Cергей Зеленин. Aлександр Баглай "Tetris coding dojo"
Cергей Зеленин. Aлександр Баглай "Tetris coding dojo"Oleksandr Baglai
 
Lessons from Testing
Lessons from TestingLessons from Testing
Lessons from TestingJon Jagger
 
Atlantec - tdd lessons
Atlantec - tdd lessonsAtlantec - tdd lessons
Atlantec - tdd lessonsJon Jagger
 
22,5 Mobile Statistics in 45 Minutes (2012)
22,5 Mobile Statistics in 45 Minutes (2012)22,5 Mobile Statistics in 45 Minutes (2012)
22,5 Mobile Statistics in 45 Minutes (2012)Lars Brücher
 
Startup Passion Smack-Down SXSW 2012
Startup Passion Smack-Down SXSW 2012Startup Passion Smack-Down SXSW 2012
Startup Passion Smack-Down SXSW 2012John Bradberry
 
Too Busy To Do Good Work
Too Busy To Do Good WorkToo Busy To Do Good Work
Too Busy To Do Good WorkMTurek
 
Intentionally dealing with responsive design
Intentionally dealing with responsive designIntentionally dealing with responsive design
Intentionally dealing with responsive designeveryplace
 
Marta Turek: Too Busy to do Good Work- MozCon 2015
Marta Turek: Too Busy to do Good Work- MozCon 2015Marta Turek: Too Busy to do Good Work- MozCon 2015
Marta Turek: Too Busy to do Good Work- MozCon 2015Erica Lewis
 
Agile Start Me Up - Using the Minimum Viable Discovery (MVD)
Agile Start Me Up - Using the Minimum Viable Discovery (MVD)Agile Start Me Up - Using the Minimum Viable Discovery (MVD)
Agile Start Me Up - Using the Minimum Viable Discovery (MVD)Chris Chan
 
Five Steps to a More Agile Organization
Five Steps to a More Agile OrganizationFive Steps to a More Agile Organization
Five Steps to a More Agile OrganizationLitheSpeed
 
Great functional testing with WebDriver and Thucydides
Great functional testing with WebDriver and ThucydidesGreat functional testing with WebDriver and Thucydides
Great functional testing with WebDriver and ThucydidesMikalai Alimenkou
 
Lean Discovery - Scrum Australia 2016
Lean Discovery - Scrum Australia 2016Lean Discovery - Scrum Australia 2016
Lean Discovery - Scrum Australia 2016Chris Chan
 
Pirate Metrics
Pirate MetricsPirate Metrics
Pirate MetricsChris Chan
 
Agile testing to build the right thing
Agile testing to build the right thingAgile testing to build the right thing
Agile testing to build the right thingAgileDenver
 
Thucydides – next generation acceptance testing with WebDriver
Thucydides – next generation acceptance testing with WebDriverThucydides – next generation acceptance testing with WebDriver
Thucydides – next generation acceptance testing with WebDriverMikalai Alimenkou
 
Anti-fragile: how to thrive in extremistan
Anti-fragile: how to thrive in extremistanAnti-fragile: how to thrive in extremistan
Anti-fragile: how to thrive in extremistanOliver Damian
 

En vedette (20)

Cyber-dojo: How to perform deliberate practice
Cyber-dojo: How to perform deliberate practiceCyber-dojo: How to perform deliberate practice
Cyber-dojo: How to perform deliberate practice
 
Cергей Зеленин. Aлександр Баглай "Tetris coding dojo"
Cергей Зеленин. Aлександр Баглай "Tetris coding dojo"Cергей Зеленин. Aлександр Баглай "Tetris coding dojo"
Cергей Зеленин. Aлександр Баглай "Tetris coding dojo"
 
Lessons from Testing
Lessons from TestingLessons from Testing
Lessons from Testing
 
Atlantec - tdd lessons
Atlantec - tdd lessonsAtlantec - tdd lessons
Atlantec - tdd lessons
 
XP
XPXP
XP
 
22,5 Mobile Statistics in 45 Minutes (2012)
22,5 Mobile Statistics in 45 Minutes (2012)22,5 Mobile Statistics in 45 Minutes (2012)
22,5 Mobile Statistics in 45 Minutes (2012)
 
Startup Passion Smack-Down SXSW 2012
Startup Passion Smack-Down SXSW 2012Startup Passion Smack-Down SXSW 2012
Startup Passion Smack-Down SXSW 2012
 
Too Busy To Do Good Work
Too Busy To Do Good WorkToo Busy To Do Good Work
Too Busy To Do Good Work
 
Intentionally dealing with responsive design
Intentionally dealing with responsive designIntentionally dealing with responsive design
Intentionally dealing with responsive design
 
Marta Turek: Too Busy to do Good Work- MozCon 2015
Marta Turek: Too Busy to do Good Work- MozCon 2015Marta Turek: Too Busy to do Good Work- MozCon 2015
Marta Turek: Too Busy to do Good Work- MozCon 2015
 
Agile Start Me Up - Using the Minimum Viable Discovery (MVD)
Agile Start Me Up - Using the Minimum Viable Discovery (MVD)Agile Start Me Up - Using the Minimum Viable Discovery (MVD)
Agile Start Me Up - Using the Minimum Viable Discovery (MVD)
 
Five Steps to a More Agile Organization
Five Steps to a More Agile OrganizationFive Steps to a More Agile Organization
Five Steps to a More Agile Organization
 
Agile Evolution
Agile EvolutionAgile Evolution
Agile Evolution
 
Great functional testing with WebDriver and Thucydides
Great functional testing with WebDriver and ThucydidesGreat functional testing with WebDriver and Thucydides
Great functional testing with WebDriver and Thucydides
 
Lean Discovery - Scrum Australia 2016
Lean Discovery - Scrum Australia 2016Lean Discovery - Scrum Australia 2016
Lean Discovery - Scrum Australia 2016
 
Pirate Metrics
Pirate MetricsPirate Metrics
Pirate Metrics
 
Agile testing to build the right thing
Agile testing to build the right thingAgile testing to build the right thing
Agile testing to build the right thing
 
Why testing take so long
Why testing take so longWhy testing take so long
Why testing take so long
 
Thucydides – next generation acceptance testing with WebDriver
Thucydides – next generation acceptance testing with WebDriverThucydides – next generation acceptance testing with WebDriver
Thucydides – next generation acceptance testing with WebDriver
 
Anti-fragile: how to thrive in extremistan
Anti-fragile: how to thrive in extremistanAnti-fragile: how to thrive in extremistan
Anti-fragile: how to thrive in extremistan
 

Similaire à Design and Evolution of cyber-dojo

Spring, CDI, Jakarta EE good parts
Spring, CDI, Jakarta EE good partsSpring, CDI, Jakarta EE good parts
Spring, CDI, Jakarta EE good partsJarek Ratajski
 
Python 3 Intro Presentation for NEWLUG
Python 3 Intro Presentation for NEWLUGPython 3 Intro Presentation for NEWLUG
Python 3 Intro Presentation for NEWLUGNEWLUG
 
A quick overview of why to use and how to set up iPython notebooks for research
A quick overview of why to use and how to set up iPython notebooks for researchA quick overview of why to use and how to set up iPython notebooks for research
A quick overview of why to use and how to set up iPython notebooks for researchAdam Pah
 
Infrastructure as code might be literally impossible
Infrastructure as code might be literally impossibleInfrastructure as code might be literally impossible
Infrastructure as code might be literally impossibleice799
 
Github github-github
Github github-githubGithub github-github
Github github-githubfusion2011
 
Django dev-env-my-way
Django dev-env-my-wayDjango dev-env-my-way
Django dev-env-my-wayRobert Lujo
 
Boxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of LaptopsBoxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of LaptopsPuppet
 
Introduction to Programming in Go
Introduction to Programming in GoIntroduction to Programming in Go
Introduction to Programming in GoAmr Hassan
 
PHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in phpPHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in phpAhmed Abdou
 
Docker experience @inbotapp
Docker experience @inbotappDocker experience @inbotapp
Docker experience @inbotappJilles van Gurp
 
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...Baruch Sadogursky
 
Fullstack Academy - Awesome Web Dev Tips & Tricks
Fullstack Academy - Awesome Web Dev Tips & TricksFullstack Academy - Awesome Web Dev Tips & Tricks
Fullstack Academy - Awesome Web Dev Tips & TricksFrances Coronel
 
Docker Container Lifecycles, Problem or Opportunity? by Baruch Sadogursky, JFrog
Docker Container Lifecycles, Problem or Opportunity? by Baruch Sadogursky, JFrogDocker Container Lifecycles, Problem or Opportunity? by Baruch Sadogursky, JFrog
Docker Container Lifecycles, Problem or Opportunity? by Baruch Sadogursky, JFrogDocker, Inc.
 
Infrastructure as code might be literally impossible / Joe Domato (packageclo...
Infrastructure as code might be literally impossible / Joe Domato (packageclo...Infrastructure as code might be literally impossible / Joe Domato (packageclo...
Infrastructure as code might be literally impossible / Joe Domato (packageclo...Ontico
 
Androides y Mazmorras. Part I (dungeons & robots)
Androides y Mazmorras. Part I (dungeons & robots)Androides y Mazmorras. Part I (dungeons & robots)
Androides y Mazmorras. Part I (dungeons & robots)Jorge Barroso
 

Similaire à Design and Evolution of cyber-dojo (20)

Python overview
Python overviewPython overview
Python overview
 
Introduce Django
Introduce DjangoIntroduce Django
Introduce Django
 
Spring, CDI, Jakarta EE good parts
Spring, CDI, Jakarta EE good partsSpring, CDI, Jakarta EE good parts
Spring, CDI, Jakarta EE good parts
 
Python 3 Intro Presentation for NEWLUG
Python 3 Intro Presentation for NEWLUGPython 3 Intro Presentation for NEWLUG
Python 3 Intro Presentation for NEWLUG
 
A quick overview of why to use and how to set up iPython notebooks for research
A quick overview of why to use and how to set up iPython notebooks for researchA quick overview of why to use and how to set up iPython notebooks for research
A quick overview of why to use and how to set up iPython notebooks for research
 
Infrastructure as code might be literally impossible
Infrastructure as code might be literally impossibleInfrastructure as code might be literally impossible
Infrastructure as code might be literally impossible
 
12 tricks to avoid hackers breaks your CI / CD
12 tricks to avoid hackers breaks your  CI / CD12 tricks to avoid hackers breaks your  CI / CD
12 tricks to avoid hackers breaks your CI / CD
 
Github github-github
Github github-githubGithub github-github
Github github-github
 
Django dev-env-my-way
Django dev-env-my-wayDjango dev-env-my-way
Django dev-env-my-way
 
Automate Yo' Self
Automate Yo' SelfAutomate Yo' Self
Automate Yo' Self
 
Boxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of LaptopsBoxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of Laptops
 
Introduction to Programming in Go
Introduction to Programming in GoIntroduction to Programming in Go
Introduction to Programming in Go
 
Sonatype DevSecOps Leadership forum 2020
Sonatype DevSecOps Leadership forum 2020Sonatype DevSecOps Leadership forum 2020
Sonatype DevSecOps Leadership forum 2020
 
PHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in phpPHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in php
 
Docker experience @inbotapp
Docker experience @inbotappDocker experience @inbotapp
Docker experience @inbotapp
 
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
 
Fullstack Academy - Awesome Web Dev Tips & Tricks
Fullstack Academy - Awesome Web Dev Tips & TricksFullstack Academy - Awesome Web Dev Tips & Tricks
Fullstack Academy - Awesome Web Dev Tips & Tricks
 
Docker Container Lifecycles, Problem or Opportunity? by Baruch Sadogursky, JFrog
Docker Container Lifecycles, Problem or Opportunity? by Baruch Sadogursky, JFrogDocker Container Lifecycles, Problem or Opportunity? by Baruch Sadogursky, JFrog
Docker Container Lifecycles, Problem or Opportunity? by Baruch Sadogursky, JFrog
 
Infrastructure as code might be literally impossible / Joe Domato (packageclo...
Infrastructure as code might be literally impossible / Joe Domato (packageclo...Infrastructure as code might be literally impossible / Joe Domato (packageclo...
Infrastructure as code might be literally impossible / Joe Domato (packageclo...
 
Androides y Mazmorras. Part I (dungeons & robots)
Androides y Mazmorras. Part I (dungeons & robots)Androides y Mazmorras. Part I (dungeons & robots)
Androides y Mazmorras. Part I (dungeons & robots)
 

Plus de Jon Jagger

NorDevCon 2016 pair programming
NorDevCon 2016 pair programmingNorDevCon 2016 pair programming
NorDevCon 2016 pair programmingJon Jagger
 
Pair programming
Pair programmingPair programming
Pair programmingJon Jagger
 
lessons from testing
lessons from testinglessons from testing
lessons from testingJon Jagger
 
Systems thinking
Systems thinkingSystems thinking
Systems thinkingJon Jagger
 
Kanban Push-me Pull-you
Kanban Push-me Pull-youKanban Push-me Pull-you
Kanban Push-me Pull-youJon Jagger
 
Larry and Jen do Roman Numerals in C++
Larry and Jen do Roman Numerals in C++Larry and Jen do Roman Numerals in C++
Larry and Jen do Roman Numerals in C++Jon Jagger
 
Some stuff about C++ and development
Some stuff about C++ and developmentSome stuff about C++ and development
Some stuff about C++ and developmentJon Jagger
 
Systems Thinking
Systems ThinkingSystems Thinking
Systems ThinkingJon Jagger
 
An Agile A to Z
An Agile A to ZAn Agile A to Z
An Agile A to ZJon Jagger
 

Plus de Jon Jagger (9)

NorDevCon 2016 pair programming
NorDevCon 2016 pair programmingNorDevCon 2016 pair programming
NorDevCon 2016 pair programming
 
Pair programming
Pair programmingPair programming
Pair programming
 
lessons from testing
lessons from testinglessons from testing
lessons from testing
 
Systems thinking
Systems thinkingSystems thinking
Systems thinking
 
Kanban Push-me Pull-you
Kanban Push-me Pull-youKanban Push-me Pull-you
Kanban Push-me Pull-you
 
Larry and Jen do Roman Numerals in C++
Larry and Jen do Roman Numerals in C++Larry and Jen do Roman Numerals in C++
Larry and Jen do Roman Numerals in C++
 
Some stuff about C++ and development
Some stuff about C++ and developmentSome stuff about C++ and development
Some stuff about C++ and development
 
Systems Thinking
Systems ThinkingSystems Thinking
Systems Thinking
 
An Agile A to Z
An Agile A to ZAn Agile A to Z
An Agile A to Z
 

Dernier

Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 

Dernier (20)

Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 

Design and Evolution of cyber-dojo

  • 1. twitter : @JonJagger email : jon@jaggersoft.com blog : http://jonjagger.blogspot.co.uk/ charity : http://cyber-dojo.org the design and evolution of cyber-dojo Hi. I'm Jon Jagger, a self-employed software consultant. I love fly fishing for salmon fishing. If you hire me and you're near a salmon river I'll reduce my rate!
  • 2. late 2009(about tea-time) Late in 2009 I was doing some consultancy in Oslo.
  • 3. One evening I attended a code dojo being held in the Scotsman pub.
  • 4. In case you're not familiar with the word, Dojo is the Japanese name for the place where martial artists meet to practice their martial art. So a code dojo is where coders meet to practice coding. Uncle Bob was the guest of honour. He selected the battleships coding exercise and also specified the language (I think it was Ruby) and the test framework. There were about 30 developers - split into 6 teams of 5 people. We then had about 90 mins to code, after which each team would connect their laptop to a projector and show their work. At least, that was the plan.
  • 5. Somewhat predictably, most of the groups struggled to connect their laptop to the projector. Quite a lot of time was wasted.
  • 6. Two groups didn't have much to show as they had spent more than half the time struggling to install the language and test-framework Uncle Bob specified. But eventually everyone had shown their work and Uncle Bob pronounced one group the winners. Which was a bit strange.
  • 7. In my hotel room that night I was thinking about the wasted time. Suppose everyone had been working in a shared cloud-based environment? There would have been nothing to install. Only Bob's laptop would need connecting to the projector. The more I thought about this idea the more I liked it.
  • 8. At some points in your life there are times where you decide something is worth spending your time on. This was a moment for me. I decided to build an IDE, an Interactive Dojo Environment. I rolled my sleeves up and started learning lots of new stuff I'd need. I didn't know any Ruby, HTML, CSS, Rails, Javascript, etc.
  • 9. https://github.com/cyber-dojo/web It's called it cyber-dojo. It's open-sourced on github. The first commit was in January 2010. It's now 2016 and 8888 commits later. Things don't come into existence instantly!
  • 10. DEMO Me demoing USING cyber-dojo.
  • 11. Cyber-dojo is completely free for non-commercial use. For commercial use you need to buy a license.
  • 12. http://blog.cyber-dojo.org/2015/08/cyber-dojo-foundation.html All license fees go to a registered charity (cyber-dojo Foundation) which buys Raspberry Pi computers for kids.
  • 13. 40,000+ practice-sessions Of course, even if you're non-commercial, your welcome to make a donation too :-)
  • 14. VALUE SYSTEM? That's a bit about its evolution. Now a bit about its design...
  • 15. Interactive Dojo Environment Integrated Development Environment • make money • individual based • finish focused • test driven? • work faster • time pressure • don't repeat • have fun • team based • learning focused • test driven • work slower • no time pressure • repeat It was clear to me from the beginning that a cloud-based environment designed for coding dojos should be different to a regular development environment....
  • 16. • team based • individual based • no login • anonymity No login. No username, password. Anonymity is very important. When reviewing we cannot talk about Bert and Ernie's code. We can only talk about the Lion's code. Bert and Ernie can decide whether or not they want to reveal that they are the Lion.
  • 17. • learning focused • finish focused I have come to realise that developers derive enormous value from simply having their steps replayed to them. For example this is a real example from some consulting I did recently in Bangalore. From the burst of green traffic lights it looks like the koala is refactoring. They are refactoring the duplication out of their tests. Nice. Although, as another developer pointed out, the use of the word if in the assert helper is a bit dubious.
  • 18. tests ran one or more failed tests ran all passed tests did not run I extend the standard red/green fail/pass colour scheme. I complete the traffic-light by using amber for cases when the tests do not run (eg syntax error)
  • 19. { "visible_filenames": [ "README", "Hiker.feature", "Hiker.java", "HikerStepDef.java", "RunCukesTest.java", "cucumber.xml", "cyber-dojo.sh" ], "filename_extension" : ".java", "display_name": "Java, Cucumber-Spring", "image_name": "cyberdojofoundation/java_cucumber_spring", "red_amber_green" : [ "lambda { |output|", " return :red if /FAILURES!!!/.match(output)", " return :green if /OK ((d*) tests)/.match(output)", " return :amber", "}" ] } .../Java/Cucumber-Sprint/manifest.json Determining the red/amber/green static happens in a simple function held in the language+test_framework's manifest. It's typically implemented using simple regular expression matchers.
  • 20. One of the things cyber-dojo is very effective at (which I had not anticipated) is how well a short 45 minute practice session can mimic problems normally associated with large projects typically running for months and years. For example, waterfall development, when stuff is endlessly 90% done and overruns. In the above dashboard (from the same trip to Bangalore) note that the two animals with the fewest traffic lights are the frog and the snake. Note the time-gap (left to right) before their first visible traffic-light, which, almost inevitably, is amber. Note too the burst of ambers following this initial amber as they try to "recover". The frogs just got to green in time (lucky) but the snakes did not (very typical). Again, inevitably, the snakes ask for a little bit more time! They're almost done, they say. But no. There is no more time. We are not shipping anything!
  • 21. Reminder to drink so as not to lose my voice.
  • 22. How does (and did) it work under the hood?
  • 23. 2010 - No security! (frequent backups) In cyber-dojo arbitrary code is written in the browser and run on the server!!!! This has obvious security implications. Yet the first version had no security. Really! It was the simplest thing that could possibly work. I had mostly built cyber-dojo for myself. When I used cyber-dojo during paid consultancy I would simply spin up my own personal server.
  • 24. Initially it was just a bare server with rails installed.
  • 25. .py Python pytest apt-get update && apt-get install --yes libsqlite3-dev sqlite3 bzip2 libbz2-dev wget wget http://www.python.org/ftp/python/3.3.5/ Python-3.3.5.tar.xz tar xJf ./Python-3.3.5.tar.xz cd ./Python-3.3.5 && ./configure --prefix=/opt/ python3.3 cd ./Python-3.3.5 && make cd ./Python-3.3.5 && make install ln -s /opt/python3.3/bin/python3.3 /bin/python apt-get update && apt-get install -y python-pip pip install -U pytest Python pytest It really was just the server. For example, to support Python using pytest (on the browser), then Python and pytest had to be installed on the server.
  • 26. .py .py Python pytest Python pytest When the dev hit the test button on the browser the source files were copied on to the hard-disk of the server and run directly on the server! There was no security. No chroot. Nothing!
  • 27. $ cd / $ rm -rf * 2013 This worked fine for several years on the public cyber-dojo.org server until one day someone ran the above code! They sent me a nice email saying how sorry they were, that they had just assumed it wouldn't work!! It was an ex server.
  • 28. 0.3 I looked for ways to provide security. A new, little known (at that time) technology called Docker caught my eye. It was at about 0.3 then. Docker went open source in March of 2013.
  • 29. FROM cyberdojofoundation/build-essential MAINTAINER Jon Jagger <jon@jaggersoft.com> RUN apt-get update && apt-get install --yes libsqlite3-dev sqlite3 bzip2 libbz2-dev wget RUN wget http://www.python.org/ftp/python/3.3.5/Python-3.3.5.tar.xz RUN tar xJf ./Python-3.3.5.tar.xz RUN cd ./Python-3.3.5 && ./configure --prefix=/opt/python3.3 RUN cd ./Python-3.3.5 && make RUN cd ./Python-3.3.5 && make install RUN ln -s /opt/python3.3/bin/python3.3 /bin/python RUN apt-get update && apt-get install -y python-pip RUN pip install -U pytest Dockerfile Now the commands to install Python and pytest go into a file called Dockerfile.
  • 30. cyberdojo/python_pytest $ docker build -t cyberdojo/python_pytest . FROM cyberdojofoundation/build- essential MAINTAINER Jon Jagger <jon@jaggersoft.com> RUN apt-get update && apt-get install --yes libsqlite3-dev sqlite3 bzip2 libbz2-dev wget RUN wget http://www.python.org/ftp/python/ 3.3.5/Python-3.3.5.tar.xz RUN tar xJf ./Python-3.3.5.tar.xz RUN cd ./Python-3.3.5 && ./configure -- prefix=/opt/python3.3 RUN cd ./Python-3.3.5 && make RUN cd ./Python-3.3.5 && make install RUN ln -s /opt/python3.3/bin/python3.3 /bin/ python RUN apt-get update && apt-get install -y python-pip RUN pip install -U pytest Dockerfile Then, on a system with docker installed, you build your named docker image from the Dockerfile. You've then got your image.
  • 31. cyberdojo/python_pytest .py .py Python pytest Every time the dev presses the test button in the browser, the rails server spins up a docker-container from the appropriate docker-image (in this case the one for python +pytest), copies the files into the container, and runs the test inside the container, grabs the output, and then destroys the container (but not the image). Creating a new container from an image is almost instantaneous!!
  • 32. The images for the 50+ language&test_framework combinations offered on the setup page are all stored on the docker hub and can be pulled freely by anyone who has installed docker.
  • 33. more animals! 2015 At first there were only 16 animals. Several people asked to be able to run practice sessions with a hundred or so participants and 16 was not enough. I needed more animal images! My friend Dymtro Mindra paid a professional artist (Nadya Sivers) to draw 64 new images. Aren't they great :-)
  • 34. setting up your own server was lengthy and error-prone The biggest remaining problem was for people who wanted to run their own servers. Installing the rails server was lengthy and error prone.
  • 35. cyberdojo/python_pytest .py cyberdojo/web .py Python pytest So I put the rails server into a docker image as well! (While I was at I put an nginx front end on too.)
  • 36. cyberdojo/python_pytest .py cyberdojo/web:1.12.1 .py Python pytest 1.12.1 Eagle eyed readers will spot there is a problem putting the rails server inside a docker image. The rails server issues docker commands to run the tests submitted from the browser. But docker is installed on the server, not inside the image holding the rails server! So I also had to install docker inside the web image. This is sometimes called docker-in-docker. This creates a version dependency. The version of docker installed on the server (which spins up the web container) must match the version of docker installed inside the web container (which spins up the python_pytest container). Now installation is mostly installing docker and pulling the pre-built cyber-dojo docker images.
  • 37. FROM cyberdojo/user-base MAINTAINER Jon Jagger <jon@jaggersoft.com> ... USER root RUN apk --update add ruby ruby-irb ruby-io-console ruby-bigdecimal tzdata bash ARG CYBER_DOJO_HOME USER root RUN mkdir -p ${CYBER_DOJO_HOME} COPY Gemfile ${CYBER_DOJO_HOME} RUN apk --update add --virtual build-dependencies build-base ruby-dev openssl-dev postgresql-dev libc-dev linux-headers && gem install bundler --no-ri --no-rdoc && cd ${CYBER_DOJO_HOME} ; bundle install --without development test && apk del build-dependencies ... Dockerfile cyberdojo/web:1.12.1 docker build Here's part of the Dockerfile for the cyber-dojo web image. It shows the commands to install ruby and setup the rails server.
  • 38. FROM cyberdojo/user-base MAINTAINER Jon Jagger <jon@jaggersoft.com> ... ARG DOCKER_VERSION USER root RUN apk --update add curl && curl -OL https://get.docker.com/builds/Linux/x86_64/ docker-${DOCKER_VERSION}.tgz && tar -xvzf docker-${DOCKER_VERSION}.tgz && mv docker/* /usr/bin/ && rmdir /docker && rm /docker-${DOCKER_VERSION}.tgz && apk del curl ... Dockerfile cyberdojo/web:1.12.1 docker build Here's part of the Dockerfile for the cyber-dojo web image. It shows the commands to install docker!
  • 39. A bit about testing.
  • 40. #!/bin/sh set -e my_dir="$( cd "$( dirname "${0}" )" && pwd )" cd ${my_dir}/../docker/web-base ./build-image.sh cd ${my_dir}/../docker/web ./build-image.sh cd ${my_dir}/../cli ./cyber-dojo down ./cyber-dojo start-point ls --quiet | grep 'languages' && ./cyber-dojo start-point rm languages ./cyber-dojo start-point ls --quiet | grep 'exercises' && ./cyber-dojo start-point rm exercises ./cyber-dojo start-point ls --quiet | grep 'custom' && ./cyber-dojo start-point rm custom ./cyber-dojo start-point ls ./cyber-dojo start-point create languages --dir=./../../start-points-languages ./cyber-dojo start-point create exercises --dir=./../../start-points-exercises ./cyber-dojo start-point create custom --dir=./../../start-points-custom ./cyber-dojo start-point ls ./cyber-dojo up cid=`docker ps --all --quiet --filter "name=cyber-dojo-web"` docker exec ${cid} sh -c "cd test && ./run.sh" done=$? exit $done test/build_and_run.sh I have rails installed locally on my macbook. However, I do not run the tests locally. That would be simple, but it would be a trap. This is because the code being tested would not be running inside a docker container. Yet when the code really runs (after being deployed) it always runs inside a docker container. So instead I run a script which rebuilds the docker web image, starts a new web container, shells into this container, and runs the tests.
  • 41. ... env: global: - DOCKER_ENGINE_VERSION=1.12.1 - DOCKER_COMPOSE_VERSION=1.8.0 - DOCKER_DIR=${TRAVIS_BUILD_DIR}/docker before_install: # list docker-engine versions - apt-cache madison docker-engine # install specific version of docker-engine # install specific version of docker-compose ... .travis.yml github has an excellent feature whereby every commit can trigger a Travis continuous integration (CI) pipeline. I use this on the cyber-dojo web repo. The script github runs installs specific versions of docker and docker-related tools...
  • 42. ... script: # Build the cyber-dojo web image - cd ${DOCKER_DIR}/web - ./build-image.sh ${DOCKER_ENGINE_VERSION} - cd ${TRAVIS_BUILD_DIR}/cli - ./cyber-dojo up - cid=`docker ps --all --quiet --filter "name=cyber-dojo-web"` - docker logs cyber-dojo-web - docker inspect -f {{.State.Running}} ${cid} - docker ps -a - docker pull cyberdojofoundation/gcc_assert:latest - docker pull cyberdojofoundation/ruby_test_unit:latest .travis.yml - docker exec ${cid} sh -c "cd test && ./run.sh" ...and then builds the web image, starts a new web container, shells into this container, and runs the tests. Just like when I run the tests myself :-)
  • 43. Here's an example of the output you get from travis CI when the tests are run inside the docker container.
  • 44. This is the dashboard for the Travis Continuous Integration. The various github repos are listed on the left. On the right are results from recent commits on the selected github repo (web).
  • 45. thank yous Byran Wills-Heath Nadya Sivers Seb Rose Olve Maudal Dymtro Mindra Mike Long A big thank you also to these people who have all helped with cyber-dojo in various ways.
  • 46. twitter : @JonJagger email : jon@jaggersoft.com blog : http://jonjagger.blogspot.co.uk/ charity : http://cyber-dojo.org that's all folks That's it. Thanks for listening. I hope I've sowed a few seeds. Have a great conference.