Development with Drush

Access your website with Drush (for development purposes)

This page contains information on how to run Drush for your website. It does not provide a CLI but instead instructs you how to do it yourself.

You will need credentials for your site. For “test” websites, you can find this information at https://<YOUR-SITE>.web.cern.ch/_site/drush.php. This workflow is not supported for official websites. If you feel that you need to do this for an official website, please contact the Drupal admins.

Background

Drush is a command-line shell and scripting interface for Drupal. In order to perform actions on a website, Drush requires access to its database and files and read access to the Drupal core and modules. All this information is already available in various but obscure places. Now, we present them to you in an easy-to-connect way.

The Drupal core along with all the centrally managed modules, themes, and libraries is packed in a docker image. This particular page provides your site-specific information and credentials that the image needs to directly connect to your website’s database. Finally, the moment you run docker your username and password will be asked to authenticate to WebDAV and directly connect your website’s files. From that moment on, all actions will be refrected to your live website.

Disable memcache

For Drush to work well under this setup you need to disable memcache on you website. The reason is that the memcache deamon is on the server side and Drush, under this setup, cannot control it. Disabling memcache does not descrease the performance of the website. It just reduces the load to the dbondemand database which we would like not to flood. To disable memcache from your website’s admin panel navigate to Configuration → [SYSTEM]CERN Infrastructure-> Memcache Setup (https://<YOUR-SITE>.web.cern.ch/_site/memcache.php) and select disable.

Preparation

The only system requirement on your side is to have an available docker client connected to a running docker deamon. For beginners, we recommend creating a VM in openstack.cern.ch using CC7 as source. To prepare the system execute

yum install -y docker
systemctl enable docker
systemctl start docker

The next step is to download your site-specific information and credentials. It is extremely important to protect this password. You will be considered responsible if it is exposed and your website is compromised.
For test websites, you can find the exact values in https://<YOUR-SITE>.web.cern.ch/_site/drush.php.

The last step is to run the docker image

docker pull gitlab-registry.cern.ch/drupal/drush-docker-drupal-admins:stable && \
docker run -it --privileged --env-file mywebsite.env.list gitlab-registry.cern.ch/drupal/drush-docker-drupal-admins:stable

Run Drush for this website

After authenticated with your own credentials as an administrator of the website everything will be configured and you’ll be able to execute Drush commands at will!

# drush pm-enable -y devel
The following extensions will be enabled: devel
Do you really want to continue? (y/n): y
devel was enabled successfully.
1 Like