MAC 下 Vagrant 安裝 Dokku

weixin_34185364發表於2018-05-29

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
  1. Ubuntu 官方中國(目前是阿里雲)

Ubuntu 14.4

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


  1. 安裝源

    • 備份源
      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
    
  2. 更新源
    sudo apt-get update

  3. Bash 方式安裝 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
  1. 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

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

一些參考

Install Dokku using Vagrant

[Dokku和Docker的完美配合] (https://segmentfault.com/a/1190000002554114)

Playing with Dokku on Vagrant

Vagrant and Dokku on OSX

Dokku on Vagrant and AWS with Postgres

一些有用的資源

Heroku SRC
Dokku SRC
Dokku DOC

Docker-machine

Docker-machine-SRC

Using Vagrant and Docker Machine Together

CNPM

tutum-mysql

登入 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

相關文章