summaryrefslogtreecommitdiff
path: root/bootstrap-reservetopper
blob: 15d7a0b6867b2ed7f068e6c93e48f71117bcc821 (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
107
108
109
110
#!/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

# NOTE: ENVNAME is also the name of the user who keeps
# shared data in its home directory, so it must exist!
# For demo/test ENVNAMEs, see {demo,test}.sh

set -eu

usage() {
  echo "Usage: $0 ENVNAME, test or demo"
}

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

ENVNAME=$1
source ~/envconfig

case $ENVNAME in

  test)
    CURRENCY=TESTKUDOS
    ;;
  demo)
    CURRENCY=KUDOS
    ;;
  *)
    echo Invalid envname, only 'test' and 'demo'.
    exit 1
    ;;
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 exchange bank gnurl; do
  if ! test -d $HOME/$component; then
    git clone git://git.taler.net/$component
  fi
done

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

function taler-config-generate () {
  echo "Command disabled. Please use taler-deployment-config-generate instead."
  return 1
}
function taler-exchange-keyup () {
  echo "Command disabled. Please 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_CONFIG_CURRENCY=$CURRENCY

# DEPRECATED ALIAS!
export TALER_CONFIG_ENV=$ENVNAME

export TALER_ENV_NAME=$ENVNAME
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

mkdir -p "$HOME/sockets"
mkdir -p "$HOME/stamps"
mkdir -p "$HOME/taler-data"

ln -sf ../deployment/taler-build/Makefile stamps/
ln -sf ../deployment/taler-build/invalidate.sh stamps/

if [[ ! -d "worker" ]]; then
buildbot-worker create-worker $HOME/worker localhost:9989 "$ENVNAME-topper-worker" "$ENVNAME-topper-pass"
fi


mkdir -p ~/.config/systemd/user/
cp systemd-services/buildbot-worker-demo-topper.service ~/.config/systemd/user/

systemctl --user daemon-reload || echo "Please use 'machinectl shell demo-reserve-topper@.host' to log in to use this script"

systemctl --user enable buildbot-worker-demo-topper.service
systemctl --user start buildbot-worker-demo-topper.service