Code Monkey home page Code Monkey logo

build.sh's Introduction

Build Status

build.sh

By the Wunderful People at Wunder and Friends

Released under GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007, see COPYING for details.

--

build.sh is a tool for making, updating and managing Drupal installations from the development phase up to production.

It is built to:

  • Eliminate the need to have 3rd-party code in your repository.
  • Make core and module updates fast and easy.
  • Enhance security of your Drupal installation.
  • Make your life just a little bit easier and worry free.

Installation:

No installation is required, build.sh is the only required file apart from the necessary configuration files.

Dependencies:

Drush capable of running make commands (latest version should work out of the box).

Python and various libraries are required, running ./build.sh should print the help text if everything is OK. The only extra library you may have to install is the Python YAML library. This should be installable with:

$ pip install PyYAML

Or if you are using CentOS 6.4:

$ yum install PyYAML

Basic usage:

Running build.sh without any parameters will give you a simple help on what you can do.

$ build.sh [options] [command] [site]

Options:
 -h --help
			Print this help
 -c --config
			Configuration file to use, defaults to conf/site.yml
 -o --commands
			Configuration file to use, defaults to conf/commands.yml
 -s --skip-backup
			Do not take backups, ever
 -d --disable-cache
			Do not use caches
 -v --version
			Print version information

Configuration file:

The configuration file is a YAML based file which contains both the site information and commands.

The site information consists of definitions for temporary build dir, old builds and final builds dir, the used Drupal installation profile name, linking and copying information, etc. See conf/site.yml for examples and more information.

Commands:

A command is a set of steps defined in the configuration file (see conf/commands.yml) therefore commands can vary from configuration to another.

The only hardcoded command is test:

$ ./build.sh test

Would do a simple test on your drush make file to check projects/libraries that are not referencing any direct versions (for example drupal.org module dev versions or GitHub master versions).

The example configuration file in conf/commands.yml defines the following commands:

 - new
 - update
 - package
 - backup

The provided steps are:

 - make
 	Create a temporary Drupal installation based on the drush make file (drush make).
 - backup
 	Backup the current final installation if such exists under the previous builds directory.
 - purge
 	Simply purges the current final installation (drops database).
 - finalize
 	Deletes the final installation (if such exists) and replaces it with the temporary one.
 - install
 	Run Drupal site installation via drush (drops database)
 - update
 	Run drush updatedb for the final installation.
 - cleanup
 	Clean up any old builds under previous builds directory.
 - append
 	Simply append the given file to the end of another file
 	Example:
 		- append: conf/our_htaccess_additions > current/.htaccess
 - link
 	Process link and copy directives. This step is not required as it is run by the finalize step if not yet ran.
 - verify
 	Ask user verification by typing yes to a question, example:
 		- verify: "Type yes to build new: "
 - test
 	Tests make file for possible volatile module/library references, in essence this is the same as running ./build.sh test
 - shell
 	Run a shell command (as of version 0.7 input & output redirectors works)

Example of usage:

At the beginning you will always run:

$ ./build.sh new

This should produces a new fresh Drupal installation. Usually you should use the installation profile as well as Drupal features to enable your sites modules and to configure it.

(Add a new modules to conf/site.make, add update hooks to enable modules to your installation profiles install file, etc).

$ ./build.sh update

This will rebuild the site accordingly from scratch without dropping any databases and finally Drupal update is ran.

About files and directories (-> denotes copying/symlinking):

File/directory				Explanation

code/						Custom modules, themes, features, etc.

	profiles/wk				Generic site install profile -> profiles/wk
	modules					Custom modules directory ->  sites/all/modules/custom
	themes					Custom themes directory -> sites/all/themes/custom

conf/						Configuration files

	site.yml				build.sh site configuration
	commands.yml			build.sh commands
	site.make				drush make file
	local.settings.php		Drupal settings.php file -> sites/default/settings.php

files/						Drupal files folder -> sites/default/files

build.sh's People

Contributors

aleksijohansson avatar artisba avatar artursv avatar guncha25 avatar hugovk avatar iler avatar maijs avatar mgalang avatar mikkmiggur avatar mitrpaka avatar tcmug avatar tharna avatar tormi avatar yannickoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

build.sh's Issues

Installation of Drupal 8 fails due to removal of default.settings.php file

My site.make file:

core = 8.0
projects[drupal][version] = 8.0.0

When installing using ./build.sh new, I get the following error:

Starting Drupal installation. This takes a while. Consider using the --notify global option.                                                         [ok]
exception 'Drupal\Core\Installer\Exception\InstallerException' with message 'Default settings file: The default settings file does not exist.        [error]

