summaryrefslogtreecommitdiff
path: root/scripts/docker/files/setup-env.sh
blob: d5aeab7df0d52ebd4c0c61a9ab0bc9f7ce44b231 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash

# Clone soledad repository and install soledad dependencies needed to run
# client and server in a test environment.
#
# In details, this script does the following:
#
#   - clone a series of python package repositories into /var/local/soledad.
#   - install dependencies for those packages from the requirements files in
#     each of the repositories, using python wheels when possible.
#   - install the python packages in development mode
#
# The cloned git repositories might have a remote configured and a branch
# checked out on runtime, before a server, client or test instance is actually
# run. Check the other scripts in this directory.
#
# This script is meant to be copied to the docker container and run after
# system dependencies have been installed.

BASEDIR="/var/local"
BASEURL="https://github.com/leapcode"

mkdir -p ${BASEDIR}

# clone repositories
repos="soledad leap_pycommon soledad-perf"

for repo in ${repos}; do
  repodir=${BASEDIR}/${repo}
  if [ ! -d ${repodir} ]; then
    git clone ${BASEURL}/${repo} ${repodir}
    git -C ${repodir} fetch origin
  fi
done

# use latest pip because the version available in debian jessie doesn't
# support wheels
pip install -U pip

pip install psutil

# install dependencies and packages
install_script="pkg/pip_install_requirements.sh"
opts="--use-leap-wheels"
pkgs="leap_pycommon soledad/common soledad/client soledad/server"

for pkg in ${pkgs}; do
  pkgdir=${BASEDIR}/${pkg}
  testing=""
  if [ -f ${pkgdir}/pkg/requirements-testing.pip ]; then
    testing="--testing"
  fi
  (cd ${pkgdir} && ${install_script} ${testing} ${opts})
  (cd ${pkgdir} && python setup.py develop)
done