running your own cyber-dojo server

set up your server and install the cyber-dojo script

Click the link for your operating-system and follow the instructions.

bring up your cyber-dojo server

In a terminal, type:
./cyber-dojo up

Put your cyber-dojo server's IP address into your browser. That's it.


bring down your cyber-dojo server

In a terminal, type:
./cyber-dojo down


24 comments:


  1. I'm having trouble getting a cyber-dojo server running on my Ubuntu machine.

    I ran it the first time and it took a few minutes downloading some things (unfortunately I did not keep the log from this) but it failed with a networking issue. Then I fixed the networking issue and now it fails with the following log.

    I modified the cyber-dojo script to add a sh -x option for more verbosity and this is what I'm seeing:

    + dirname ./cyber-dojo
    + cd .
    + pwd
    + readonly my_dir=/home/bakelly/CyberDojo
    + readonly cyber_dojo_commander=cyberdojo/commander
    + hash docker
    + [ up = --debug ]
    + [ up = update ]
    + delegate_to_commander up
    + [ up = up ]
    + set_env_file_volumes
    + local web_env=/home/bakelly/CyberDojo/web.env
    + [ -f /home/bakelly/CyberDojo/web.env ]
    + local nginx_env=/home/bakelly/CyberDojo/nginx.env
    + [ -f /home/bakelly/CyberDojo/nginx.env ]
    + local grafana_env=/home/bakelly/CyberDojo/grafana.env
    + [ -f /home/bakelly/CyberDojo/grafana.env ]
    + local zipper_env=/home/bakelly/CyberDojo/zipper.env
    + [ -f /home/bakelly/CyberDojo/zipper.env ]
    + [ up = start-point ]
    + docker run --init --rm --user=root --env CYBER_DOJO_SH_ROOT=/home/bakelly/CyberDojo --env CYBER_DOJO_ENV_ROOT=/tmp/app --volume=/var/run/docker.sock:/var/run/docker.sock cyberdojo/commander /app/cyber-dojo.rb up
    Creating start-point exercises from https://github.com/cyber-dojo/start-points-exercises.git
    https://github.com/cyber-dojo/start-points-exercises.git
    docker exec c80de63384f372790a6273de8d12ffda224aaea91d2173e3f572bf9aa192f5a1 sh -c 'cd /data/0_start-points-exercises.git && git pull --depth=1 origin master &> /dev/null' failed!?
    + exit_fail
    + [ != ]
    + exit 1

    Any advice?

    ReplyDelete
  2. For the record, I tried doing a:
    cyber-dojo update
    followed by:
    ./cyber-dojo start-point create common --list=https://raw.githubusercontent.com/cyber-dojo/start-points-languages/master/languages_list_common

    And the update passed (took about 2 minutes to run) but the create died with:
    FAILED...
    /data/start_point_type.json: is missing


    Adding in the -x to the sh command reveals:
    + curl --output /dev/null --silent --head --fail https://raw.githubusercontent.com/cyber-dojo/start-points-languages/master/languages_list_common
    + docker run --init --rm --user=root --env CYBER_DOJO_SH_ROOT=/home/bakelly/CyberDojo --env CYBER_DOJO_ENV_ROOT=/tmp/app --volume=/var/run/docker.sock:/var/run/docker.sock cyberdojo/commander /app/cyber-dojo.rb start-point create common --list=https://raw.githubusercontent.com/cyber-dojo/start-points-languages/master/languages_list_common
    FAILED...

    ReplyDelete
    Replies
    1. I would try stopping the server [cyber-dojo down] then deleting all start-point volumes.
      [cyber-dojo start-point ls] to see their names, then
      [cyber-dojo start-point rm NAME] for each of the names.
      Then try again.

      Delete
  3. When I run the start-point ls I get:

    cyber-dojo start-point ls
    + dirname ./cyber-dojo
    + cd .
    + pwd
    + readonly my_dir=/home/bakelly/CyberDojo
    + readonly cyber_dojo_commander=cyberdojo/commander
    + hash docker
    + [ start-point = --debug ]
    + [ start-point = update ]
    + delegate_to_commander start-point ls
    + [ start-point = up ]
    + [ start-point = start-point ]
    + [ ls = create ]
    + docker run --init --rm --user=root --env CYBER_DOJO_SH_ROOT=/home/bakelly/CyberDojo --env CYBER_DOJO_ENV_ROOT=/tmp/app --volume=/var/run/docker.sock:/var/run/docker.sock cyberdojo/commander /app/cyber-dojo.rb start-point ls
    cat: can't open '/data/start_point_type.json': No such file or directory
    /usr/lib/ruby/gems/2.5.0/gems/json-2.1.0/lib/json/common.rb:156:in `parse': 765: unexpected token at '' (JSON::ParserError)
    from /usr/lib/ruby/gems/2.5.0/gems/json-2.1.0/lib/json/common.rb:156:in `parse'
    from /app/cyber-dojo.rb:121:in `cyber_dojo_data_manifest'
    from /app/cyber-dojo.rb:125:in `cyber_dojo_type'
    from /app/cyber-dojo-start-point-ls.rb:36:in `block in cyber_dojo_start_point_ls'
    from /app/cyber-dojo-start-point-ls.rb:36:in `map'
    from /app/cyber-dojo-start-point-ls.rb:36:in `cyber_dojo_start_point_ls'
    from /app/cyber-dojo-start-point.rb:36:in `cyber_dojo_start_point'
    from /app/cyber-dojo.rb:201:in `'
    + exit_fail
    + [ != ]
    + exit 1


    It always seems to be looking for this /data/start_point_type.json file and cant't find it.

    ReplyDelete
    Replies
    1. Hmmm. We have a chicken/egg situation here. We need to drop down to docker itself.
      If you run [docker volume ls] you will get the names of the volumes. Now instead of doing [cyber-dojo start-point rm NAME] do [docker volume rm NAME]

      Delete
    2. Good news and bad news. I have the server up and running, but no languages are displayed in the sessions boxes.

      Now I have cyberdojo up running and I can pull the main page up in the browser.

      Unfortunately, The languages/frameworks seem to not be populated. When I click on "Create New Session" both list-boxes are empty. I do notice that "Create Custom Session" is populated with some languages (Java, Python, C++ (though not with gtest :-(, and a few others). How do I get the rest of the languages listed and working?

      So close I can taste it :-)
      Advise to fix this?

      Delete
    3. Just for a little more background when I run cyber-dojo up I do get this output:

      checking images in start-point [languages] all exist...
      checking images in start-point [custom] all exist...
      >>checking cyberdojofoundation/csharp_nunit:latest
      >>exists cyberdojofoundation/csharp_nunit:latest
      >>checking cyberdojofoundation/gcc_assert:latest
      >>exists cyberdojofoundation/gcc_assert:latest
      >>checking cyberdojofoundation/gpp_assert:latest
      >>exists cyberdojofoundation/gpp_assert:latest
      >>checking cyberdojofoundation/java_junit:latest
      >>exists cyberdojofoundation/java_junit:latest
      >>checking cyberdojofoundation/python_unittest:latest
      >>exists cyberdojofoundation/python_unittest:latest
      >>checking cyberdojofoundation/ruby_test_unit:latest
      >>exists cyberdojofoundation/ruby_test_unit:latest

      but the boxes are still empty when I pull up "Create New Session" in the browser

      Delete
    4. The problem now is that you need to recreate the languages start-point.
      Notice that the output does not say it is creating a languages start-point.
      So I think you need these three commands, which should force cyber-dojo to recreate the languages start-point.

      cyber-dojo down
      cyber-dojo start-point rm languages
      cyber-dojo up


      Of course, if you don't want a full set of default languages, then you can create a smaller selection, as I think you were trying originally.

      Delete
    5. Okay - I now have the language list working but there's no exercise listed in the listbox on the right. And when I select a language and click okay I get an exception thrown.

      So far every problem I've run into has been related to my firewall or docker. So if you can just give me the cyber-dojo command to re-download the exercises, I think I'll be fine.

      Delete
    6. Nevermind - I figured it out. I hate working with corporate firewalls.

      Cyberdojo is up and running. You guys rock!

      My company has already donated to the charity you guys support, but I'm totally going to get them to do another donation because it is worth it!

      Thank you so much for the technology and the support :-)

      Delete
    7. Woohoo. Glad you're up and running. Have fun :-)

      Delete
  4. hi Jon, cyber-dojo is a great tool, thanks for the work. I have a problem when I using my own server in China, it's the twitter widget in every page's left-down corner, because we can't access twitter directly in mainland China, so it lag the loading of page. I'm new to docker things, so is there a easy way to remove or disable it? It's not a big problem, session and dojo are work fine, but every time the page keep loading bother me a little.

    ReplyDelete
  5. Hi :-)
    I've updated the web image so the twitter widget is async. Update your server to the latest to get this...
    https://github.com/cyber-dojo/commander#updating-the-server-to-the-latest-version
    Thanks for the feedback.
    Cheers
    Jon

    ReplyDelete
  6. Hi Jon,
    When I run "./cyber-dojo up", I get the below error message:
    ./cyber-dojo: line 48: ./cyber-dojo-inner: Permission denied

    Do you know what I am missing in terms of permission?

    More details:
    After I got docker configured correctly, your script ran fine and it downloaded all of the docker images that were needed, then it reached the end and didn't have permission to execute the ./cyber-dojo-inner.

    Any help would be appreciated. :)

    Thanks...

    ReplyDelete
    Replies
    1. Hi,
      Hmmm. Sorry about that.
      If you look at line 46 of your cyber-dojo.sh file you should see this line:
      chmod 700 ./${SCRIPT}
      where SCRIPT is cyber-dojo-inner
      It seems 700 is not working for you.
      This could be umask related?
      For now I suggest changing 700 to 755 and rerunning the cyber-dojo command.
      See if that works.

      Delete
    2. Hi Jon,
      Thank you for the suggestion. However, it didn't work. I changed it to 755 with the same result, permission denied. I've tried different folder names and running as root with the same result. Not sure what I'm missing.

      Delete
    3. Me neither! How about changing the last line to
      CYBER_DOJO_COMMANDER_TAG=${COMMANDER_TAG} bash ./${SCRIPT} "$@"

      Delete
    4. A lot shot, but also worth trying [chmod +x] instead of [chmod 755]

      Delete
    5. It could also be a CR/LF problem. Try running the script through dos2unix.

      Delete
    6. Yet another possibility is that your /tmp dir is setup as noexec.
      Try redirecting the file to your home dir...
      .......
      > ~/${SCRIPT}

      chmod 700 ~/${SCRIPT}

      CYBER_DOJO_COMMANDER_TAG=${COMMANDER_TAG} \
      ~/${SCRIPT} "$@"

      Delete
  7. Hi Jon,
    Changing the last line to the below worked for me:
    CYBER_DOJO_COMMANDER_TAG=${COMMANDER_TAG} bash ./${SCRIPT} "$@"

    Thank you so much!

    ReplyDelete
    Replies
    1. Glad you're up and running. And thanks for letting me know what worked.

      Delete