forked from edwardsp/azcycle
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcyclecloud_install.sh
More file actions
75 lines (57 loc) · 2.54 KB
/
cyclecloud_install.sh
File metadata and controls
75 lines (57 loc) · 2.54 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
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
#! /bin/bash
yum install -y java-1.8.0-openjdk wget
download_uri=$1
licenseURL=$2
cycle_root=/opt/cycle_server
rm -rf /tmp/cycle_install_dir
mkdir -p /tmp/cycle_install_dir
pushd /tmp/cycle_install_dir
wget $download_uri/cycle_server-all-linux64.tar.gz
wget $download_uri/pogo-cli.linux64.tar.gz
wget $download_uri/cyclecloud-cli.linux64.tar.gz
tar xf cyclecloud-cli.linux64.tar.gz
mv cyclecloud /usr/local/bin
tar xf pogo-cli.linux64.tar.gz
mv pogo /usr/local/bin
tar xf cycle_server-all-linux64.tar.gz
pushd cycle_server
./install.sh --nostart
# Increase the webserver heapsize by default
sed -i 's/webServerMaxHeapSize\=2048M/webServerMaxHeapSize\=4096M/' $cycle_root/config/cycle_server.properties
# Change 8080 and 8443 to 80 and 443. Enable HTTPS.
sed -i 's/webServerPort\=8080/webServerPort\=80/' $cycle_root/config/cycle_server.properties
sed -i 's/webServerSslPort\=8443/webServerSslPort\=443/' $cycle_root/config/cycle_server.properties
sed -i 's/webServerEnableHttps\=false/webServerEnableHttps=true/' $cycle_root/config/cycle_server.properties
# Generate self-signed SSL cert, add to CycleCloud server keystore
randomPW=$(strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 12 | tr -d '\n'; echo)
/bin/keytool -genkey -alias CycleServer -keypass "$randomPW" -keystore $cycle_root/.keystore -storepass "$randomPW" -keyalg RSA -noprompt -dname "CN=cycleserver.azure.com,OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown"
chown cycle_server. $cycle_root/.keystore
chmod 600 $cycle_root/.keystore
sed -i "s/webServerKeystorePass\=changeit/webServerKeystorePass\=$randomPW/" $cycle_root/config/cycle_server.properties
# get a license
curl -f -L -S -o $cycle_root/license.dat "$licenseURL"
chown cycle_server. $cycle_root/license.dat
ls -la $cycle_root/license.dat
# Start the CycleCloud server, wait for startup to complete before exiting.
$cycle_root/cycle_server start
$cycle_root/cycle_server await_startup
$cycle_root/cycle_server status
# setup ssh key for cycle
# Ensure your .ssh directory exists
mkdir -p ~/.ssh
# Generate the key pair without passphrase
rm -f ~/.ssh/cyclecloud*
ssh-keygen -f ~/.ssh/cyclecloud -t rsa -b 2048 -P ""
# Rename the private key to have a .pem extension
mv ~/.ssh/cyclecloud ~/.ssh/cyclecloud.pem
mkdir -p $cycle_root/.ssh
chown cycle_server:cycle_server $cycle_root/.ssh
cp ~/.ssh/cyclecloud.pem $cycle_root/.ssh/cyclecloud.pem
chmod 600 $cycle_root/.ssh/cyclecloud.pem
chown cycle_server:cycle_server $cycle_root/.ssh/cyclecloud.pem
ls -al $cycle_root/.ssh
# cleanup
popd
rm -rf cycle_server
popd
rm -rf /tmp/cycle_install_dir