-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprep
More file actions
executable file
·123 lines (103 loc) · 3.89 KB
/
Copy pathprep
File metadata and controls
executable file
·123 lines (103 loc) · 3.89 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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
#
# Make a devenv into a C9 node capable of 15k gears.
# This script may be run multiple times, make it idempotent.
#
# Stop services using the old openshift dir
service ruby193-mcollective stop
service httpd stop
service openshift-node-web-proxy stop
service rhc-broker stop
source /etc/openshift/node.conf
# Switching to ephemeral storage for speed and space
if [ `stat -f -c '%i' /var/lib/openshift` == `stat -f -c '%i' /var` ]
then
# We have gears? nuke them. Allow this to fail.
# grep ":${GEAR_GECOS}:" /etc/passwd | cut -f 1 -d : | while read gearn
# do
# (
# for f in /var/lib/openshift/$gearn/.env/*; do
# source $f
# done
# OPENSHIFT_APP_DOMAIN=`echo $OPENSHIFT_APP_DNS | cut -f 1 -d . | cut -f 2 -d -`
# oo-app-destroy \
# --with-container-uuid "$OPENSHIFT_GEAR_UUID" \
# --with-container-name "$OPENSHIFT_GEAR_NAME" \
# --with-app-uuid "$OPENSHIFT_APP_NAME" \
# --with-app-name "$OPENSHIFT_APP_UUID" \
# --with-namespace "$OPENSHIFT_APP_DOMAIN"
# ) || :
# done
# Backup existing files
( cd /var/lib/openshift; tar -czf /var/lib/openshift.tgz ./ )
# Disable quotas on /var
quotaoff -ug /var
rm -f /var/aquota.user
sed -i -e 's|,usrjquota=aquota.user,jqfmt=vfsv0||' /etc/fstab
# Setup the device for openshift
trydevs=( `tail -n +3 /proc/partitions | awk '{ print $4 }' | grep -v '[0-9]'` )
diskdevs=()
diskcount=0
for d in "${trydevs[@]}"
do
if [ -e "/dev/${d}" ]
then
if ! grep -q "$d" /proc/mounts
then
dd if=/dev/zero of="/dev/${d}" bs=1024k count=100
diskdevs=( "${diskdevs[@]}" "/dev/${d}" )
diskcount=$(( $diskcount + 1 ))
fi
fi
done
# Make a raid if we have more than one disk
if [ $diskcount -gt 1 ]; then
mdadm --create md0 --level=stripe --raid-disks=$diskcount "${diskdevs[@]}"
diskdevs="/dev/md/md0"
fi
# Make openshift and setup quotas
mkfs.ext4 -O ^has_journal "$diskdevs"
tune2fs -c 0 -i 0 "$diskdevs"
tune2fs -L 'openshift' "$diskdevs"
tune2fs -o +nobarrier "$diskdevs"
echo 'LABEL=openshift /var/lib/openshift ext4 defaults,usrjquota=aquota.user,jqfmt=vfsv0 1 1' >> /etc/fstab
mount -a
# Restore OpenShift
( cd /var/lib/openshift; tar -xzf /var/lib/openshift.tgz )
setenforce 0
quotacheck -cmuf /var/lib/openshift
restorecon -r /var/lib/openshift
setenforce 1
quotaon -u /var/lib/openshift
# And we need a big swap
dd if=/dev/zero of=/var/lib/openshift/.swapfile bs=1024k count=8192
restorecon /var/lib/openshift/.swapfile
mkswap -f /var/lib/openshift/.swapfile
swapon /var/lib/openshift/.swapfile
fi
# We're creating thousands of directories already.
sed -i -e 's|CREATE_APP_SYMLINKS=1|CREATE_APP_SYMLINKS=0|' /etc/openshift/node.conf
sed -i -e 's|GEAR_MAX_UID=6999|GEAR_MAX_UID=262143|' /etc/openshift/node.conf
# Keep the node alive for a long time
echo "HOURS=66666" > /etc/charlie.conf
# Need these for testing
rpm -q setools-console || yum -y install setools-console
rpm -q nc || yum -y install nc
gem install ruby-progressbar
# Remove expensive crontabs
rm -f /etc/cron.*/openshift-origin-cron-*
rm -f /etc/cron.daily/openshift_tmpwatch.sh
rm -f /etc/cron.daily/mlocate.cron
rm -f /etc/cron.hourly/charlie
rm -f ./cron.minutely/openshift-facts
crontab -u root -r || :
service crond reload
# Setup resource limits for C9
rm -f /etc/openshift/resource_limits.conf
ln -sf resource_limits.conf.c9 /etc/openshift/resource_limits.conf
# Restart services which were offline for prep
service ruby193-mcollective start
service httpd start
service openshift-node-web-proxy start
# Disable services which are still too expensive for C9
service openshift-watchman stop ; chkconfig openshift-watchman off