summaryrefslogtreecommitdiff
path: root/bootstrap-bluegreen
blob: 6026aa5dd878fc773677f07f7b3d11468068c345 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/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() {
  echo "Usage: $0 ENVNAME ENVCOLOR"
}

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

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

ENVNAME=$1
ENVCOLOR=$2
BRANCH=master
CURRENCY=TESTKUDOS

case $ENVNAME in
  demo)
    BRANCH=stable
    CURRENCY=KUDOS
    ;;
esac

cd $HOME

if ! test -d $HOME/gnunet; then
  git clone git://gnunet.org/gnunet.git
fi

if ! test -d $HOME/libmicrohttpd; then
  git clone git://gnunet.org/libmicrohttpd.git
fi

for component in twister bank merchant gnurl landing exchange donations blog backoffice deployment auditor survey ; do
  if ! test -d $HOME/$component; then
    git clone git://git.taler.net/$component
  fi
done

if [[ "$ENVNAME" = test ]]; then
  if ! test -d $HOME/playground; then
    git clone /var/git/playground.git
    git clone /var/git/help.git
  fi
fi

for component in twister bank merchant landing exchange donations blog survey backoffice ; do
  echo "Checking out $component to $BRANCH"
  git -C $HOME/$component checkout $BRANCH
done

cat >$HOME/activate <<EOL
#!/bin/bash

function taler-config-generate () {
  echo "Command disabled. Clease use taler-deployment-config-generate instead."
  return 1
}
function taler-exchange-keyup () {
  echo "Command disabled. Clease use taler-deployment-keyup instead."
}


export PATH="$HOME/deployment/bin:$HOME/local/bin:\$PATH"
export PYTHONPATH="$HOME/local/lib/python3.5/site-packages"
export TALER_CHECKDB="postgres:///talercheck-$USER"
export TALER_CONFIG_CURRENCY=$CURRENCY

# DEPRECATED ALIAS!
export TALER_CONFIG_ENV=$ENVNAME

export TALER_ENV_NAME=$ENVNAME
export TALER_ENV_COLOR=$ENVCOLOR
export TALER_ENV_URL_INTRO="https://$ENVNAME.taler.net/"
export TALER_ENV_URL_BANK="https://bank.$ENVNAME.taler.net/"
export TALER_ENV_URL_MERCHANT_BLOG="https://shop.$ENVNAME.taler.net/"
export TALER_ENV_URL_MERCHANT_DONATIONS="https://donations.$ENVNAME.taler.net/"
export TALER_ENV_URL_MERCHANT_SURVEY="https://survey.$ENVNAME.taler.net/"
export TALER_ENV_URL_AUDITOR="https://auditor.$ENVNAME.taler.net/"
export TALER_ENV_URL_BACKOFFICE="https://backoffice.$ENVNAME.taler.net/"
EOL

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