-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleaner log output
- Loading branch information
Showing
4 changed files
with
41 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ MAINTAINER Clement Buisson <[email protected]> | |
ENV DEBIAN_FRONTEND noninteractive | ||
RUN apt-get update && \ | ||
apt-get install -yq --no-install-recommends wget curl && \ | ||
wget --no-check-certificate --content-disposition "http://www.opscode.com/chef/download-server?p=ubuntu&pv=14.04&m=x86_64&v=12&prerelease=false&nightlies=false" && \ | ||
wget --no-check-certificate --content-disposition "http://www.opscode.com/chef/download-server?p=ubuntu&pv=14.04&m=x86_64&v=12.15.8&prerelease=false&nightlies=false" && \ | ||
dpkg -i chef-server*.deb && \ | ||
rm chef-server*.deb && \ | ||
apt-get remove -y wget && \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash -x | ||
#!/bin/bash | ||
|
||
# Create chef-server.rb with variables | ||
echo "nginx['enable_non_ssl']=false" > /etc/opscode/chef-server.rb | ||
|
@@ -15,19 +15,19 @@ else | |
echo "nginx['server_name']=\"$CONTAINER_NAME\"" >> /etc/opscode/chef-server.rb | ||
fi | ||
|
||
chef-server-ctl reconfigure |tee /root/out.txt | ||
echo -e "\nRunning: 'chef-server-ctl reconfigure'. This step will take a few minutes..." | ||
chef-server-ctl reconfigure | ||
|
||
URL="http://127.0.0.1:8000/_status" | ||
CODE=1 | ||
SECONDS=0 | ||
TIMEOUT=60 | ||
|
||
return=$(curl -sf ${URL}) | ||
echo "${URL} returns: ${return}" |tee -a /root/out.txt | ||
|
||
if [[ -z "$return" ]]; then | ||
echo "Error while running chef-server-ctl reconfigure" |tee -a /root/out.txt | ||
echo -e "Blocking until <${URL}> responds...\n" |tee -a /root/out.txt | ||
echo -e "\nINFO: Chef-Server isn't ready yet!" | ||
echo -e "Blocking until <${URL}> responds...\n" | ||
|
||
while [ $CODE -ne 0 ]; do | ||
|
||
|
@@ -41,30 +41,30 @@ if [[ -z "$return" ]]; then | |
CODE=$? | ||
|
||
sleep 2 | ||
echo -n "." |tee -a /root/out.txt | ||
echo -n "." | ||
|
||
if [ $SECONDS -ge $TIMEOUT ]; then | ||
echo "$URL is not available after $SECONDS seconds...stopping the script!" |tee -a /root/out.txt | ||
echo "$URL is not available after $SECONDS seconds...stopping the script!" | ||
exit 1 | ||
fi | ||
done; | ||
|
||
echo -e "\n\n$URL is available!\n" |tee -a /root/out.txt | ||
echo -e "\nSetting up admin user and default organization" |tee -a /root/out.txt | ||
chef-server-ctl user-create admin Admin User [email protected] "passwd" --filename /etc/chef/admin.pem |tee -a /root/out.txt | ||
chef-server-ctl org-create my_org "Default organization" --association_user admin --filename /etc/chef/my_org-validator.pem |tee -a /root/out.txt | ||
echo -e "\nRunning: chef-server-ctl install chef-manage" |tee -a /root/out.txt | ||
chef-server-ctl install chef-manage |tee -a /root/out.txt | ||
echo -e "\nRunning: chef-server-ctl reconfigure" |tee -a /root/out.txt | ||
chef-server-ctl reconfigure |tee -a /root/out.txt | ||
echo "{ \"error\": \"Please use https:// instead of http:// !\" }" > /var/opt/opscode/nginx/html/500.json | ||
sed -i "s,/503.json;,/503.json;\n error_page 497 =503 /500.json;,g" /var/opt/opscode/nginx/etc/chef_https_lb.conf | ||
sed -i '$i\ location /knife_admin_key.tar.gz {\n default_type application/zip;\n alias /etc/chef/knife_admin_key.tar.gz;\n }' /var/opt/opscode/nginx/etc/chef_https_lb.conf | ||
echo -e "\nCreating tar file with the Knife keys" |tee -a /root/out.txt | ||
cd /etc/chef/ && tar -cvzf knife_admin_key.tar.gz admin.pem my_org-validator.pem | ||
echo -e "\nRestart Nginx..." |tee -a /root/out.txt | ||
chef-server-ctl restart nginx | ||
chef-server-ctl status |tee -a /root/out.txt | ||
touch /root/chef_configured | ||
echo -e "\n\nDone!\n" |tee -a /root/out.txt | ||
fi | ||
|
||
echo -e "\n\n$URL is available!\n" | ||
echo -e "\nSetting up admin user and default organization" | ||
chef-server-ctl user-create admin Admin User [email protected] "passwd" --filename /etc/chef/admin.pem | ||
chef-server-ctl org-create my_org "Default organization" --association_user admin --filename /etc/chef/my_org-validator.pem | ||
echo -e "\nRunning: 'chef-server-ctl install chef-manage'"... | ||
chef-server-ctl install chef-manage | ||
echo -e "\nRunning: 'chef-server-ctl reconfigure'"... | ||
chef-server-ctl reconfigure | ||
echo "{ \"error\": \"Please use https:// instead of http:// !\" }" > /var/opt/opscode/nginx/html/500.json | ||
sed -i "s,/503.json;,/503.json;\n error_page 497 =503 /500.json;,g" /var/opt/opscode/nginx/etc/chef_https_lb.conf | ||
sed -i '$i\ location /knife_admin_key.tar.gz {\n default_type application/zip;\n alias /etc/chef/knife_admin_key.tar.gz;\n }' /var/opt/opscode/nginx/etc/chef_https_lb.conf | ||
echo -e "\nCreating tar file with the Knife keys" | ||
cd /etc/chef/ && tar -cvzf knife_admin_key.tar.gz admin.pem my_org-validator.pem | ||
echo -e "\nRestart Nginx..." | ||
chef-server-ctl restart nginx | ||
chef-server-ctl status | ||
touch /root/chef_configured | ||
echo -e "\n\nDone!\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
#!/bin/bash -xe | ||
sysctl -w kernel.shmmax=17179869184 | ||
#!/bin/bash -e | ||
sysctl -wq kernel.shmmax=17179869184 | ||
/opt/opscode/embedded/bin/runsvdir-start & | ||
if [ -f "/root/chef_configured" ] | ||
then | ||
echo -e "\nChef Server already configured!\n" |tee -a /root/out.txt | ||
chef-server-ctl status |tee -a /root/out.txt | ||
echo -e "\nChef Server already configured!\n" | ||
chef-server-ctl status | ||
else | ||
echo -e "\nNew install of Chef-Server!" | ||
/usr/local/bin/configure_chef.sh | ||
fi | ||
tail -F /opt/opscode/embedded/service/*/log/current |