-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetup_to_run_locally.sh
More file actions
executable file
·50 lines (47 loc) · 2.01 KB
/
setup_to_run_locally.sh
File metadata and controls
executable file
·50 lines (47 loc) · 2.01 KB
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
#! /bin/bash
HOST=$(hostname -i)
# Change service variables
echo "Changing Zenoss.cse variables"
for var in $(serviced service variable list Zenoss.cse | grep global.conf.auth0); do serviced service variable unset Zenoss.cse $var; done
serviced service variable set Zenoss.cse global.conf.cse-vhost $HOST
serviced service variable set Zenoss.cse global.conf.cse-virtualroot /cse
serviced service variable set Zenoss.cse cse.project zenoss-zing
serviced service variable set Zenoss.cse cse.tenant acme_corp
serviced service variable set Zenoss.cse cse.source wily_coyote
# Create a script to enable the emulator,
cat << EOF >> /tmp/enable_zing_emulator.sh
#!/bin/bash
sed -i '/^[ ]*use-emulator.*$/d' \$1
sed -i '/^[ ]*emulator-host-port.*$/d' \$1
sed -i '/^ *#use-emulator/a \ \ use-emulator: true' \$1
sed -i '/^ *#emulator-host-port/a \ \ emulator-host-port: $HOST:8085' \$1
EOF
chmod +x /tmp/enable_zing_emulator.sh
# Make edits to zing-connector config
echo "Changing zing-connector config"
serviced service config edit --editor /tmp/enable_zing_emulator.sh zing-connector /opt/zenoss/etc/zing-connector/zing-connector.yml
rm -f /tmp/enable_zing_emulator.sh
# Start the emulator running
echo "Stopping anything running locally on port 8085"
sudo pkill -f 8085
sleep 10
#
echo "Starting zing-connector emulator on port 8085"
docker run --rm --env CLOUDSDK_CORE_PROJECT=zenoss-zing -p 8085:8085 zenoss/gcloud-emulator:pubsub &
sleep 10
#
# Create a script to enable local logins
cat << EOF >> /tmp/enable_local_login.sh
#!/bin/bash
sed -i '/location ~\* \^\/zport\/acl_users\/cookieAuthHelper\/login/,+3 d' \$1
EOF
chmod +x /tmp/enable_local_login.sh
#
echo "Changing zproxy config to remove disable of local login"
serviced service config edit --editor /tmp/enable_local_login.sh Zenoss.cse /opt/zenoss/zproxy/conf/zproxy-nginx.conf
rm -f /tmp/enable_local_login.sh
#
# Just restart zproxy and zing-connector
echo "Restarting zproxy and zing-connector"
serviced service restart Zenoss.cse --auto-launch=False
serviced service restart zing-connector