Coder Social home page Coder Social logo

quickfur / core Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dlang-tour/core

0.0 2.0 0.0 1.13 MB

D Language online tour (https://tour.dlang.org/) and online editor (https://run.dlang.io/)

License: Boost Software License 1.0

Shell 0.63% CSS 12.40% JavaScript 21.98% D 64.99%

core's Introduction

The Dlang Online Tour

Join the chat at https://gitter.im/dlang-tour/core

Build Status

This is the D language online tour which provides an online introduction to this great system programming language with examples that can be edited, compiled and run online.

The most recent version of this tour can be seen here: http://tour.dlang.org.

Running offline

With D's package manager DUB the tour can be downloaded for offline access:

dub fetch dlang-tour # only once
dub run dlang-tour   # to execute the tour

A custom language can be loaded directly using the -l / --lang-dir option with the path to the directoy of the to be loaded language:

dub run dlang-tour -- --lang-dir .

Add Content

This repository contains the application that runs the tour. Please refer to english content or another language.

Further information on how to add or change existing content can also be found in the CONTRIBUTING.md.

Compile & Run

Make sure dub is installed and simply run this in the dlang-tour folder:

dub

You might want to change the settings in config.yml to change the ports the tour is listening to.

Compiling & running of user source code

The source code on the tour can be compiled and then executed online and its output returned to the user. Therefore three different types of execution drivers have been implemented within the dlang-tour:

  • off: no online compilation allowed. If the user hits Runs an error message will be returned.
  • stupidlocal: an unsafe method that just runs rdmd on the local host system and returns its output. Very unsafe and musn't ever be used in production!
  • docker: runs rdmd within a special Docker container (dlang-tour-rdmd) and returns its output. The driver imposes the Docker container memory and execution time limits. Additional configurations options available in config.yml.

The execution driver is set in config.yml.

Caching of the program output can also be enabled in config.yml (exec.cache = true). Caching will only be enabled for the built-in default examples however.

Docker image

A Docker image is automatically built by Travis CI and pushed to the repository at https://hub.docker.com/r/dlangtour/core. The Dlang-Tour Docker container is configured to use Docker itself to compile and run D source code in the online editor. For that to work the host system's Docker /var/run/docker.sock Unix domain socket has to be mounted to work inside the container. A sandbox for compiling will then be started on the host system actually, and not within the Dlang Tour Docker container itself.

The code for running the D compilers in a Docker sandbox can be found here: dlang-tour-rdmd.

So to run the latest dlang-tour version in a Docker container, run the following command:

docker run -d --rm -p 80:8080 -e GOOGLE_ANALYTICS_ID=123 -v /var/run/docker.sock:/var/run/docker.sock \
	--name dlang-tour dlangtour/core

The tour will be available at your host system on port 80. To stop the container again just run:

docker stop dlang-tour

For further Docker foo please refer to the Docker documentation.

Note: The docker version inside the container must be compatible to that on the host system! Generally a newer version might run on the host system than within the container.

The Docker container is also the suggested way of dlang-tour's deployment.

Dlang Tour Bot

There is a friendly bot in place that listens to the events of all language repositories and triggers rebuilds and thus automatic deploments on a new change. More information about it can be found at it's repository.

Environment variables

GOOGLE_ANALYTICS_ID

default: (empty)

To enable Google Analytics please specify the environment variable GOOGLE_ANALYTICS_ID and set it to the tracking ID provided for your Analytics account.

EXEC_DOCKER_MEMORY_LIMIT

default: 256

Memory limit per started rdmd Docker container which compiles and runs the user code.

EXEC_DOCKER_MAX_QUEUE_SIZE

default: 10

Maximum number of parallel executions of the rdmd user code Docker container.

EXEC_DOCKER_TIME_LIMIT

default: 20

Time limit in seconds the rdmd Docker container with the user code is allowed to take until it is killed.

EXEC_DOCKER_MAX_OUTPUT_SIZE

default: 4096

Maximum allowed size in bytes of the generated user program's output.

Deployment

A deployment guide can be found in the deploy folder.

License

Boost License. See LICENSE.txt for more details.

core's People

Contributors

9il avatar asib avatar dlang-bot avatar dmi7ry avatar gitter-badger avatar jackstouffer avatar llaine avatar lodo1995 avatar markuslaker avatar martinnowak avatar mtrenkmann avatar petarkirov avatar sergiors avatar stonemaster avatar vladdesv avatar wilzbach avatar zek avatar

Watchers

 avatar  avatar

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.