Public | Automated Build

Last pushed: 8 months ago
Short Description
Short description is empty for this repo.
Full Description

Docker image for Web-demo builder

This repository contains the Docker image for the Web-demo builder. You can use these images for a faster deploy of the Web-demo builder in your servers. As with most Docker images, you need a recent Linux x84_64 distribution. Follow the installation instructions to install Docker.

Below, you will find the basic commands you need to run to get the Web-demo builder up and running. After that, particular use cases are described.

Quick and easy use

The easiest way to get your container running with the Web-demo builder is to use the run_container.sh script, included in this repository. You just need to:

  1. Install Docker in your operating system.
  2. Get the file run_container.sh (you can find it in this repository) and edit it to configure the three environment variables defined at the top of it. You can leave WDB_DOCKER_DIR and WDB_WEBDEMOS_DIR with their default values. WDB_MATLAB_DIR is only needed if you are planning to run web-demos written for MATLAB.
  3. Start Docker. In Ubuntu, you need to run sudo service docker start
  4. Run the script: sudo -E ./run_container.sh

These steps will start a Web-demo builder instance. You can access it by opening your browser and going to http://localhost.

More detailed steps

The previous steps are enough. However, if you want to run it manually or get more details of what the script does, follow the steps below:

  1. Install Docker in your operating system.
  2. If you are working behind a proxy, configure it properly in the file /etc/default/docker
  3. Open a terminal and make sure the Docker daemon is running: sudo service docker start
  4. Download the latest Docker image by running sudo docker pull sinclab/webdemobuilder
  5. Choose a directory of your system where the virtual environments will be stored, for example /var/lib/docker-webdemobuilder. To simplify steps below, set this path to a variable by running: export WDB_DOCKER_DIR="/var/lib/docker-webdemobuilder"
  6. Pre-load the virtual environments you will need with the following commands. Keep in mind that if, for example, you plan to only run MATLAB web-demos, then you only need the MATLAB virtual environment. You only need to run these commands only once.

     #!bash
     # MATLAB virtual environment
     sudo -E docker run --rm --privileged \
       -e http_proxy="${http_proxy}" \
       -v ${WDB_DOCKER_DIR}:/var/lib/docker \
       sinclab/webdemobuilder \
       docker pull sinclab/webdemo-base-matlab
    
     # Python 2.7 virtual environment
     sudo -E docker run --rm --privileged \
       -e http_proxy="${http_proxy}" \
       -v ${WDB_DOCKER_DIR}:/var/lib/docker \
       sinclab/webdemobuilder \
       docker pull sinclab/webdemo-base-python2
    
     # R 3.0 virtual environment
     sudo -E docker run --rm --privileged \
       -e http_proxy="${http_proxy}" \
       -v ${WDB_DOCKER_DIR}:/var/lib/docker \
       sinclab/webdemobuilder \
       docker pull sinclab/webdemo-base-r3
    

    The option -E to sudo ensures that any proxy settings (like the environment variable http_proxy) will be preserved for Docker.

  7. Choose a directory of your system where the web-demos you generate will be stored, for example /var/lib/webdemobuilder-scripts. To simplify steps below, set this path to a variable by running: export WDB_WEBDEMOS_DIR="/var/lib/webdemobuilder-scripts"

  8. If you plan to run MATLAB web-demos, you need to specify the directory of your MATLAB installation (where the bin/ directory resides). Specify this by running: export WDB_MATLAB_DIR="/usr/local/MATLAB/R2013a"
  9. Run the Web-demo builder container:

     #!bash
     sudo -E docker run -d --privileged -p 8080:80 \
       -e http_proxy="${http_proxy}" \
       -v ${WDB_MATLAB_DIR}:/MATLAB \
       -v ${WDB_DOCKER_DIR}:/var/lib/docker \
       -v ${WDB_WEBDEMOS_DIR}:/app/webdemobuilder/scripts \
       sinclab/webdemobuilder
    
  10. Open your web browser and go to http://localhost:8080. You are now accessing a Web-demo builder instance running inside a Docker container.

Advanced options

The previous steps are enough to run the Web-demo builder with Docker. However, there are some particular cases where you would need to set up additional configuration options. Below, you will find additional arguments you can pass to the docker run command shown in step 8 before.

Using always the latest code

The previous steps are enough to run the version of the Web-demo builder inside the Docker image. However, if you want to always update to the latest stable code when starting your container, you can use the following argument: -e update_code=true. This will download the latest stable code of the Web-demo builder, thus you automatically get improvements and bug fixes with no effort.

Behind a proxy

If you are behind a proxy, remember to specify it when launching your container, for example: -e http_proxy="http://HOST:PORT/"

Password protect the access

You can protect the access to the Web-demo builder by specifying an extra option when running docker run: -e WDB_USER_PASSWORD="user/password".

Change branch

The docker image allows to choose the branch where one wants to work on ("default" or "stable"). You can change it by specifying the option webdemo_branch. For example, to use the latest code in the "default" branch, use these arguments: -e webdemo_branch="default" -e update_code="true"

Development usage

If you want to change the Web-demo builder code (written in PHP/HTML/Javascript), you need to override the directory where it resides inside the Docker image, and modify the directory permissions:

  • Use the argument -v PATH_TO_YOUR_COPY_OF_THE_CODE:/app
  • Change permissions: chmod -R o+w files/ templates/ scripts/
Docker Pull Command
Owner
sinclab
Source Repository

Comments (0)