├── .dockerignore ├── rootfs ├── usr │ └── local │ │ └── bin │ │ └── startup ├── etc │ └── supervisor │ │ └── supervisord.conf └── opt │ └── tiodocker │ └── config.docker ├── LICENSE ├── Dockerfile └── README.md /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .gitignore 3 | LICENSE 4 | VERSION 5 | README.md 6 | Changelog.md 7 | Makefile 8 | docker-compose.yml 9 | docs 10 | -------------------------------------------------------------------------------- /rootfs/usr/local/bin/startup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Supervisor socket 4 | touch /dev/shm/supervisor.sock 5 | 6 | # RUN ! 7 | exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf 8 | -------------------------------------------------------------------------------- /rootfs/etc/supervisor/supervisord.conf: -------------------------------------------------------------------------------- 1 | [unix_http_server] 2 | file=/dev/shm/supervisor.sock 3 | chmod=0700 4 | 5 | [supervisord] 6 | nodaemon=true 7 | 8 | [rpcinterface:supervisor] 9 | supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface 10 | 11 | [supervisorctl] 12 | serverurl=unix:///dev/shm/supervisor.sock 13 | 14 | [include] 15 | files = /etc/supervisor/conf.d/*.conf 16 | 17 | [program:httpd] 18 | command=/usr/sbin/httpd -D FOREGROUND 19 | autorestart=true 20 | 21 | [program:sshd] 22 | command=/usr/sbin/sshd -D 23 | autorestart=true 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 TryItOnline 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM fedora:26 2 | 3 | LABEL description="TryItOnline Offline Image https://tryitonline.net" maintainer="Andrew Savinykh" 4 | 5 | ENV LANG en_US.UTF-8 6 | ENV LANGUAGE en_US:en 7 | ENV LC_ALL en_US.UTF-8 8 | 9 | ARG TINI_VER=0.14.0 10 | 11 | COPY rootfs / 12 | 13 | RUN chmod +x /usr/local/bin/* \ 14 | && dnf update -y \ 15 | && dnf install -y git wget dnf-plugins-core openssh-server glibc-locale-source python gettext \ 16 | && pip install --upgrade pip \ 17 | && pip install supervisor \ 18 | && /usr/libexec/openssh/sshd-keygen ed25519 \ 19 | && localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 || true \ 20 | && cd /tmp \ 21 | && wget -q https://github.com/krallin/tini/releases/download/v$TINI_VER/tini_$TINI_VER.rpm \ 22 | && dnf install -y tini_$TINI_VER.rpm \ 23 | && git clone https://github.com/TryItOnline/tiosetup.git /opt/tiosetup \ 24 | && cd /opt/tiosetup \ 25 | && cp /opt/tiodocker/config.docker /opt/tiosetup/private/config \ 26 | && /opt/tiosetup/bootstrap \ 27 | && dnf clean all \ 28 | && rm -rf /tmp/* \ 29 | && rm -f /run/nologin 30 | 31 | VOLUME /etc/httpd /srv 32 | 33 | EXPOSE 80 81 34 | 35 | CMD ["tini","--","startup"] 36 | -------------------------------------------------------------------------------- /rootfs/opt/tiodocker/config.docker: -------------------------------------------------------------------------------- 1 | # Provide commit number or branch for `git checkout` command performed after cloning tryitonline repository 2 | # This allows installing a historic version or a feature branch instead of the master latest 3 | TryItOnlineCommit="master" 4 | 5 | # To be able to use Dyalog APL, you need to download 64-bit Dyalog APL Classic and Unicode 6 | # to /opt This requires a valid Dyalog license. If you have one, you can save your MyDyalog 7 | # username in this file and run the misc/dldyalogapl script manually, before the remaining 8 | # setup scripts. If you do not have a license, you can run the setup script without the 9 | # Dyalog APL archive, but Dyalog APL won't be installed. 10 | # DyalogUser= 11 | 12 | # The following five settings are for the domain names used in the setup 13 | # Please read more about them in accompanying documentation. 14 | 15 | # Domain where https://tryitonline.net will be hosted 16 | TRYITONLINENET=tryitonline 17 | 18 | # Domain where https://tio.run will be hosted 19 | TIORUN=tiorun 20 | 21 | # Domain for .tryitonline.net -> tio.run/nexus/ redirects. 22 | # This setting is optional and may be left empty or removed entirely. 23 | # LANGDOMAIN= 24 | 25 | # You can provide your own SSH key pairs or let them be generated automatically. 26 | # For the root (resp. apache) user, if either an RSA key pair (id_rsa and id_rsa.pub) 27 | # or an ED25519 key pair (id_ed25519 and id_ed25519.pub) is found in private/root 28 | # (resp. private/apache), they will be copied in the user's ssh folder. Otherwise, an 29 | # ED25519 key pair will be generated automatically. 30 | # Likewise, if either an RSA key pair (ssh_host_rsa and ssh_host_rsa.pub) or an 31 | # ED25519 key pair (ssh_host_ed25519 and ssh_host_ed25519.pub) is found in private, 32 | # they will replace the pre-generated host keys in /etc/ssh. 33 | 34 | # This option should be left turned off ("n"). If it's turned on ("y") certificates 35 | # and selinux configuration will be skipped during setup. This is useful for running 36 | # an offline copy of TryItOnline in a docker image (which does no support selinux) 37 | # Exposing an installation in offline mode to internet is a big security risk and should 38 | # never be done. 39 | OfflineMode="y" 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # tryitonline/tryitoffline 2 | 3 | ## Background 4 | 5 | This docker image is to allow running locally. Here are the image's limitations: 6 | 7 | - It is not updated often, so is always more up to date. (But see below on how to update individual languages) 8 | - The image as of the time of writing is about **4GB in size**, so it can take some time to download depending on your connection speed 9 | - The image takes about **2 hours to build** (again, depending on your machine spec) - you don't have to build it though, you can download it (as above) 10 | - Since TryItOnline security is based on SELinux, and it is not possible to run SELinux specific commands inside a docker container, SELinux is disabled in this image. This means, that if someone can browse to the web site served by this image, they are a root inside the docker container and can potentially compromise the host. **!!!Do not expose installations based on this image to any non-trusted environment (e.g.: internet)!!!** 11 | - Dyalog APL is not included in the image. If you would like to use Dyalog APL, you'll have to copy the installation rpms into the container and install them with dnf. (See below) 12 | 13 | This image was tested to run fine on both Windows (Windows 10) and Linux (Ubuntu 16.04). 14 | 15 | ## Getting the image 16 | 17 | You can build the image yourself. Run in the root of the repo: 18 | 19 | ```bash 20 | docker build --no-cache=true -t tryitonline/tryitoffline . 21 | ``` 22 | 23 | Or download from docker hub: 24 | 25 | ```bash 26 | docker pull tryitonline/tryitoffline 27 | ``` 28 | 29 | ## Running the image 30 | 31 | First add the following to your hosts file: 32 | 33 | ```text 34 | 127.0.0.1 tryitonline 35 | 127.0.0.1 tiorun 36 | ``` 37 | 38 | When you put the host records your computer starts resolving domain names as per the record configured, so tryitonline will resolve to 127.0.0.1. The web server uses the host header to select the site to serve. The host header is what you specify in the domain part off the url, which is in this case "tryitonline" 39 | The image configured to recognize "tryitonline" for the static site "e.g. tryitonline.net" and tiorun for the dynamic part (e.g "tio.run"), this can be changed in the apache configuration (/etc/httpd inside the container). *Note: As of June 2017, tryitonline.net and tio.run were merged to a single site with tryitonline.net redirecting to tio.run* 40 | 41 | The hosts file is usually at `C:\Windows\System32\drivers\etc\hosts` on Windows or `/etc/hosts` on Linux. 42 | 43 | Then start the container: 44 | 45 | ```bash 46 | docker run -d --name tiooffline -p 80:80 --add-host arena:127.0.0.1 tryitonline/tryitoffline 47 | ``` 48 | 49 | Now browse to , that's it. 50 | 51 | ## Maintenance 52 | 53 | You already know the below if you are familiar with docker, but if not, here is a few useful commands. This allows you to connect to the container's shell: 54 | 55 | ```bash 56 | docker exec -it tiooffline /bin/bash 57 | ``` 58 | 59 | To stop the container use: 60 | 61 | ```bash 62 | docker stop tiooffline 63 | ``` 64 | 65 | To start the container again use: 66 | 67 | ```bash 68 | docker start tiooffline 69 | ``` 70 | 71 | To remove container use: 72 | 73 | ```bash 74 | docker container rm -f tiooffline 75 | ``` 76 | 77 | To remove image use: 78 | 79 | ```bash 80 | docker image rm tryitonline/tryitoffline 81 | ``` 82 | 83 | In the image there are volumes for `/srv` (web sites contents) and `/etc/httpd` (web sites configuration) are defined. You can either use `docker run` switch `-v` to map them where ever you like on the host file system, or use `docker container inspect tiooffline` to see where docker mapped them by default. Please refer to docker documentation for more details. You might want to change httpd configuration and/or sites contents if you want them to be served, say on different ports of `localhost`. 84 | 85 | For quick test of all languages you can use: 86 | 87 | ```bash 88 | tiodryrun 89 | ``` 90 | 91 | inside container shell. (Depending on your hardware it can take around 2 minutes to finish). 92 | 93 | ## Troubleshooting 94 | 95 | It is generally recommended pulling `tryitonline/tryitoffline:tested` from Docker Hub, since it is usually minimally tested. If you build your own image and it does not work (which is most often happens because of network connectivity problems) here are a few ways to diagnose. 96 | 97 | You can delete your old container with `docker container rm -f tiooffline` then create a new one without trying to start tryitonline, but just with bash to access the build logs `docker run -it tryitonline/tryitoffline /bin/bash` the logs are then in `/var/log/tioupd` 98 | 99 | Another way to diagnose it is to remove the container as above and then run it like this: `docker run -it --name tiooffline -p 80:80 --add-host arena:127.0.0.1 tryitonline/tryitoffline` this will produce some start up output and possibly some errors that could help. 100 | 101 | ## Updating languages 102 | 103 | Some languages updates are tricky, but some languages (listed [here](https://github.com/TryItOnline/tiosetup/tree/master/languages)) can be updated relatively easily from the command line. Run: 104 | 105 | ```bash 106 | docker exec -it tiooffline /bin/bash 107 | ``` 108 | 109 | to drop into container, then run, for example, to update jelly: 110 | 111 | ```bash 112 | tiopull jelly 113 | ``` 114 | 115 | Also some languages may be updated by running `dnf update`. 116 | 117 | If a new language needs to be added to the image, in might be easier to rebuild the image. That will pull all the languages from [tiosetup](https://github.com/TryItOnline/tiosetup). 118 | 119 | 120 | ## Adding Dyalog APL (also: classic, quadr, quads) 121 | 122 | If you have Dialog APL installation rpms, you can copy them into your container: 123 | 124 | ```bash 125 | docker cp linux_64_15.0.29644_unicode.x86_64.rpm tiooffline:/opt/linux_64_15.0.29644_unicode.x86_64.rpm 126 | ``` 127 | 128 | Then drop into the container and install it as usual: 129 | 130 | ```bash 131 | docker exec -it tiooffline /bin/bash 132 | dnf install /opt/linux_64_15.0.29644_unicode.x86_64.rpm 133 | ``` 134 | 135 | You need to repeat the same process for classic version, if you want both of them running. 136 | --------------------------------------------------------------------------------