Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yae #1

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
url = https://github.com/cloudfoundry/vcap-services.git
[submodule "uaa"]
path = uaa
url = https://github.com/cloudfoundry/uaa.git
url = https://github.com/limengyun2008/uaa.git
[submodule "acm"]
path = acm
url = https://github.com/cloudfoundry/acm.git
url = https://github.com/limengyun2008/acm.git
[submodule "cloud_controller"]
path = cloud_controller
url = https://github.com/cloudfoundry/cloud_controller.git
url = https://github.com/limengyun2008/cloud_controller.git
[submodule "router"]
path = router
url = https://github.com/cloudfoundry/router.git
url = https://github.com/limengyun2008/router.git
[submodule "dea"]
path = dea
url = https://github.com/cloudfoundry/dea.git
url = https://github.com/limengyun2008/dea.git
[submodule "stager"]
path = stager
url = https://github.com/cloudfoundry/stager.git
url = https://github.com/limengyun2008/stager.git
[submodule "tests"]
path = tests
url = https://github.com/cloudfoundry/vcap-yeti.git
187 changes: 187 additions & 0 deletions dev_setup/bin/vcap_dev_setup_centos6
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
#!/bin/bash
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

安装启动脚本,copy了原来vcap_dev_setup 做了修改

# Copyright (c) 2012 VMware, Inc.
# Install vcap components on Ubuntu systems.

set -o errexit

usage() {
cat <<EOF
usage: $0 options

OPTIONS:
-h Show this message
-a Answer yes to all questions
-p http proxy i.e. -p http://username:password@host:port/
-c deployment config
-d cloudfoundry home
-D cloudfoundry domain (default: vcap.me)
-r cloud foundry repo base
-b cloud foundry repo branch/tag/SHA
EOF
}

function run_cmd () {
if [ -z "$PROXY" ]; then
sudo $*
else
sudo env http_proxy=$PROXY $*
fi
}

function clear_bundler_settings () {
[ $# -ge 1 ] || return 1
local DIR=$1
# Do we have a Bundler problem?
find $DIR -type d -name .bundle | grep -Fq .bundle || return 0
if [ "$ALL" != true ]; then
read -p "Remembered Bundler options could cause you troubles, do you want me to clear them for you? [Y/n]"
[[ $REPLY =~ ^[nN] ]] && return 0
fi
(cd $DIR && find -type d -name .bundle -prune -exec rm -r {} \; )
}

RUBY="/usr/bin/ruby"
GEM="/usr/bin/gem"

if [ -n "$http_proxy" ]; then
if [ -z "$https_proxy" ]; then
echo "Please set https_proxy env variable."
exit 1
fi
PROXY=$http_proxy
fi

while getopts "had:p:c:D:r:b:" OPTION
do
case $OPTION in
h)
usage
exit 1
;;
a)
ALL=true
;;
c)
CONFIG_FILE=$OPTARG
;;
d)
CLOUDFOUNDRY_HOME=$OPTARG
;;
D)
CLOUDFOUNDRY_DOMAIN=$OPTARG
;;
r)
VCAP_REPO_BASE=$OPTARG
;;
b)
VCAP_REPO_BRANCH=$OPTARG
;;
p)
PROXY=$OPTARG
export http_proxy=$PROXY
export https_proxy=$PROXY
esac
done

if [ -z "$CLOUDFOUNDRY_HOME" ]; then
CLOUDFOUNDRY_HOME=~/cloudfoundry
fi

if [ -z "$CLOUDFOUNDRY_DOMAIN" ]; then
CLOUDFOUNDRY_DOMAIN=vcap.me
fi

if [ -z "$VCAP_REPO_BASE" ]; then
VCAP_REPO_BASE=https://github.com/limengyun2008
fi

if [ -z "$VCAP_REPO_BRANCH" ]; then
VCAP_REPO_BRANCH=yae
fi

# Check if we have access to the web
echo "Installing wget..."
if ! run_cmd yum install wget; then
echo "Can't install prerequisite: wget"
exit 1
fi

echo "Checking web connectivity."
#if ! wget -q -T 2 -t 2 -O - http://api.cloudfoundry.com/info | grep "Cloud Application Platform" > /dev/null; then
# echo "Giving up. Cannot connect to the web. Check your proxy settings if you are behind a proxy."
# exit 1
#fi

