github.com/spg/deis@v1.7.3/tests/bin/setup-node.sh (about)

     1  #!/bin/bash
     2  #
     3  # Preps a Ubuntu 14.04 box with requirements to run as a Jenkins node to https://ci.deis.io/
     4  # Should be run as root.
     5  
     6  # fail on any command exiting non-zero
     7  set -eo pipefail
     8  
     9  apt-get install -y apt-transport-https
    10  
    11  # install docker
    12  apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
    13  sh -c "echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
    14  apt-get update && apt-get install -yq lxc-docker-1.5.0
    15  
    16  # install java
    17  apt-get install -yq openjdk-7-jre-headless
    18  
    19  # install virtualbox
    20  apt-get install -yq build-essential libgl1-mesa-glx libpython2.7 libqt4-network libqt4-opengl \
    21      libqtcore4 libqtgui4 libsdl1.2debian libvpx1 libxcursor1 libxinerama1 libxmu6 psmisc
    22  wget -nv http://download.virtualbox.org/virtualbox/4.3.22/virtualbox-4.3_4.3.22-98236~Ubuntu~raring_amd64.deb
    23  dpkg -i virtualbox-4.3_4.3.22-98236~Ubuntu~raring_amd64.deb && \
    24      rm virtualbox-4.3_4.3.22-98236~Ubuntu~raring_amd64.deb
    25  
    26  # install vagrant
    27  wget -nv https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.2_x86_64.deb
    28  dpkg -i vagrant_1.7.2_x86_64.deb && rm vagrant_1.7.2_x86_64.deb
    29  
    30  # install go
    31  wget -nv -O- https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz | tar -C /usr/local -xz
    32  echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile
    33  echo "You must reboot for the global $PATH changes to take effect."
    34  
    35  # install test suite requirements
    36  apt-get install -yq curl mercurial python-dev libffi-dev libpq-dev libyaml-dev git postgresql postgresql-client libldap2-dev libsasl2-dev
    37  curl -sSL https://raw.githubusercontent.com/pypa/pip/6.1.1/contrib/get-pip.py | python -
    38  pip install virtualenv
    39  
    40  # create jenkins user and install node bootstrap script
    41  useradd -G docker,vboxusers -s /bin/bash --system -m jenkins
    42  mkdir -p /home/jenkins/bin
    43  wget -nv -x -O /home/jenkins/bin/start-node.sh \
    44      https://raw.githubusercontent.com/deis/deis/master/tests/bin/start-node.sh
    45  chmod +x /home/jenkins/bin/start-node.sh
    46  chown -R jenkins:jenkins /home/jenkins/bin
    47  
    48  # as the jenkins user, do "vagrant plugin install vagrant-triggers"
    49  su - jenkins -c "vagrant plugin install vagrant-triggers"
    50  
    51  # TODO: instructions to download and install fleetctl
    52  
    53  /etc/init.d/postgresql start
    54  
    55  # set up PostgreSQL role for controller unit tests
    56  sudo -u postgres psql -c "CREATE ROLE jenkins WITH CREATEDB LOGIN;"
    57  sudo -u postgres psql -c "CREATE DATABASE deis WITH OWNER jenkins;"
    58  # edit postgresql.conf and change "fsync = off", then restart postgresql.
    59  
    60  # now the jenkins user has to export some envvars to start as a node
    61  echo "Remaining setup:"
    62  echo "  1. Log in as the jenkins user (sudo -i -u jenkins)"
    63  echo "  2. Visit the nodes admin interface at https://ci.deis.io/ to find the command line for this node"
    64  echo "  3. Export the NODE_NAME and NODE_SECRET environment variables defined there to your shell"
    65  echo "  4. Run bin/start-node.sh to connect to Jenkins and start handling jobs"