This process is basically the same on Windows, OSX, and Linux. If running Linux, you can skip virtualbox if you want to run docker locally.
- VirtualBox 5+ and Docker Toolbox
- PHP & Git.
- Composer:
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
- Terra:
composer global require terra/cli:dev-master
- Drush:
composer global require drush/drush
- Put
export PATH="$HOME/.composer/vendor/bin:$PATH"
in your.bash_profile
file to maketerra
anddrush
executable. - Open Applications > Docker > Docker Quickstart Terminal or Kitematic (Docker UI). Either way, you will have to first wait for the VM to download and start.
- Launch Docker Quickstart Terminal or click the Docker Cli button in Kitematic to open a terminal.
- Type
terra
to make sure it works. You will see a list of commands. - Type
terra app:add
. All you need is a git URL with your site. There are no arguments or options required. It will walk you through creating a new environment as well, and then ask if you'd like to enable it. - When you enable your environment the first time, it will take time to download all of the Docker containers. Please be patient. Once they are downloaded this enabling environments is very fast.
- Once the environment enables, Terra will show you the system URL, usually something like http://local.computer:35000. Click that and you should see your drupal site. (See below for more on local.computer)
- Setup your database connection info in settings.php:
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => 'drupal',
'username' => 'drupal',
'password' => 'drupal',
'host' => 'database',
);
It's always the same, for every site.
- Try the drush alias to ensure the DB is connected and the containers are running
$ drush @APP.ENVIRONMENT ssh
$ drush @APP.ENVIRONMENT sqlc
$ drush @APP.ENVIRONMENT site-install
That's it! Remember the commands terra
which will show you the available commands, and terra status
, which will show you the available apps and environments.
If you have ANY problems with these instructions, please submit an issue at https://github.com/terra-ops/terra-cli/issues!
Thanks!
Terra is still in pre-release development!
Master branch is generally stable.You can always update your terra install easily thanks to composer:
composer global update
This command updates all of the composer packages you have installed using composer global
, including drush.
The domain name local.computer was purchased by @jonpugh for Terra and docker development.
The hostnames local.computer and all subdomains (*.local.computer) resolve to the default docker-machine IP: 192.168.99.100
You can use "local.computer" as the host for your apps if you are using the Docker toolbox.
If you create more docker machines, or change the default one, it might not have the same IP. Make sure your docker machine always has that IP if you don't want to set your own DNS or load sites via IP.
Currently there are a few steps to get terra working.
We want installation to be as fast and simple as possible, so we will be working on a single install script that sets up all of the prerequisites for any OS.
Terra depends on the following tools. The instructions below will guide you through setting up all of them.
- PHP
- git
- Composer http://getcomposer.org
- Drush (7.x) http://drush.org
- Docker (1.7.x) http://docker.com
- Docker Compose (1.3.x) https://docs.docker.com/compose
- Docker Machine (0.3.x) https://docs.docker.com/machine
- VirtualBox (4.3, Look for "Older Builds" on the website.) Required only on MacOSx
Docker Machine isn't currently required but it will be soon. :)
Terra recommends Ubuntu Trusty (14.04 or higher).
We have created a install.sh
script that runs you through this entire process
To run the automatic installer, run the following commands as root:
wget https://raw.githubusercontent.com/terra-ops/terra-cli/master/install.sh
bash install.sh
Run all of the following commands as root, or with sudo
.
-
Install PHP & Git:
apt-get update apt-get install php5-cli git
-
Install Composer:
From https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
This will install the composer.phar file at /usr/local/bin/composer.
- Install Docker:
From https://docs.docker.com/installation/ubuntulinux
wget -qO- https://get.docker.com/ | sh
-
Add your user to the
docker
group:usermod -aG docker your-user
The docker installer will remind you of this at the end.
- Install Docker Compose:
From https://docs.docker.com/compose/install/
curl -L https://github.com/docker/compose/releases/download/1.2.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
- Install Drush:
Drush is used to connect to your running drupal sites. This step is not required.
From http://docs.drush.org/en/master/install/
git clone https://github.com/drush-ops/drush.git /usr/share/drush --branch=7.x
cd /usr/share/drush
composer install
ln -s /usr/share/drush/drush /usr/local/bin/drush
- Install Terra:
Terra can be installed with composer global require
however an extra step is
needed to put composer's bin
folder into your system path.
To install terra automatically, run the following as your user (not root):
composer global require terra/cli:dev-master
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> $HOME/.bashrc
To install terra manually, run the following as root::
git clone https://github.com/terra-ops/terra-cli.git /usr/share/terra
cd /usr/share/terra
composer install
ln -s /usr/share/terra/bin/terra /usr/local/bin/terra
- Generate an SSH key:
To connect to your drupal sites via drush, your terra user must have an SSH public key.
To generate one:
ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
- Switch back to your user and run
terra
to see if it works!
Running docker and the others natively in OSx works well.
The docker host, or daemon, must run in a virtualmachine.
"boot2docker" is the virtualmachine
There is a lot of nuance in using Docker on OSX. It will help to read the guide about Docker on OSX here: http://viget.com/extend/how-to-use-docker-on-os-x-the-missing-guide
- Install PHP & Git:
Install the command line developer tools by installing XCode
- Install composer:
From https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- Install docker & docker-compose:
The easiest way to get up and running on OSX with Docker is to use Kitematic. Kitematic will handle all prerequisites.
After installing Kitematic, you're going to want to use the Docker CLI it makes available to execute docker commands:
- Install Terra:
Terra can be installed with composer global require
however an extra step is
needed to put composer's bin
folder into your system path.
To install terra automatically, run the following as your user (not root):
composer global require terra/cli:dev-master
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> $HOME/.bashrc
To install terra manually, run the following as root::
git clone https://github.com/terra-ops/terra-cli.git /usr/share/terra
cd /usr/share/terra
composer install
ln -s /usr/share/terra/bin/terra /usr/local/bin/terra
-
https://getcomposer.org/doc/00-intro.md#installation-windows
Note: Windows is currently untested.
If you plan on contributing to Terra:
Then:
git clone https://github.com/your_username/terra-cli.git
ln -s /path/to/terra-cli/bin/terra /usr/local/bin/terra
cd /path/to/terra-cli
composer install
Try to run terra
on the command line and you should see the default output. Remember if you are using Kitematic to use the Docker CLI provided as mentioned above.
Next you should read up on the containers strategy or jump right in and try setting up a sample Drupal installation.