# Install chef
readonly PREREQUISITES=(ruby ruby-devel ruby-lib ruby-rdoc ruby-ri ruby-irb gcc gcc-c++ kernel-devel openssl make)
echo "Installing prerequisites..."
run_cmd yum install "${PREREQUISITES[@]}"

if [ ! -f ${GEM} ] || [ `${GEM} -v` \< "1.3.6" ]; then
# Blobstore_client requires gem >= 1.3.6
echo "Installing rubygems..."
CWD=`pwd`
cd /tmp
wget -q http://production.cf.rubygems.org/rubygems/rubygems-1.3.6.tgz
tar zxf rubygems-1.3.6.tgz
cd rubygems-1.3.6
sudo ${RUBY} setup.rb --no-format-executable > /dev/null
cd ${CWD}
fi
echo "install dependencies"
sudo ${GEM} install net-ssh -v 2.2.2 --no-ri --no-rdoc
sudo ${GEM} install net-ssh-gateway -v 1.1.0 --no-ri --no-rdoc
sudo ${GEM} install net-ssh-multi -v 1.1 --no-ri --no-rdoc

echo "Installing chef..."
CHEF_VERSION="10.16.4"
${GEM} list -i chef -v ${CHEF_VERSION} || sudo ${GEM} install chef --version ${CHEF_VERSION} -q --no-ri --no-rdoc > /dev/null

# Install blobstore_client
echo "Installing blobstore_client..."
BLOB_VERSION="0.4.0"
${GEM} list -i blobstore_client -v ${BLOB_VERSION} || sudo ${GEM} install blobstore_client --version ${BLOB_VERSION} -q --no-ri --no-rdoc > /dev/null

# Install rake
echo "Installing rake..."
${GEM} list -i rake -i || sudo ${GEM} install rake -q --no-ri --no-rdoc > /dev/null

# Clone cloudfoundry repo
echo "Installing git..."
run_cmd yum install git

[ -d $CLOUDFOUNDRY_HOME ] || mkdir $CLOUDFOUNDRY_HOME
REPO=vcap
if [ ! -d $CLOUDFOUNDRY_HOME/${REPO} ]; then
if ! (cd $CLOUDFOUNDRY_HOME
git clone --no-checkout $VCAP_REPO_BASE/$REPO
cd $REPO
git checkout $VCAP_REPO_BRANCH
git submodule update --recursive --init
); then
echo "Unable to clone cloudfoundry $REPO repo."
exit 1
fi
else
clear_bundler_settings $CLOUDFOUNDRY_HOME/$REPO
fi


# Launch chef
ARGS=""
if [ -n "$CLOUDFOUNDRY_HOME" ]; then
ARGS="-d $CLOUDFOUNDRY_HOME"
fi

if [ -n "$CLOUDFOUNDRY_DOMAIN" ]; then
ARGS="$ARGS -D $CLOUDFOUNDRY_DOMAIN"
fi

if [ -n "$CONFIG_FILE" ]; then
ARGS="$ARGS -c $CONFIG_FILE"
fi

echo ""
echo "Launching chef..."
sleep 3
$CLOUDFOUNDRY_HOME/vcap/dev_setup/lib/chefsolo_launch.rb $ARGS
1 change: 1 addition & 0 deletions dev_setup/cookbooks/cloud_controller/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
default[:cloud_controller][:staging][:wsgi] = "wsgi.yml"
default[:cloud_controller][:staging][:standalone] = "standalone.yml"
default[:cloud_controller][:staging][:play] = "play.yml"
default[:cloud_controller][:staging][:resin] = "resin.yml"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新加一个框架支持的话,需要在vmc和cc两端的配置都加上配置,这也是1.0不合理的地方。


