MAC 下 Vagrant 安装 Dokku
安装 Vagrant
- Download and install VirtualBox
- Download and install Vagrant
- Clone Dokku
git clone https://github.com/dokku/dokku.git
Create VM
shell
# Optional ENV arguments:
# - `BOX_NAME`
# - `BOX_URI`
# - `BOX_MEMORY`
# - `DOKKU_DOMAIN`
# - `DOKKU_IP`
# - `FORWARDED_PORT`.
cd path/to/dokku
vagrant up
如果有 IP 冲突的问题,修改 Vagrantfile circle.yml 中对应的 IP 地址
配置 Dokku 容器的 SSHKey
cat ~/.ssh/id_rsa.pub | ssh root@dokku.me "sudo sshcommand acl-add dokku progrium"
执行 dokku-installer
以 root 身份登录进 dokku 容器
ssh root@dokku.me
- Ubuntu 官方中国(目前是阿里云)
deb http://cn.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
#测试版源
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
# 源码
deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
##测试版源
deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
-
安装源
- 备份源
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup - 而后用gedit或其他编辑器打开:
Ubuntu Logo.png gksu gedit /etc/apt/sources.list Kubuntu Logo.png kdesudo kate /etc/apt/sources.list Xubuntu Logo.png gksu mousepad /etc/apt/sources.list Xubuntu Logo.png gksu leafpad /etc/apt/sources.list # 12.04 sudo apt edit-sources # CLI
- 备份源
更新源
sudo apt-get updateBash 方式安装 Dokku
# for debian systems, installs dokku via apt-get
$ wget https://raw.githubusercontent.com/dokku/dokku/v0.7.1/bootstrap.sh
$ sudo DOKKU_TAG=v0.7.1 bash bootstrap.sh
# go to your server's IP and follow the web installer
- APT 方式安装 Dokku
# install docker
$ wget -nv -O - https://get.docker.com/ | sh
# setup dokku apt repository
$ wget -nv -O - https://packagecloud.io/gpg.key | apt-key add -
$ export SOURCE="https://packagecloud.io/dokku/dokku/ubuntu/"
$ echo "deb $SOURCE trusty main" | tee /etc/apt/sources.list.d/dokku.list
$ apt-get update
# install dokku
$ apt-get install dokku
$ dokku plugin:install-dependencies --core # run with root!
# go to your server's IP and follow the web installer
建议配置 Docker 加速器
Daocolud
https://www.daocloud.io/mirror#accelerator-doc
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://ec635062.m.daocloud.io
如果 sudo DOKKU_TAG=v0.7.1 bash bootstrap.sh 执行速度很慢,建议先执行
docker pull gliderlabs/herokuish
如果 dokku 安装时提示 IP 冲突,需要修改 dokku/Vagrantfile dokku/circle.yml
并设置 /etc/hosts
例:
192.168.0.2 dokku.me
192.168.0.2 node-js-sample.dokku.me
一些参考
[Dokku和Docker的完美配合] (https://segmentfault.com/a/1190000002554114)
Dokku on Vagrant and AWS with Postgres
一些有用的资源
Heroku SRC
Dokku SRC
Dokku DOC
Using Vagrant and Docker Machine Together
登录 dokku
/Users/bison/__task/workspace/__lessons/__dokku/dokku
ssh root@dokku.me
git remote add dokku dokku@dokku.me:ruby-rails-sample
git push dokku master
dokku config:set nodejs-sample BUILDPACK_URL=https://git.coding.net/baisheng/local-buildpack-nodejs.git