How to access your website from the backend / command line (advanced)

Drupal Cloud is the same as OKD4 PaaS at its core

Thanks to this, developers used to working with PaaS applications and the oc (or kubectl) command line utility, or the OKD4 web console, can do the same for Drupal sites.
If you are a technical site administrator and would like to benefit from a command line workflow to interact with your Drupal site, follow this guide.

Prerequisites:

  • Ask :snowflake: the Drupal Infrastructure for elevated permissions on your website.
    • we might not be able to give you our standard level of support if you encounter issues probably caused by your elevated privileges
    • Note: you need to be a member of the project’s admin e-group
  • Install the oc command line client, or use the kubectl utility on lxplus8.cern.ch
    • kubectl does not offer a direct equivalent to oc login. You will need to use a token.
  • Access the Drupal cluster from inside CERN. The CERN firewall prevents you from connecting to the database while teleworking (workarounds are possible though)

Workflow:

  1. You can work on your project from:
  2. If using oc, connect to the Drupal cluster:
    oc login --server=https://api.drupal.okd.cern.ch -u <USERNAME>
    
  3. You can connect to your Drupal server pod with:
    • the web console, after selecting your project and navigating to the “Pods” tab. Note to use the “php-fpm” container.
    • the oc client:
      oc -n <PROJECT_NAME> exec -it -c php-fpm deploy/<MYSITE> -- sh
      
  4. Inside this container, you will find your local modules in the path /drupal-data/modules.
    • this is the same directory that you access through WebDAV
  5. You also have access to the drush command line utility.

Similar instructions using the oc client are How to access the site's database [Advanced, Unsupported] - #2

1 Like