diff --git a/Makefile b/Makefile index 74d2748cd..c05456e65 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS))) $(eval $(RUN_ARGS):;@:) endif -.PHONY: all install copyfiles version plugins dependencies sshcommand pluginhook docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku +.PHONY: all apt-update install copyfiles man-db version plugins dependencies sshcommand pluginhook docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku include tests.mk include deb.mk @@ -61,12 +61,18 @@ plugin-dependencies: pluginhook plugins: pluginhook docker dokku plugins-install -dependencies: sshcommand pluginhook docker help2man +dependencies: apt-update sshcommand pluginhook docker help2man man-db $(MAKE) -e stack +apt-update: + apt-get update + help2man: apt-get install -qq -y help2man +man-db: + apt-get install -qq -y man-db + sshcommand: wget -qO /usr/local/bin/sshcommand ${SSHCOMMAND_URL} chmod +x /usr/local/bin/sshcommand diff --git a/Vagrantfile b/Vagrantfile index f65b97ec8..af60cf386 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,8 +1,7 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -BOX_NAME = ENV["BOX_NAME"] || "trusty" -BOX_URI = ENV["BOX_URI"] || "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box" +BOX_NAME = ENV["BOX_NAME"] || "chef/ubuntu-14.04" BOX_MEMORY = ENV["BOX_MEMORY"] || "1024" DOKKU_DOMAIN = ENV["DOKKU_DOMAIN"] || "dokku.me" DOKKU_IP = ENV["DOKKU_IP"] || "10.0.0.2" @@ -19,7 +18,6 @@ Vagrant::configure("2") do |config| config.ssh.forward_agent = true config.vm.box = BOX_NAME - config.vm.box_url = BOX_URI config.vm.synced_folder File.dirname(__FILE__), "/root/dokku" config.vm.provider :virtualbox do |vb| @@ -36,7 +34,7 @@ Vagrant::configure("2") do |config| vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT vm.vm.hostname = "#{DOKKU_DOMAIN}" vm.vm.network :private_network, ip: DOKKU_IP - vm.vm.provision :shell, :inline => "DEBIAN_FRONTEND=noninteractive apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}" + vm.vm.provision :shell, :inline => "export DEBIAN_FRONTEND=noninteractive && apt-get update > /dev/null && apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}" vm.vm.provision :shell, :inline => "cd /root/dokku && make dokku-installer" end @@ -54,6 +52,6 @@ Vagrant::configure("2") do |config| if Pathname.new(PUBLIC_KEY_PATH).exist? config.vm.provision :file, source: PUBLIC_KEY_PATH, destination: '/tmp/id_rsa.pub' - config.vm.provision :shell, :inline => "rm -f /root/.ssh/authorized_keys && cp /tmp/id_rsa.pub /root/.ssh/authorized_keys" + config.vm.provision :shell, :inline => "rm -f /root/.ssh/authorized_keys && mkdir -p /root/.ssh && sudo cp /tmp/id_rsa.pub /root/.ssh/authorized_keys" end end diff --git a/bootstrap.sh b/bootstrap.sh index 942f63da2..488ab4fad 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,37 +1,69 @@ -#!/usr/bin/env bash +#!/bin/bash +# # A script to bootstrap dokku. # It expects to be run on Ubuntu 14.04 via 'sudo' +# If installing a tag higher than 0.3.13, it may install dokku via a package (so long as the package is higher than 0.3.13) # It checks out the dokku source code from Github into ~/dokku and then runs 'make install' from dokku source. set -eo pipefail export DEBIAN_FRONTEND=noninteractive export DOKKU_REPO=${DOKKU_REPO:-"https://github.com/progrium/dokku.git"} -if ! command -v apt-get &>/dev/null -then +if ! command -v apt-get &>/dev/null; then echo "This installation script requires apt-get. For manual installation instructions, consult http://progrium.viewdocs.io/dokku/advanced-installation ." exit 1 fi apt-get update -apt-get install -qq -y git make curl software-properties-common man-db help2man - [[ $(lsb_release -sr) == "12.04" ]] && apt-get install -qq -y python-software-properties -cd ~ -test -d dokku || git clone $DOKKU_REPO -cd dokku -git fetch origin +dokku_install_source() { + apt-get install -qq -y git make software-properties-common + cd /root + if [ ! -d /root/dokku ]; then + git clone $DOKKU_REPO /root/dokku + fi + + cd /root/dokku + git fetch origin + git checkout $DOKKU_CHECKOUT + make install +} + +dokku_install_package() { + curl --silent https://get.docker.io/gpg 2> /dev/null | apt-key add - > /dev/null 2>&1 + curl --silent https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - > /dev/null 2>&1 + + echo "deb http://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list + echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" > /etc/apt/sources.list.d/dokku.list + + sudo apt-get update > /dev/null + sudo apt-get install -qq -y "linux-image-extra-$(uname -r)" apt-transport-https + + if [[ -n $DOKKU_CHECKOUT ]]; then + sudo apt-get install -qq -y dokku=$DOKKU_CHECKOUT + else + sudo apt-get install -qq -y dokku + fi +} if [[ -n $DOKKU_BRANCH ]]; then - git checkout origin/$DOKKU_BRANCH + export DOKKU_CHECKOUT="origin/$DOKKU_BRANCH" + dokku_install_source elif [[ -n $DOKKU_TAG ]]; then - git checkout $DOKKU_TAG + export DOKKU_SEMVER="${DOKKU_TAG//v}" + major=$(echo $DOKKU_SEMVER | awk '{split($0,a,"."); print a[1]}') + minor=$(echo $DOKKU_SEMVER | awk '{split($0,a,"."); print a[2]}') + patch=$(echo $DOKKU_SEMVER | awk '{split($0,a,"."); print a[3]}') + + # 0.3.13 was the first version with a debian package + if [[ "$major" -eq "0" ]] && [[ "$minor" -lt "4" ]] && [[ "$patch" -lt "13" ]]; then + export DOKKU_CHECKOUT="$DOKKU_TAG" + dokku_install_source + else + export DOKKU_CHECKOUT="$DOKKU_SEMVER" + dokku_install_package + fi +else + dokku_install_package fi - -make install - -echo -echo "Almost done! For next steps on configuration:" -echo " http://progrium.viewdocs.io/dokku/advanced-installation#user-content-configuring" - diff --git a/deb.mk b/deb.mk index c10fdb89f..a2e4460c7 100644 --- a/deb.mk +++ b/deb.mk @@ -61,7 +61,7 @@ deb-all: deb-buildstep deb-dokku deb-gems deb-pluginhook deb-sshcommand deb-setup: echo "-> Updating deb repository and installing build requirements" sudo apt-get update > /dev/null - sudo apt-get install -qq -y git ruby1.9.1-dev 2>&1 > /dev/null + sudo apt-get install -qq -y gcc git ruby1.9.1-dev 2>&1 > /dev/null command -v fpm > /dev/null || sudo gem install fpm --no-ri --no-rdoc ssh -o StrictHostKeyChecking=no git@github.com || true diff --git a/docs/advanced-installation.md b/docs/advanced-installation.md index 348eb7270..9ee60240f 100644 --- a/docs/advanced-installation.md +++ b/docs/advanced-installation.md @@ -3,7 +3,7 @@ You can always install dokku straight from the latest - potentially unstable - master release via the following bash command: ```shell -wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash +wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo DOKKU_BRANCH=master bash ``` ## Development @@ -29,7 +29,7 @@ The bootstrap script allows the dokku repository URL to be overridden to bootstr ```shell wget https://raw.github.com/progrium/dokku/master/bootstrap.sh chmod +x bootstrap.sh -sudo DOKKU_REPO=https://github.com/yourusername/dokku.git ./bootstrap.sh +sudo DOKKU_REPO=https://github.com/yourusername/dokku.git DOKKU_BRANCH=master ./bootstrap.sh ``` ## Custom buildstep build diff --git a/docs/getting-started/install/debian.md b/docs/getting-started/install/debian.md new file mode 100644 index 000000000..42374c7ef --- /dev/null +++ b/docs/getting-started/install/debian.md @@ -0,0 +1,15 @@ +# Debian Package Installation Notes + +As of 0.3.18, dokku defaults to being installed via debian package. While certain hosts may require extra work to get running, you may optionally wish to automate the installation of dokku without the use of our `bootstrap.sh` bash script. The following are the steps run by said script: + +```shell +curl --silent https://get.docker.io/gpg 2> /dev/null | apt-key add - 2>&1 >/dev/null +curl --silent https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - 2>&1 >/dev/null + +echo "deb http://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list +echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" > /etc/apt/sources.list.d/dokku.list + +sudo apt-get update > /dev/null +sudo apt-get install -qq -y linux-image-extra-`uname -r` apt-transport-https +sudo apt-get install -qq -y dokku +``` diff --git a/docs/installation.md b/docs/installation.md index 7c532fd6c..420cffb73 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -11,14 +11,9 @@ Ubuntu 14.04 x64 x64. Ideally have a domain ready to point to your host. It's de To install the latest stable version of dokku, you can run the following bootstrapper command: ```shell -# This may need to be run twice +# installs dokku via apt-get wget -qO- https://raw.github.com/progrium/dokku/v0.3.17/bootstrap.sh | sudo DOKKU_TAG=v0.3.17 bash -# Install the web installer. See `Configuring` under -# `Advanced Install Customization` if you wish to perform the -# rest of the install via CLI -cd /root/dokku && make dokku-installer - # Go to your server's IP and follow the web installer ``` @@ -29,5 +24,6 @@ For various reasons, certain hosting providers may have other steps that should As well, you may wish to customize your installation in some other fashion. or experiment with vagrant. The guides below should get you started: +- [Debian Package Installation Notes](http://progrium.viewdocs.io/dokku/getting-started/install/debian) - [Vagrant Installation Notes](http://progrium.viewdocs.io/dokku/getting-started/install/vagrant) - [Advanced Install Customization](http://progrium.viewdocs.io/dokku/advanced-installation) diff --git a/docs/upgrading.md b/docs/upgrading.md index 1f49f6adc..a2a02e4e6 100644 --- a/docs/upgrading.md +++ b/docs/upgrading.md @@ -1,73 +1,62 @@ # Upgrading -Dokku is in active development. You can update the deployment step and the build step separately. +This document covers upgrades for the 0.3.0 series and up. If upgrading from previous versions, we recommend [a fresh install](http://progrium.viewdocs.io/dokku/installation) on a new server. -**Note**: If you are upgrading from a revision prior to [27d4bc8c3c](https://github.com/progrium/dokku/commit/27d4bc8c3c19fe580ef3e65f2f85b85101cd83e4), follow the instructions in [this wiki entry](https://github.com/progrium/dokku/wiki/Migrating-to-Dokku-0.2.0). +> As of 0.3.18, dokku is installed by default via a debian package. Source-based installations are still available, though not recommended. -To update the deploy step (this is updated less frequently): +## Dokku + +If dokku was installed via a debian package, you can upgrade dokku via the following command: + +```shell +sudo apt-get install dokku +``` + +For unattended upgrades, you may run the following command: + +```shell +sudo apt-get install -qq -y dokku +``` + +If you have installed dokku from source, you may run the following commands to upgrade: ```shell cd ~/dokku git pull --tags origin master + +# continue to install from source +sudo DOKKU_BRANCH=master make install + +# upgrade to debian package-based installation sudo make install ``` -Nothing needs to be restarted. Changes will take effect on the next push / deployment. - -To update the build step: +All changes will take effect upon next application deployment. To trigger a rebuild of every application, simply run the following command: ```shell +dokku ps:rebuildall +``` + +## Buildstep image + +If dokku was installed via a debian package, you can upgrade buildstep via the following command: + +```shell +sudo apt-get install buildstep +``` + +For unattended upgrades, you may run the following command: + +```shell +sudo apt-get install -qq -y buildstep +``` + +In some cases, it may be desirable to run a specific version of buildstep. To install/upgrade buildstep from source, run the following commands: + +```shell +cd /tmp git clone https://github.com/progrium/buildstep.git cd buildstep git pull origin master sudo make build ``` - -This will build a fresh Ubuntu Quantal image, install a number of packages, and -eventually replace the Docker image for buildstep. - -## Migrating from 0.1.0 to 0.2.0 - -This should be summary of breaking changes between 0.1 and 0.2 version with instructions to upgrade. - -### software-properties-common - -software-properties-common is now a dependency for plugins. Before running dokku install script, make sure it is installed. - -```shell -> sudo apt-get install software-properties-common -``` - -### Gitreceive removed - -PR [#270](https://github.com/progrium/dokku/pull/270). - -Starting with Dokku 0.2.0, [Gitrecieve](https://github.com/progrium/gitreceive) is replaced by a `git` plugin. - -Dokku no longer uses the `git` user. Everything is done with the `dokku` user account. - -This causes the remote url to change. Instead of pushing to `git@hostname:app`, you should now push to `dokku@hostname:app`. -The url must be modified using the `git remote set-url` command : - - git remote set-url deploy dokku@hostname:app - -Where `deploy` is the name of the remote. - -Additionally, the repositiories on the server must be migrated to work with dokku 0.2.0 - -There is an upgrade [script](https://gist.github.com/plietar/7201430), which is meant to automate this migration. To use it: - -1. run the script as root -2. `git pull` to get the latest version of dokku -3. make install -4. `dokku ps:restartall` - -TDB. - -### Cache directory - -Commit [#6350f373](https://github.com/progrium/dokku/commit/6350f373be2cef4f3bb90912099e1be6196522d1) - -Buildstep have to be re-installed in order to support cache directory. - -TDB.