# Default builtin services
default[:cloud_controller][:builtin_services] = ["redis", "mongodb", "mysql", "neo4j", "rabbitmq", "postgresql", "vblob", "memcached", "filesystem", "elasticsearch", "couchdb", "echo"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ allow_registration: true

# Allow applications to register URIs that are outside your domain.
# Legacy (FIXME REMOVE)
allow_external_app_uris: false
allow_external_app_uris: true
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这俩配置必须开成true 才能允许外部的url指向。如果为false的话就不能自定义域名了


# This dicatates what the uri namespace rules
# are for applications. Admins can overide any of the
# below accept taking a used uri.

app_uris:
# Allow applications to register URIs that are outside your domain.
allow_external: false
allow_external: true
# reserved_file:
# reserved_list: [www, test, dash, register, foo, bar]
# reserved_length: 3
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name: "resin"
runtimes:
- "java":
default: true
detection:
- "*.war": true

# vim: filetype=yaml
3 changes: 2 additions & 1 deletion dev_setup/cookbooks/dea/attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
default[:dea][:config_file] = "dea.yml"
default[:dea][:local_route] = nil
default[:dea][:runtimes] = ["ruby18", "ruby19", "ruby193", "node04", "node06", "node08", "java", "java7", "erlang", "php", "python2"]
#default[:dea][:runtimes] = ["ruby18", "ruby19", "ruby193", "node04", "node06", "node08", "java", "java7", "erlang", "php", "python2"]
default[:dea][:runtimes] = ["java", "php", "python2"]
default[:dea][:logging] = 'debug'
default[:dea][:secure] = false
default[:dea][:multi_tenant] = true
Expand Down
13 changes: 11 additions & 2 deletions dev_setup/cookbooks/dea/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@
# Copyright 2011, VMWARE
#
#
%w{lsof psmisc librmagick-ruby}.each do |pkg|
package pkg

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不同平台的依赖包不同,有的有对应关系,有的没有,一般靠yum list keyword + google 试出来的

case node['platform']
when "ubuntu"
%w{lsof psmisc librmagick-ruby}.each do |pkg|
package pkg
end
when "centos"
%w{lsof psmisc}.each do |pkg|
package pkg
end
end

node[:dea][:runtimes].each do |runtime|
Expand All @@ -30,6 +38,7 @@
end
end


template node[:dea][:config_file] do
path File.join(node[:deployment][:config_path], node[:dea][:config_file])
source "dea.yml.erb"
Expand Down
22 changes: 21 additions & 1 deletion dev_setup/cookbooks/essentials/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# Copyright 2011, VMWARE
#
#

case node.platform
when "ubuntu"
%w{apt-utils build-essential libssl-dev
libxml2 libxml2-dev libxslt1.1 libxslt1-dev git-core sqlite3 libsqlite3-ruby
libsqlite3-dev unzip zip ruby-dev libmysql-ruby libmysqlclient-dev libcurl4-openssl-dev}.each do |p|
Expand Down Expand Up @@ -41,6 +42,25 @@
EOH
end

if node[:deployment][:profile]
file node[:deployment][:profile] do
owner node[:deployment][:user]
group node[:deployment][:group]
content "export PATH=#{node[:ruby][:path]}/bin:`#{node[:ruby][:path]}/bin/gem env gempath`/bin:$PATH"
end
end

when "centos"
%w{gcc gcc-c++ kernel-devel openssl-devel libxml2 libxml2-devel libxslt libxslt-devel sqlite sqlite-devel mysql-devel
postgresql postgresql-devel patch
}.each do |p|
package p do
action [:install]
end
end
end


if node[:deployment][:profile]
file node[:deployment][:profile] do
owner node[:deployment][:user]
Expand Down
4 changes: 2 additions & 2 deletions dev_setup/cookbooks/imagemagick/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

case node['platform']
when "ubuntu"

%w[ imagemagick libmagickcore-dev libmagickwand-dev ].each {|pkg| package pkg }

when "centos"
%w[ ImageMagick ImageMagick-devel ].each {|pkg| package pkg }
else
Chef::Log.error("Installation of ImageMagick is not supported on this platform.")
end
2 changes: 1 addition & 1 deletion dev_setup/cookbooks/java/attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include_attribute "deployment"
default[:java6][:java_home] = "/usr/lib/jvm/java-6-openjdk/jre"
default[:java6][:java_home] = "/usr/java/jdk"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

centos 默认java路径不同

default[:java6][:path] = default[:java6][:java_home] + "/bin"
4 changes: 3 additions & 1 deletion dev_setup/cookbooks/java/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
# Copyright 2011, VMware
#
#
package "python-software-properties"

case node['platform']
when "ubuntu"
package "python-software-properties"
package 'default-jdk'
# FIXME: add other major distro support
when "centos"

else
Chef::Log.error("Installation of Sun Java packages not supported on this platform.")
end
5 changes: 0 additions & 5 deletions dev_setup/cookbooks/maven/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@

include_recipe "java"

case node.platform
when "redhat", "centos", "fedora"
include_recipe "jpackage"
end

maven_tarball_path = File.join(node[:deployment][:setup_cache], "apache-maven-#{node[:maven][:version]}.tar.gz")
cf_remote_file maven_tarball_path do
owner node[:deployment][:user]
Expand Down
Loading