Please read [[Docker HowTo Install]] before installing CiviCRM == Prerequisites if required '''Step 1 - Install Docker''' [[Docker HowTo Install]] '''Step 2 - Install Git''' {{{$ sudo apt-get update }}} {{{$ sudo apt-get install git }}} '''Step 3 - Backup CiviCRM and Drupal Databases''' Log on to the mysql database machine. Backup Druplal and CiviCRM as follows : {{{/usr/local/mysql/bin/mysqldump --single-transaction -u root -p --ignore-table=civicrm_db_name.civicrm_domain \ }}} {{{--ignore-table=civicrm_db_name.civicrm_acl_cache \ }}} {{{--ignore-table=civicrm_db_name.civicrm_acl_contact_cache \ }}} {{{--ignore-table=civicrm_db_name.civicrm_cache \ }}} {{{--ignore-table=civicrm_db_name.civicrm_group_contact_cache \ }}} {{{civicrmtest > civicrmtest.sql }}} {{{ }}} {{{/usr/local/mysql/bin/mysqldump --single-transaction -u root -p drupaltest > drupaltest.sql }}} This creates 2 sql dump files. Connect to your destination mysql server where you wish to install the new databases. {{{mysql -u root -p}}} Create a database, make sure you postfix with CiviCRM version number. Please stick to this naming convention. {{{mysql > create database civicrmtest_docker4715}}} {{{mysql > create database drupaltest_docker4715}}} Import the lastest database. {{{mysql -u root -p drupaltest_docker4715 < drupaltest.sql}}} {{{mysql -u root -p civicrmtest_docker4715 < civicrmtest.sql}}} '''Step 4 - Create / Grant Mysql permissions''' If a new user is needed run the following, replace necessary details {{{CREATE USER 'docker'@'localhost' IDENTIFIED BY 'docker'; }}} {{{CREATE USER 'docker'@'%' IDENTIFIED BY 'docker'; }}} Grant necessary privileges to user. {{{GRANT ALL PRIVILEGES ON drupaltest_docker4715.* TO 'docker'@'localhost' WITH GRANT OPTION;}}} {{{GRANT ALL PRIVILEGES ON civicrmtest_docker4715.* TO 'docker'@'localhost' WITH GRANT OPTION;}}} {{{GRANT ALL PRIVILEGES ON drupaltest_docker4715.* TO 'docker'@'%' WITH GRANT OPTION;}}} {{{GRANT ALL PRIVILEGES ON civicrmtest_docker4715.* TO 'docker'@'%' WITH GRANT OPTION;}}} '''Step 5 - Perform necessary sql if required''' Run the following commands and take note of the sql for the views : {{{SHOW CREATE VIEW civicrm_view_case_activity_upcoming;}}} {{{SHOW CREATE VIEW civicrm_view_case_activity_recent;}}} Make the modification 'CREATE SQL SECURITY invoker' and recreate the view : {{{DROP VIEW civicrm_view_case_activity_upcoming;}}} {{{CREATE SQL SECURITY invoker VIEW `civicrm_view_case_activity_upcoming` AS select `ca`.`case_id` AS `case_id`,`a`.`id` AS `id`,`a`.`activity_date_time` AS `activity_date_time`,`a`.`status_id` AS `status_id`,`a`.`activity_type_id` AS `activity_type_id` from (`civicrm_case_activity` `ca` join `civicrm_activity` `a` on((`ca`.`activity_id` = `a`.`id`))) where ((`a`.`activity_date_time` <= (now() + interval 14 day)) and (`a`.`is_current_revision` = 1) and (`a`.`is_deleted` = 0) and (`a`.`status_id` = 1));}}} {{{DROP VIEW civicrm_view_case_activity_recent;}}} {{{CREATE SQL SECURITY invoker VIEW `civicrm_view_case_activity_recent` AS select `ca`.`case_id` AS `case_id`,`a`.`id` AS `id`,`a`.`activity_date_time` AS `activity_date_time`,`a`.`status_id` AS `status_id`,`a`.`activity_type_id` AS `activity_type_id` from (`civicrm_case_activity` `ca` join `civicrm_activity` `a` on((`ca`.`activity_id` = `a`.`id`))) where ((`a`.`activity_date_time` <= now()) and (`a`.`activity_date_time` >= (now() - interval 14 day)) and (`a`.`is_current_revision` = 1) and (`a`.`is_deleted` = 0) and (`a`.`status_id` <> 1));}}} == Upgrade CiviCRM using Docker Step 1. On the host machine go to directory {{{/local/docker//}}} Step 2. Go to this directory and checkout from git docker_civicrm_upgrade {{{sudo git clone https://github.com/LCBRU/docker_civicrm_upgrade.git}}} {{{sudo chmod -R 777 docker_civicrm_upgrade/}}} This will create a directory /local/docker//docker_civicrm_upgrade This docker script upgrades an existing CiviCRM installation. Step 3. The main configuration file is Dockerfile Modify the following lines in Dockerfile : {{{ENV DRUPALVERSION 7.53}}} {{{ENV CIVICRMVERSION 4.7.15}}} {{{#####################}}} {{{# select only one}}} {{{ENV ENVIRONMENT test }}} {{{#ENV ENVIRONMENT live}}} {{{#####################}}} Note the database config are in the live and test folders. Modify as necessary the files : {{{civicrm.settings.php}}} {{{settings.php}}} Step 4. Build Docker container {{{sudo docker build -t lcbruit/civicrm:v4.7.15 .}}} {{{sudo docker build --no-cache=true -t lcbruit/civicrm:v4.7.15 .}}} Ensure that the **version number** matches the actual CiviCRM version you are upgrading to. Run container {{{sudo docker run -v /share:/share -itd -p 80:80 lcbruit/civicrm:v4.7.15}}} To connect to container : {{{sudo docker ps -a}}} {{{sudo docker exec -i -t [CONTAINER ID] /bin/bash}}} Step 5. Upgrade Drupal and CiviCRM To upgrade Drupal point your browser to : {{{http://XXXXXXXXXXXXXX.xuhl-tr.nhs.uk/update.php?op=info}}} To upgrade CiviCRM point your browser to : {{{http://XXXXXXXXXXXXXX.xuhl-tr.nhs.uk/civicrm/upgrade?reset=1}}} Go to Drupal -> Modules and enable the module 'Module Missing Message Fixer' Go to Drupal -> Configuration -> Missing Module Message Fixer to remove any missing modules. Go to the url : {{{http://XXXXXXXXXXXXXX.xuhl-tr.nhs.uk/civicrm/admin/setting/path?reset=1}}} ensure that the following are set to : {{{Temporary Files Directory = /var/local/civicrm/drupal/sites/default/files/civicrm/upload/}}} {{{Image Directory = /var/local/civicrm/drupal/sites/default/files/civicrm/persist/contribute/}}} {{{Custom Files Directory = /var/local/civicrm/drupal/sites/default/files/civicrm/custom/}}} {{{Custom Template Directory = /var/local/civicrm/drupal/sites/all/lcbru_custom/civicrm_templates/}}} {{{Custom PHP Directory = /var/local/civicrm/drupal/sites/all/lcbru_custom/civicrm_php/}}} {{{Extensions Directory = /var/local/civicrm/drupal/sites/all/lcbru_custom/civicrm_extensions/}}} Go to the url : {{{http://XXXXXXXXXXXXXX.xuhl-tr.nhs.uk/civicrm/admin/setting/url?reset=1}}} ensure that the following are set to : {{{CiviCRM Resource URL = http://XXXXXXXXXXXXXX.xuhl-tr.nhs.uk/sites/all/modules/civicrm}}} {{{Image Upload URL = http://XXXXXXXXXXXXXX.xuhl-tr.nhs.uk/sites/default/files/civicrm/persist/contribute/}}} {{{Extension Resource URL = http://XXXXXXXXXXXXXX.xuhl-tr.nhs.uk/sites/all/civicrm_extensions}}} Go to the url : {{{http://XXXXXXXXXXXXXX.xuhl-tr.nhs.uk/civicrm/admin/setting/misc?reset=1}}} ensure that the following are set to : {{{Path to wkhtmltopdf executable = /usr/local/bin/wkhtmltopdf}}} Go to the url : {{{http://uhlbriccsapp07.xuhl-tr.nhs.uk/civicrm/admin/extensions?reset=1}}} Remove any extensions not required. Stop the container : {{{sudo docker ps -a}}} {{{sudo docker stop [CONTAINER ID] }}} Step 6. Set location of theme directory. Connect to your drupal database and run the following {{{select * from variable where name = 'color_antonelli_files'; }}} This give the following output {{{a:2:{i:0;s:42:"public://color/antonelli-d1bee6f5/logo.png";i:1;s:44:"public://color/antonelli-d1bee6f5/colors.css";} }}} Modify the Dockerfile as follows {{{################### }}} {{{#css location. first line is test, 2nd line is live }}} {{{ENV CSS antonelli-d1bee6f5/ }}} {{{#ENV CSS antonelli-75b84edd }}} {{{#################### }}} Rebuild you image : {{{sudo docker build -t lcbruit/civicrm:v4.7.15 .}}} {{{sudo docker build --no-cache=true -t lcbruit/civicrm:v4.7.15 .}}} Run container {{{sudo docker run -v /share:/share -itd -p 80:80 lcbruit/civicrm:v4.7.15}}} Step 7. Ensure you have set the container to start on reboot. [[Docker HowTo Auto Start Containers On Reboot]]