Skip to content

v0.3.0 Deployment on Single Machine

Prasad Talasila edited this page Jan 25, 2018 · 4 revisions

Prerequisite

  1. Ubuntu server 16.04 operating system.
  2. Record the IP Address / domain name of the machine. If your machine has multiple IP addresses, please use the public IP address for installation purposes. Because of ease of use, domain name (DNS) is a preferred option for hostname in all the configuration files.
    Most likely, your machine may be on a corporate private network with a gateway / proxy server / firewall connection to Internet. In that case, please use your machine's private IP address.
    You can locate the configured IP address of your machine using the following command.
    ip addr show
    
    in the displayed output, look for IP address following the inet keyword.
  3. Change the listening port of SSH server to 2222 in /etc/ssh/sshd_config file and restart the SSH server using the following command.
    sudo service ssh restart
    If the SSH server is not running on your machine, please ignore the rest of this section and directly go to Installation section.
  4. For the SSH setting to be fully effective, logout of the current SSH session and relogin.

Installation

  1. Download the code repository
    wget https://github.com/AutolabJS/AutolabJS/archive/dev.zip -O AutolabJS.zip
    unzip AutolabJS.zip
    mv AutolabJS-dev AutolabJS

  2. Change to deploy directory.
    cd AutolabJS/deploy

  3. Specify the installation directory by changing the INSTALL_DIR variable in setup.conf file. If unchanged, the installation defaults to /opt/autolabjs directory.

  4. Copy AutolabJS codebase to installation base directory.
    bash copy.sh

  5. All the further steps in the installation procedure need to be executed from the installation directory. Go to installation directory.
    cd /opt/autolabjs

  6. Install third-party software dependencies required for AutolabJS.
    cd deploy
    bash dependencies.sh

  7. AutolabJS uses docker containers for implementing microservices. Docker containers are bulky and require significant download time. This step helps you download the docker container images.
    cd ../docker-images
    bash docker-pull.sh
    The script should download three docker containers. If the download of container images fails due to network issues, you can re-run the bash docker-pull.sh command repeatedly until all the three container images are downloaded.

  8. Build the docker containers of AutolabJS components by installing the required dependencies on the containers downloaded in the previous step.
    bash docker_build.sh
    The image building step can fail due to network errors. You can run the bash docker_build.sh as many times as you need until all the required docker images have been built. You can check the successful completion of this step by running the following command and checking the expected output.
    sudo docker images
    The expected output is as follows.

    execution_node      latest              ...
    load_balancer       latest              ...
    main_server         latest              ...
    ubuntu              16.04               ...
    gitlab/gitlab-ce    ce:10.1.4-ce.0      ...
    mysql               latest              ...
    
  9. Go to deploy/ directory.
    cd ../deploy

  10. Configure the autolab components by editing the configuration files in configs/<component>. Note that you need to use domain names for IP address of the machines wherever required. In case a domain name is not allocated to the machine, you can use the private IP address for installation. Unless you have special requirements, you can use the default host(name) and port numbers.
    The list of configuration files to be changed are:
    deploy/configs/main_server: APIKeys.json, conf.json, courses.json, labs.json
    deploy/configs/load_balancer: nodes_data_conf.json
    deploy/configs/execution_nodes: scores.json, conf.json

  11. Do remember to change the default passwords in both the inventory file (AutolabJS/deploy/inventory) and in the configuration files. Please make sure that the changed passwords match in both the inventory file and the configuration files.
    The locations of credentials are:

    File MySQL GitLab Main Server
    deploy/inventory
    deploy/configs/main_server/APIKeys.json ✔ (for /admin route)
    deploy/configs/main_server/conf.json
    deploy/configs/load_balancer/nodes_data_conf.json
  12. In the gitlab section of inventory file, change the hostname of gitlab item from localhost to Machine IP / domain name. If the machine has multiple IP addresses, then please use the public IP address. The line should look like

    [gitlab]    
    
    <Machine_IP> ansible_connection=local ansible_python_interpreter=/usr/bin/python2 gitlab_password=<gitlab_password>
    
  13. Update the SSL certificate information in openssl.cnf and keys.conf.

  14. Execute the AutolabJS setup script to install node packages and create SSL certificates.
    bash setup.sh

  15. Run the ansible-playbook:
    sudo ansible-playbook -i inventory playbook-single.yml
    The password to be provided is that of root user (or sudoer) of the machine.

  16. Ansible installs all the components of Autolab. If the previous step executes successfully, the installation is complete.

  17. Add cron job to restart the autolab components automatically.

    1. Login as root
      sudo su
    2. Copy restart script to root account
      cp deploy/autolab-restart.sh /root/
    3. Open crontab editor as root user
      crontab -e
    4. Enter a job in the file to run the restart script every minute.
      * * * * * bash /root/autolab-restart.sh
  18. In case of installation failure due to incorrect configuration, please see the FAQ page to see if you can resolve the error. If not, you can run the following commands to uninstall AutolabJS.

    1. The uninstall command is:
      sudo ansible-playbook -i inventory uninstall.yml
      The username and the password to be provided are the credentials of root user (or sudoer) of the machine.

    2. Remove the autolab installation directory completely.
      cd #go to home directory
      rm -rf /opt/autolabjs

    3. Repeat the installation steps-(10) to (15) given above to install AutolabJS again.

  19. Installation creates containers for main server, load balancer, execution node, data base and Gitlab. For further information on managing these containers see container maintenance page.

Clone this wiki locally
You can’t perform that action at this time.