summaryrefslogtreecommitdiff
path: root/bootstrap-bluegreen
blob: d886a041f175268e238308113f73be426e31e2c9 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash

# Bootstrap the Taler setup for the user account that
# is currently logged in.

# The setup generated by this script is suitable for
# blue-green deployments, where two users run
# identical environments, and traffic can be switched
# between them.

# To create a demo setup, run
# demo-blue$ ~/deployment/bootstrap-bluegreen demo
# demo-green$ ~/deployment/bootstrap-bluegreen demo

# There MUST be a user with the same name
# as the deployment basename to share data
# between the blue/green deployment.

set -eu

usage() {
  ech "Usage:"
  echo "$0: DEPLOYMENT_BASENAME"
}

if [ -z ${1+x} ]; then
  usage
  exit 1
fi

DEPLOYMENT_BASENAME=$1

BRANCH=master
case $DEPLOYMENT_BASENAME in
  demo)
    BRANCH=stable
    ;;
esac

cd $HOME

if ! test -d $HOME/gnunet; then
  svn checkout https://gnunet.org/svn/gnunet 
fi

if ! test -d $HOME/libmicrohttpd; then
  svn checkout https://gnunet.org/svn/libmicrohttpd 
fi

for component in bank merchant gnurl landing exchange merchant-frontends deployment; do
  if ! test -d $HOME/$component; then
    git clone /var/git/$component.git
  fi
done

for component in bank merchant landing exchange merchant-frontends; do
  echo "Checking out $component to $BRANCH"
  git -C $HOME/$component checkout $BRANCH
done

cat >$HOME/activate <<EOL
#!/bin/bash
export PATH="$HOME/local/bin:$HOME/deployment/bin:\$PATH"
EOL

mkdir -p $HOME/.config
ln -sft $HOME/.config "$HOME/deployment/config/$DEPLOYMENT_BASENAME.taler.net/taler.conf"
ln -sft $HOME/.config "$HOME/deployment/config/$DEPLOYMENT_BASENAME.taler.net/taler"

ln -sf "/home/$DEPLOYMENT_BASENAME/shared-data" "$HOME"