2020-03-13 08:34:25 -05:00
|
|
|
#!/bin/bash
|
2020-03-27 08:47:42 -05:00
|
|
|
set -eo pipefail
|
2020-03-13 08:34:25 -05:00
|
|
|
|
|
|
|
. e2e/variables
|
|
|
|
|
2020-05-03 06:51:30 -05:00
|
|
|
PORT=${PORT:-$DEFAULT_PORT}
|
2020-12-23 08:42:20 -06:00
|
|
|
PACKAGE_FILE=${PACKAGE_FILE:-$DEFAULT_PACKAGE_FILE}
|
2020-05-03 06:51:30 -05:00
|
|
|
|
2020-03-13 08:34:25 -05:00
|
|
|
./e2e/kill-server
|
|
|
|
|
|
|
|
mkdir $RUNDIR
|
|
|
|
|
|
|
|
echo -e "Copying grafana backend files to temp dir..."
|
|
|
|
|
2020-12-23 08:42:20 -06:00
|
|
|
# Expand any wildcards
|
|
|
|
pkgs=(${PACKAGE_FILE})
|
|
|
|
pkg=${pkgs[0]}
|
|
|
|
if [[ -f ${pkg} ]]; then
|
|
|
|
echo "Found package tar file ${pkg}, extracting..."
|
|
|
|
tar zxf ${pkg} -C $RUNDIR
|
2020-03-13 08:34:25 -05:00
|
|
|
mv $RUNDIR/grafana-*/* $RUNDIR
|
|
|
|
else
|
2020-12-23 08:42:20 -06:00
|
|
|
echo "Couldn't find package ${PACKAGE_FILE} - copying local dev files"
|
|
|
|
|
|
|
|
if [[ ! -f bin/grafana-server ]]; then
|
|
|
|
echo bin/grafana-server missing
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-03-13 08:34:25 -05:00
|
|
|
|
|
|
|
cp -r ./bin $RUNDIR
|
|
|
|
cp -r ./public $RUNDIR
|
2020-04-10 09:37:26 -05:00
|
|
|
cp -r ./tools $RUNDIR
|
2020-03-13 08:34:25 -05:00
|
|
|
|
|
|
|
mkdir $RUNDIR/conf
|
|
|
|
mkdir $PROV_DIR
|
|
|
|
mkdir $PROV_DIR/datasources
|
|
|
|
mkdir $PROV_DIR/dashboards
|
|
|
|
|
|
|
|
cp ./conf/defaults.ini $RUNDIR/conf/defaults.ini
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -e "Copy provisioning setup from devenv"
|
|
|
|
|
|
|
|
cp devenv/datasources.yaml $PROV_DIR/datasources
|
|
|
|
cp devenv/dashboards.yaml $PROV_DIR/dashboards
|
|
|
|
|
|
|
|
cp -r devenv $RUNDIR
|
|
|
|
|
|
|
|
echo -e "Starting Grafana Server port $PORT"
|
|
|
|
|
|
|
|
$RUNDIR/bin/grafana-server \
|
|
|
|
--homepath=$RUNDIR \
|
|
|
|
--pidfile=$RUNDIR/pid \
|
|
|
|
cfg:server.http_port=$PORT \
|
|
|
|
cfg:app_mode=development
|
|
|
|
|
|
|
|
# 2>&1 > $RUNDIR/output.log &
|
|
|
|
# cfg:log.level=debug \
|
|
|
|
|