Skip to content
This repository has been archived by the owner on Oct 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #183 from kalabox/1213-drushVersions
Browse files Browse the repository at this point in the history
#1213 drush versions
  • Loading branch information
pirog authored Oct 18, 2016
2 parents d85d181 + af7e95c commit 00fe5a5
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ v2.1.0-rc.2
* Simplified installation of deps. [#1656](https://github.com/kalabox/kalabox/issues/1656)
* Added `kbox redis` command. [#1183](https://github.com/kalabox/kalabox/issues/1183)
* Switched backend `web` service to common ports `443` and `80`. [#1090](https://github.com/kalabox/kalabox/issues/1090)
* `drush` type and version will now match users settings. [#1213](https://github.com/kalabox/kalabox/issues/1213)

v2.1.0-rc.1
===========
Expand Down
4 changes: 2 additions & 2 deletions app/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ wp:
# Adds a drush 8 command to your pantheon app.
#
drush:
service: terminus
description: Run a drush 8 command on your codebase
service: drush
description: Run a version appropriate drush command on your codebase
mapping: <config.sharing.codeDir>:/code

#
Expand Down
13 changes: 13 additions & 0 deletions app/dockerfiles/drush/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Standard drush container

FROM drush/drush

#
# Add your custom stuff here, you will want to make sure
# you switch from `image` to `build` mode in the relevant
# .yml compose file.
#
# For more information on dockerfiles see:
#
# https://docs.docker.com/engine/reference/builder/
#
77 changes: 76 additions & 1 deletion app/kalabox-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,82 @@ redis-cli:
- redis:redis

#
# Pantheon tooling.
# Drush
#
drush:

# Comment this and uncomment 'build' below if you want to edit your
# local dockerfile and build from there. This is useful for development
image: drush/drush:$KALABOX_APP_PANTHEON_CONFIG_DRUSH

# Uncomment this and comment 'image' above if you want to edit your
# local dockerfile and build from there. This is useful for development
#
# build: ./dockerfiles/terminus

entrypoint: usermap
volumes:
- $KALABOX_APP_ROOT:/src
- $KALABOX_ENGINE_HOME/.kalabox/pantheon/keys:/home/$KALABOX_ENGINE_ID/keys
- $KALABOX_APP_ROOT/config/drush:/home/$KALABOX_ENGINE_ID/.drush
- $KALABOX_APP_ROOT/config/scripts/usermap.sh:/usr/local/bin/usermap
- $KALABOX_APP_ROOT/config/terminus/php.ini:/usr/local/etc/php/conf.d/php.ini
- $KALABOX_APP_ROOT/config/scripts/pantheon-ensure-keys.sh:/usr/local/bin/pantheon-ensure-keys
- $KALABOX_APP_ROOT/config/composer:/composer
- $KALABOX_APP_ROOT/config/scripts/ensure-git-dir.sh:/usr/local/bin/ensure-git-dir
volumes_from:
- data
environment:
AUTH_KEY: $KALABOX_APP_PANTHEON_AUTH_KEY
AUTH_SALT: $KALABOX_APP_PANTHEON_AUTH_SALT
BACKDROP_SETTINGS: $KALABOX_APP_PANTHEON_PRESSFLOW_SETTINGS
CACHE_HOST: $KALABOX_APP_PANTHEON_CACHE_HOST
CACHE_PASSWORD: $KALABOX_APP_PANTHEON_CACHE_PASSWORD
CACHE_PORT: $KALABOX_APP_PANTHEON_CACHE_PORT
DB_HOST: $KALABOX_APP_PANTHEON_DB_HOST
DB_NAME: $KALABOX_APP_PANTHEON_DB_NAME
DB_PASSWORD: $KALABOX_APP_PANTHEON_DB_PASSWORD
DB_PORT: $KALABOX_APP_PANTHEON_DB_PORT
DB_USER: $KALABOX_APP_PANTHEON_DB_USER
DOCROOT: $KALABOX_APP_PANTHEON_DOCROOT
DOMAIN: $KALABOX_DOMAIN
DRUPAL_HASH_SALT: $KALABOX_APP_PANTHEON_DRUPAL_HASH_SALT
FILEMOUNT: $KALABOX_APP_PANTHEON_FILEMOUNT
FRAMEWORK: $KALABOX_APP_PANTHEON_FRAMEWORK
HOSTNAME: $KALABOX_APP_HOSTNAME
HOME: /home/$KALABOX_ENGINE_ID
KALABOX_GID: $KALABOX_ENGINE_GID
KALABOX_UID: $KALABOX_ENGINE_ID
KALABOX_SSH_KEY: pantheon.kalabox.id_rsa
LOGGED_IN_KEY: $KALABOX_APP_PANTHEON_LOGGED_IN_KEY
LOGGED_IN_SALT: $KALABOX_APP_PANTHEON_LOGGED_IN_SALT
MYSQL_HOST: $KALABOX_APP_PANTHEON_DB_HOST
NONCE_SALT: $KALABOX_APP_PANTHEON_NONCE_SALT
PANTHEON_ACCOUNT: $KALABOX_APP_PANTHEON_PANTHEON_ACCOUNT
PANTHEON_BINDING: $KALABOX_APP_PANTHEON_PANTHEON_BINDING
PANTHEON_ENVIRONMENT: $KALABOX_APP_PANTHEON_PANTHEON_ENVIRONMENT
PANTHEON_INDEX_HOST: $KALABOX_APP_PANTHEON_PANTHEON_INDEX_HOST
PANTHEON_INDEX_PORT: $KALABOX_APP_PANTHEON_PANTHEON_INDEX_PORT
PANTHEON_SITE: $KALABOX_APP_PANTHEON_PANTHEON_SITE
PANTHEON_SITE_NAME: $KALABOX_APP_PANTHEON_PANTHEON_SITE_NAME
PHP_IDE_CONFIG: serverName=$KALABOX_APP_HOSTNAME
PRESSFLOW_SETTINGS: $KALABOX_APP_PANTHEON_PRESSFLOW_SETTINGS
SECURE_AUTH_KEY: $KALABOX_APP_PANTHEON_SECURE_AUTH_KEY
SECURE_AUTH_SALT: $KALABOX_APP_PANTHEON_SECURE_AUTH_SALT
TERM: xterm
TERMINUS_USER: $KALABOX_APP_PANTHEON_CONFIG_EMAIL
TERMINUS_SITE: $KALABOX_APP_PANTHEON_CONFIG_SITE
TERMINUS_ENV: $KALABOX_APP_PANTHEON_CONFIG_ENV
links:
- db:database
- redis:redis
- solr:solr
working_dir: $KALABOX_CLI_WORKING_DIR
stdin_open: true
tty: true

#
# Terminus
#
terminus:

Expand Down
4 changes: 2 additions & 2 deletions docs/users/tooling.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ kbox drush dl views -y
kbox drush --version
```

!!! tip "Change Drush versions"
We use Drush 8 but you can change this by editing the `FROM` directive in `dockerfiles/terminus/Dockerfile` and running `kbox rebuild`. Please make sure the `terminus` service in the `kalabox-cli.yml` is switched from `image` to `build`.
!!! note "Drush can be different from app to app."
We will try to use a drush version on a php version that makes sense for your Pantheon settings. That said all Pantheon sites using `drush 5` will use `drush 7` on Kalabox.

git
---
Expand Down
6 changes: 4 additions & 2 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ var parseSites = function(sites) {
uuid: val.information.id || key,
php: val.information.php_version,
upstream: val.information.upstream,
framework: val.information.framework
framework: val.information.framework,
drush: val.information.drush_version || 7
});
}
});
Expand All @@ -54,7 +55,8 @@ var parseEnvironments = function(envs) {
name: key,
value: key,
id: key,
php: val.php_version || undefined
php: val.php_version || undefined,
drush: val.drush_version || undefined
});
});

Expand Down
15 changes: 15 additions & 0 deletions lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,21 @@ module.exports = function(kbox, pantheon) {
pantheonConfig.php = 56;
}

// Determine the best drush container to use
var drushVersion = env.drush || site.drush || 7;
if (drushVersion === 5) {
drushVersion = 7;
}
// We want to support backdrop drush
if (pantheonConfig.framework === 'backdrop') {
drushVersion = 'backdrop';
}
var drushPhp = '-php5';
if (pantheonConfig.php === 70) {
drushPhp = '';
}
pantheonConfig.drush = drushVersion + drushPhp;

// Remove unneeded default settings ESPECIALLY THE TOKEN!!!
delete pantheonConfig.token;
delete pantheonConfig.nofiles;
Expand Down
5 changes: 2 additions & 3 deletions test/backdrop.bats
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ setup() {
# Versions to check
BOWER_VERSION=1.
COMPOSER_VERSION=1.
DRUSH_VERSION=8.
GIT_VERSION=2.
GRUNT_VERSION=1.
GULP_VERSION=1.
Expand Down Expand Up @@ -318,8 +317,8 @@ setup() {
}

# DRUSH
@test "Check that '$KBOX drush' returns the correct major version without an error." {
run $KBOX drush --version
@test "Check that '$KBOX drush' can run drush status" {
run $KBOX drush status
[ "$status" -eq 0 ]
[[ $output == *"$DRUSH_VERSION"* ]]
}
Expand Down
5 changes: 2 additions & 3 deletions test/drupal7.bats
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ setup() {
# Versions to check
BOWER_VERSION=1.
COMPOSER_VERSION=1.
DRUSH_VERSION=8.
GIT_VERSION=2.
GRUNT_VERSION=1.
GULP_VERSION=1.
Expand Down Expand Up @@ -318,8 +317,8 @@ setup() {
#
# DRUSH
#
@test "Check that '$KBOX drush' returns the correct major version without an error." {
run $KBOX drush --version
@test "Check that '$KBOX drush' can run drush status" {
run $KBOX drush status
[ "$status" -eq 0 ]
[[ $output == *"$DRUSH_VERSION"* ]]
}
Expand Down
5 changes: 2 additions & 3 deletions test/drupal8.bats
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ setup() {
# Versions to check
BOWER_VERSION=1.
COMPOSER_VERSION=1.
DRUSH_VERSION=8.
GIT_VERSION=2.
GRUNT_VERSION=1.
GULP_VERSION=1.
Expand Down Expand Up @@ -324,8 +323,8 @@ setup() {
#
# DRUSH
#
@test "Check that '$KBOX drush' returns the correct major version without an error." {
run $KBOX drush --version
@test "Check that '$KBOX drush' can run drush status" {
run $KBOX drush status
[ "$status" -eq 0 ]
[[ $output == *"$DRUSH_VERSION"* ]]
}
Expand Down

0 comments on commit 00fe5a5

Please sign in to comment.