Skip to content

Instantly share code, notes, and snippets.

@ogomez78
Created February 20, 2017 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ogomez78/3b5fbfa27ad8cd3d0fc6947477b1c862 to your computer and use it in GitHub Desktop.
Save ogomez78/3b5fbfa27ad8cd3d0fc6947477b1c862 to your computer and use it in GitHub Desktop.
DigitalOcean Drupal/CiviCRM Droplet cloning
Ubuntu 14.04
Drupal 7
CiviCRM 4.7
@ogomez78
Copy link
Author

ogomez78 commented Feb 20, 2017

Use these steps to clone live sites into dev enviroments, for example.

Tested for:
Ubuntu 14.04
Drupal 7
CiviCRM 4.7

  • Create a snapshot of the droplet, and from that snapshot, create a new droplet

  • disable outgoing emails, to prevent automated workflows from sending emails from this dev server.
    sudo nano /etc/postfix/main.cf
    add this line at the bottom of the file:
    default_transport = error:No outside emails.

  • Create a copy and then edit the Drupal nginx config file to update server_name and set server to listen to port 80 instead 0f 443, and remove redirects (assuming the live site was set up to force SSL).
    ssh mysudoeruser@myipaddress
    cd /etc/nginx/sites-enabled
    scp drupal /home/mysudoeruser/drupal.txt
    sudo nano drupal

  • make sure the new nginx config file works properly by testing it
    sudo service nginx configtest

  • Restart Nginx service
    sudo service nginx restart

  • Edit settings.php to update the base_url variable with the IP address of the droplet you're setting up.
    sudo nano <drupal-root>/sites/default/settings.php

  • Edit civicrm.settings.php to update the CIVICRM_UF_BASEURL variable with the new URL, like the to do above, but with an ending /.
    sudo nano <drupal-root>/sites/default/civicrm.settings.php

  • Remove all files from the templates_c directory
    sudo rm -r <drupal-root>/sites/default/files/civicrm/templates_c/*

  • Ensure this templates_c directory permissions allow for the application to add files to it.
    sudo chown -R www-data:www-data <drupal-root>/sites/default/files/civicrm/templates_c

  • Remove the Config.IDS.ini file
    sudo rm <drupal-root>/sites/default/files/civicrm/ConfigAndLog/Config.IDS.ini

  • Clear Drupal Cache
    cd <drupal-root>
    sudo drush cc all

  • Log into the site, /user, and disable CiviCRM's force SSL setting at civicrm/admin/setting/url?reset=1

  • Disable CiviCRM's crob, to avoid scheduled reminders other automated tasks from running.
    sudo -u www-data crontab -e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment