vielsoft / drupal7-framework
Requires
- ckeditor/ckeditor: dev-full/stable
- composer/composer: ~1.0@alpha
- drupal/admin_menu: ~7.3.0-rc5
- drupal/ckeditor: ~7.1.16
- drupal/context: ~7.3.6
- drupal/ctools: ~7.1.9
- drupal/date: ~7.2.9
- drupal/diff: ~7.3.2
- drupal/drop_ship: 1.*
- drupal/drupal: ~7.41
- drupal/drupal-library-installer-plugin: ~0.1
- drupal/entity: ~7.1.6
- drupal/features: 7.2.*
- drupal/kw_manifests: 1.*
- drupal/module_filter: ~7.2.0
- drupal/omega: 7.4.*
- drupal/panels: 7.3.*
- drupal/registry_rebuild: 7.2.*
- drupal/strongarm: 7.2.*
- drupal/tangler: ~0.1.9
- drupal/views: 7.3.*
- drush/drush: 6.*
- winmillwill/settings_compile: ~2.1.1
Requires (Dev)
- behat/behat: 2.5.2
- behat/mink: ~1.5.0@stable
- behat/mink-selenium2-driver: 1.*
- drupal/backup_migrate: 7.3.*
- drupal/coder: 7.2.4
- drupal/devel: 7.*
- drupal/devel_themer: 7.1.x-dev
- drupal/diff: ~7.3.2
- drupal/drupal-extension: 0.1.5
- drupal/stage_file_proxy: 7.1.6
- drupal/xhprof: ~7.1.0-beta3
- phpunit/phpunit: 4.3.5
This package is auto-updated.
Last update: 2024-11-22 14:31:53 UTC
README
This is an example of a starting point for developing the "Promet Way".
You can most easily start your Drupal project with this baseline by using Composer:
composer create-project vielsoft/drupal7-framework YOUR_PROJECT_NAME
Running this command will download the latest release of this project to a new
directory called your_project_name
and invoke composer install
inside it,
which will trigger additional scripts to create a working Drupal root in the www
subdirectory from the packages downloaded with composer.
We reference a custom composer repository in composer.json
here. This repository was created by
traversing the list of known projects on drupal.org using
drupal/parse-composer
, and has the package metadata for all the valid packages
with a Drupal 7 release, including Drupal itself.
We use drupal/tangler
to create the Drupal root by reacting to the install
and update
events, and a custom installer provided by
drupal/drupal-library-installer-plugin
to handle placing ckeditor
in the
libraries directory of the resulting Drupal application. Also, we render
a settings.php file from cnf/config.yml
using winmillwill/settings_compile
,
which assures us that an operator without php familiarity but with knowledge of
the different tunables in settings.php will be able to update different
deployments of the application without needing to kludge anything.
As you add modules to your project, just update composer.json and run composer update
. You will also need to pin some versions down as you run across point
releases that break other functionality. If you are fastidious with this
practice, you will never accidentally install the wrong version of a module if
a point release should happen between your testing, and client sign off, and
actually deploying changes to production. If you are judicious with your
constraints, you will be able to update your contrib without trying to remember
known untenable versions and work arounds -- you will just run composer update
and be done.
This strategy may sound a lot like drush make
, but it's actually what you
would get if you took the good ideas that lead to drush make
, and then
discarded everything else about it, and then discarded those good ideas for
better ideas, and then added more good ideas.
See:
- composer
- drupal/tangler
- drupal/drupal-library-installer-plugin
- drupal/parse-composer
- winmillwill/settings_compile
Project Customization
You may want to customize a couple of things about your box first. The scripts are built to take most of the work out of configuration. There are pretty much two things you may want to do:
Change the Project Name
By editing the project variable, you can give your project a custom name. Note that this will affect several other configurations in the build as well, including what the base module will be called and what folder the site will live in.
Change the VM IP
You can edit the IP variable if you want to run more than one VM at a time.
Getting Started Developing
- You need to edit your machine's local host file. Add the entry
10.33.36.11 drupalproject.dev
- Run
vagrant up --provision
to build the environment. - ssh in with
vagrant ssh
- Navigate to
/var/www/sites/drupalproject.dev
. - PARTY!!!
Vagrant provision currently does a full site install.
To update without rebuilding, run build/update.sh
from the project root in
the vagrant box.
It is also worth noting, if you are working on an existing site, that the default install script allows you to provide a reference database in order to start your development. Simply add a sql file to either of the following:
build/ref/drupalproject.sql
build/ref/drupalproject.sql.gz
Use
IMPORTANT
This project uses the drop_ship module to
handle the reusable part of deployment, so everything will get disabled if you
don't define dependencies. The DROPSHIP_SEEDS
environment variable (see
directly below) should consist of only the top level project module and
environment specific modules.
DROPSHIP_SEEDS=drupalproject:devel
Easy Development with Vagrant
We have a Vagrantfile that references a Debian 7 box with php 5.4 and apache2 and mysql. Once you have installed Vagrant, you can begin development like so:
vagrant up # turn on the box and provision it vagrant ssh # log into the box like it's a server cd /var/www/sites/drupalproject.dev # go to the sync'ed folder on the box alias drush="$PWD/vendor/bin/drush -r $PWD/www" # use drush from composer drush <whatever> # do some stuff to your website
The Build and Deployment Scripts
You may have noticed that provisioning the Vagrant box causes build/install.sh
to be invoked, and that this causes all of our modules to be enabled, giving us
a starting schema.
You should note that build/install.sh
really just installs Drupal and then
passes off to build/update.sh
, which is the reusable and non-destructive
script for applying updates in code to a Drupal site with existing content. This
is the tool you can use when testing to see if your changes have been persisted
in such a way that your collaborators can use them:
build/install.sh # get a baseline alias drush="$PWD/vendor/bin/drush -r $PWD/www" # use drush from composer drush sql-dump > base.sql # save your baseline # ... do a whole bunch of Drupal hacking ... drush sql-dump > tmp.sql # save your intended state drush -y sql-drop && drush sqlc < base.sql # restore baseline state build/update.sh # apply changes to the baseline
You should see a lot of errors if, for example, you failed to provide an update hook for deleting a field whose fundamental config you are changing. Or, perhaps you've done the right thing and clicked through the things that should be working now and you see that it is not working as expected. This is a great time to fix these issues, because you know what you meant to do and your collaborators don't!
The actual application of updates, including managing the enabled modules,
firing their update hooks, disabling things that should not be enabled and
reverting features is handled by drupal/drop_ship
, which uses (a fork of)
kw_manifests
for providing an extensible set of deployment tasks that have
dependencies on one another.
Because manifests can't receive commandline arguments, we pass information to them with Environment Variables and we provide an env.dist from which to create a .env file that our scripts will then source. This allows an operator with access to the target environment to update these tunables out of channel so that you can deploy any arbitrary revision to any environment.
Particularly, the list of modules used to generate the dependency graph of all
the things we should enable resides in the DROPSHIP_SEEDS
environment
variable. You may notice that it's a list of one and that it's a poorly named
do-nothing module with nothing besides dependencies. In real life, you would
name this module something relevant to your project and it would be responsible
for over-arching functionality or the application, like providing the minimal
set of modules to generate the dependencies of everything that must be enabled
for the application to work properly. You can think of this like an install
profile that doesn't suck, because it's not a singleton, so with care, you can
embed your whole project in another project that uses this workflow.
See:
Testing Locally
All the testing that happens in an automated way can be done the same way on your virtual machine. Simply run this command from your the project folder and it will do coding standard testing:
./build/drupalcs.sh
Or run this command that will do behat testing:
./build/runtests.sh
TODO
- Change
build/scripts/default_set_theme
to a manifest - Make the README pithier, factor out discussions into an article or blog
TROUBLESHOOTING
Here are some known issues during installation.
Issue 1
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for fabpot/goutte v1.0.7 -> satisfiable by fabpot/goutte[v1.0.7].
- fabpot/goutte v1.0.7 requires ext-curl * -> the requested PHP extension curl is missing from your system.
Problem 2
- Installation request for instaclick/php-webdriver 1.0.17 -> satisfiable by instaclick/php-webdriver[1.0.17].
- instaclick/php-webdriver 1.0.17 requires ext-curl * -> the requested PHP extension curl is missing from your system.
Problem 3
- fabpot/goutte v1.0.7 requires ext-curl * -> the requested PHP extension curl is missing from your system.
The above issue means that you don't have curl installed.
Solution to Issue 1
In Ubuntu you can fix it by installing php5-curl
. Simply run sudo apt-get install php5-curl
.
CREDITS
This stack was created by folks at PrometSource. Credits must go to them.