The Drupal installer requires that the <em class="placeholder">./sites/default/default.settings.php</em> file not be modified in any way from the
original download.' in /Users/myuser/Sites/mysite/drupal/core/includes/install.core.inc:2173
Stack trace:
#0 /Users/myuser/Sites/mysite/drupal/core/includes/install.core.inc(1014): install_display_requirements(Array, Array)
#1 /Users/myuser/Sites/mysite/drupal/core/includes/install.core.inc(648): install_verify_requirements(Array)
#2 /Users/myuser/Sites/mysite/drupal/core/includes/install.core.inc(526): install_run_task(Array, Array)
#3 /Users/myuser/Sites/mysite/drupal/core/includes/install.core.inc(116): install_run_tasks(Array)
#4 /Users/myuser/.composer/vendor/drush/drush/includes/drush.inc(721): install_drupal(Object(Composer\Autoload\ClassLoader), Array)
#5 /Users/myuser/.composer/vendor/drush/drush/includes/drush.inc(706): drush_call_user_func_array('install_drupal', Array)
#6 /Users/myuser/.composer/vendor/drush/drush/commands/core/drupal/site_install.inc(78): drush_op('install_drupal',
Object(Composer\Autoload\ClassLoader), Array)
#7 /Users/myuser/.composer/vendor/drush/drush/commands/core/site_install.drush.inc(289): drush_core_site_install_version('minimal', Array)
#8 [internal function]: drush_core_site_install('minimal', 'install_configu...')
#9 /Users/myuser/.composer/vendor/drush/drush/includes/command.inc(364): call_user_func_array('drush_core_site...', Array)
#10 /Users/myuser/.composer/vendor/drush/drush/includes/command.inc(215): _drush_invoke_hooks(Array, Array)
#11 [internal function]: drush_command('minimal', 'install_configu...')
#12 /Users/myuser/.composer/vendor/drush/drush/includes/command.inc(183): call_user_func_array('drush_command', Array)
#13 /Users/myuser/.composer/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(65): drush_dispatch(Array)
#14 /Users/myuser/.composer/vendor/drush/drush/includes/preflight.inc(64): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#15 /Users/myuser/.composer/vendor/drush/drush/drush.php(12): drush_main()

I believe this is due to the fact that default.settings.php is removed in def make.

Hotfix command or check whether makefile has changed so we can ommit full build for small changes

When there is just some small changes to the custom code, features or theme there is no need to run the whole make process to get those changes in production.

Implementing either a 'hotfix' command that would only copy the code/* folders to their respective places under current build dir or taking into use the makefile hash check when deciding if the full build is necessary would be nice.

Get rid of d8 branch

The build script itself should be fit for both d7 and d8, there are just some build examples that are drupal version specific.

The repo should be reorganized so that both d7 and d8 exxamples could coexcist on the same branch.

Add license

To make this properly open sourced let's add license for this project.

Drupal.org package compatibility

I'm not sure if this is already possible or not, but I'll ask how it would be possible.

I would like to use build.sh for building my local setup for lets say Commerce Kickstart: https://github.com/commerceguys/commerce_kickstart

You see that there are multiple make files and the repository and it's compatible with the Drupal.org packaging, but I have no idea how this could be buildable with build.sh tool.

Any thoughts? Do we need a feature for this?

Provide logfile of build.sh output

Right now there's no way to inspect what happened if the results of the build process are not as expected.

Logging the output would help a great deal.

Separate site.yml to two files to allow upstream updates

The site.yml should be separated to two files:

  • site.yml which would have the configurable parameters and variables
  • commands.yml (or similar) which would have the non-configurable commands part

With this configuration we could then have commands.yml to be updated from upstream when we do some updates.

Create restart command

Create a builtin command that can read environment configs and restart / reload services.

Feature request: Way to specify composer options

Can we perhaps have a way to specify composer options from site.yml like so:

Or even make own section for composer options:

dev:
  composer-options:
    require-dev: true

Practical example would be to define which environments needs --no-dev and which not. Now it seems to be hardcoded.

Shell doesn't fail build if command exited with non-zero status code.

If shell command can not be executed build process continues and may cause build to die later on process or finish successfully when actually something went wrong . That makes it harder to debug. This should be changed so that build fails with message of command that failed.

Add composer support

Now that Drupal is moving away from drush make and towards a composer build workflow, it would be nice if the build script can choose whether people want to build their Drupal site with composer or drush make.

D8: clean out files dir upon site-install

Since drupal 8 gives problems if you have some file structure from a previous installation, when you try to upload files in a new installation with old files dir, let's just clear it out upon site-install (could be polite to ask for permission)

To reproduce the error:
Install drupal,
Upload a file,
You'll have a subdirectory in files, 2016-01.
Install drupal again,
Try to upload a file,
Get a weird error, no output in nginx, php-fpm, no real explanation in Drupal's own watchdog, check permissions, they are ok, still no go, but then do a rm -r 2016-01
and upload agin
and smile

and think that other people will crash in the same issue, and that build.sh could help us avoid that

Build.sh fails to update custom code if set to copy

We have a project where build.sh is set to copy features etc. on build update. The newest version of build.sh fails since it packs the old build and then unpacks it and uses the old code. Using link instead of copy works for now, but this is something that should be fixed.

You end up in a hard place if something breaks during build.sh update

./build.sh update failed on me for a specific reason, and when I fixed the issue that caused the failed build, I got stuck with this error:

** BUILD NOTICE: Finalizing new build ** BUILD ERROR: [Errno 39] Directory not empty

Which had to be resolved by rm -rf current_bak/ before I was able to run build.sh update again. Not fun in the heat of a deployment moment.

Build error

After the latest commit to the develop branch a618032 I'm getting this error while trying to build:
** BUILD ERROR: [Errno 2] No such file or directory: '/vagrant/drupal/current_bak'

Create a drush command

Often there is the need to run some arbitary drush commands on the installation so it would be nice to have a drush command (like the existing shell-command) that could be used to run drush commands without the need to define the path to drupal installation, like it's now required if using shell-command to run drush.

Create sync command

Create a builtin command that can sync database and files between environments with appropriate sanitization / cleanup and can install, enable and configure environment specific modules.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.