您的位置:首页 > 运维架构 > Docker

使用 Tsuru 和 Docker 构建自己的 PaaS 系统

2014-05-16 00:00 246 查看
摘要: 该文档描述如何使用 Tsuru 和 Docker 构建自己的私有 PaaS 服务。

文档假设你已经在64位的 Ubuntu 12.04 LTS 上安装了 Tsuru。

安装之前

开始安装之前,需要先安装 curl 和 python-software-properties 两个软件包,这两个软件包用来安装额外的资源库。

sudo apt-get update
sudo apt-get install curl python-software-properties -qqy


添加资源库

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
echo "deb http://get.docker.io/ubuntu docker main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-add-repository ppa:tsuru/lvm2 -y
sudo apt-add-repository ppa:tsuru/ppa -y
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update


安装 MongoDB

sudo apt-get install mongodb-10gen -qqy


安装 beanstalkd

sudo apt-get install beanstalkd -qqy
cat > /tmp/default-beanstalkd <<EOF
> BEANSTALKD_LISTEN_ADDR=127.0.0.1
> BEANSTALKD_LISTEN_PORT=11300
> DAEMON_OPTS="-l \$BEANSTALKD_LISTEN_ADDR -p \$BEANSTALKD_LISTEN_PORT -b /var/lib/beanstalkd"
> START=yes
> EOF
sudo mv /tmp/default-beanstalkd /etc/default/beanstalkd
sudo service beanstalkd start


安装 redis

sudo apt-get install redis-server -qqy


安装 hipache

sudo apt-get install node-hipache -qqy
sudo start hipache


安装 docker

sudo apt-get install lxc-docker -qqyecho export DOCKER_OPTS=\"-H 127.0.0.1:4243\" | sudo tee -a /etc/default/dockerecho export DOCKER_HOST=127.0.0.1:4243 >> ~/.bashrc
sudo stop docker
sudo start docker


安装 gandalf

sudo apt-get install gandalf-server -qqyhook_dir=/home/git/bare-template/hooks
sudo mkdir -p $hook_dirsudo curl https://raw.githubusercontent.com/tsuru/tsuru/master/misc/git-hooks/post-receive -o ${hook_dir}/post-receive
sudo&n
3ff0
bsp;chmod +x ${hook_dir}/post-receive
sudo chown -R git:git /home/git/bare-template# make sure you write the public IP of the machine in the "host" parameter# in the /etc/gandalf.conf filesudo start gandalf-server
sudo start git-daemon


安装 tsuru API server

sudo apt-get install tsuru-server -qqy
sudo curl http://script.cloud.tsuru.io/conf/tsuru-docker-single.conf -o /etc/tsuru/tsuru.conf# make sure you replace all occurrences of {{{HOST_IP}}} with the machine's# public IP in the /etc/tsuru/tsuru.conf filesudo sed -i -e 's/=no/=yes/' /etc/default/tsuru-server
sudo start tsuru-ssh-agent
sudo start tsuru-server-api
sudo start tsuru-server-collector


平台安装

curl https://raw.githubusercontent.com/tsuru/tsuru/master/misc/platforms-setup.js | mongo tsuru

这样它们就从 basebuilder 被安装到你指定的系统中,例如 Python:

docker build --no-cache -t tsuru/python https://raw.githubusercontent.com/flaviamissi/basebuilder/master/python/Dockerfile[/code] 将 Python 替换成其他平台(你可以检查 basebuilder 来获取支持的平台列表).

使用 tsuru 客户端

恭喜你,现在你已经有一个可以运行的 tsuru 服务器了,你可以参考 tsuru client usage guide 来开始构建你的应用程序。

添加服务

这里有一份完整的关于如何一步步的安装 MySQL 服务的文档:Install and configure a MySQL service.

DNS 服务器

你也可以给 Tsuru 集成一个 DNS 服务器,可参考 Here you can find an example of using bind as a DNS forwarder, 与 Tsuru 进行集成。

原文地址: http://www.oschina.net/translate/build-your-own-paas-with-tsuru-and-docker
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ubuntu Tsuru paas