O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

Drupal 8 deploying

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Carregando em…3
×

Confira estes a seguir

1 de 20 Anúncio

Mais Conteúdo rRelacionado

Diapositivos para si (20)

Quem viu também gostou (20)

Anúncio

Semelhante a Drupal 8 deploying (20)

Mais recentes (20)

Anúncio

Drupal 8 deploying

  1. 1. Drupal 8 deployment New configuration management system by Andrew Siz
  2. 2. Let’s look at three cases 1. Simple deployment from dev site to live one. 1. Deployment with usage of git. 1. Deployment with usage of git and drush commands.
  3. 3. 1. Simple deployment from dev site to live one. So, we have two instances of one site: http://drupal8.loc/ - dev site http://drupal82.loc/ - live site Notes: Currently in Drupal 8 all site Instances should be cloned from one installed source (sql dump, files, some settings in settings.php should be the same on all site instances), because you won’t be able to sync all configurations. More info - https://www.drupal.org/node/1613424
  4. 4. 1.1 Simple Ex.: Trying to change “Default country” to “Ukraine” on dev site. Go to the admin/config/regional/settings and change current Default country to “Ukraine”. After, click “Save configuration”
  5. 5. 1.2 Export all configurations to config.tar.gz on dev site. Go to the admin/config/development/configuration/full/export and click “Export” button. You will receive archive with all configurations
  6. 6. 1.3 Import all configurations to the live site. Go to the admin/config/development/configuration/full/import on the live site and upload our configurations from dev site.
  7. 7. 1.4 Check if configurations which we want to apply are correct. Go to the admin/config/development/configuration on live site and click button “View differences”. In popup we can see what was changed. If this exactly what we want, we can close the popup and click “Import all”.
  8. 8. 1.5 Check if our configurations of “default country” were deployed. Go to the admin/config/regional/settings on the live site and see new default country. That’s all :)
  9. 9. 2. Deployment with usage of git. In drupal 8 we have 2 states of configurations: active - state of configuration which is currently being used. staging - state of configuration which was changed and which is currently waiting for review. The active configuration files can be found at sites/default/files/config_XXXX/active (where XXXX is a hash that looks somewhat like iND62oxf-4DyUHcbCA7mhupb_KEpUaGZ6qcfTnAscNQ). BUT for performance, by default, the active store is in a "config" table in the database (somewhat analogous to the "variables" table in D7 and below), though the storage location is swappable. The staging configuration files can be found by default at sites/default/files/config_XXXX/staging (where XXXX is a hash that looks somewhat like iND62oxf-4DyUHcbCA7mhupb_KEpUaGZ6qcfTnAscNQ).
  10. 10. During the installation, Drupal writes the location of the (active & staging) configuration directories to the settings.php file. For our example we will override location of staging configurations files. But this is not required and will be made only for showing possibility. So, go to the settings.php and change default location to “staging”. After creating “staging” folder in our site folder. NOTE: settings.php configurations should be the same on dev and live sites.
  11. 11. 2.1 Preparing dev and live sites Before any changes will be made, we should go to admin/config/development/configuration/full/export on dev site and export configurations archive. After, go to admin/config/development/configuration/full/import on dev site and import this archive. Now we can go to “staging” folder and see that this folder is not even empty, but has all configuration files. As you can mention, after importing all configuration files, they upload to staging folder.
  12. 12. 2.2 Add all site files to Git Just go to webroot on dev site, commit all site files to git, AND commit our “staging” folder as well. After, pull all these changes on live site. So, we should have “staging” folder with all files on dev and live site as well. (screenshot)
  13. 13. 2.3 Again simple Ex.: Trying to change “Default country” from “Ukraine” (in our case) to “Germany” on dev site.
  14. 14. 2.4 Export new changes, and after, revert all changes to get rid of annoying message Go to the admin/config/development/configuration/full/export on dev site and export all our changes. After go to admin/config/development/configuration on dev site, we see message “Your current configuration has changed” and we see what exactly was changed.(screenshot) To get rid of annoying message we should revert all changes to old state by click on “import all” button, in any case we already have our new changes in archive which we have downloaded few seconds ago, so nothing will be lost.
  15. 15. 2.5 Import our new changes on dev site and revert to current state Go to the admin/config/development/configuration/full/import and upload our archive. After, go to admin/config/development/configuration and now revert all changes to current state by clicking “Import all” button. On clicking “Import all” drupal takes all changed configurations from staging folder and moves them to the active (as we know, by default, active configurations are stored in a database). It means that all changes were applied.
  16. 16. 2.6 Commit and pull all new changes. In Command-line on dev site we can see that one configuration file was changed (in our case configuration file with default country)(screenshot). After, commit this file and push to git repo. Go to Command-line on live site and pull all new changes.
  17. 17. 2.7 Check and apply configurations on live site. Go to admin/config/development/configuration on live site and check what was changed by clicking the button “View differences”. In our case it should be something like UA => DE . If this is exactly what we want, we can apply this by clicking on “Import all” button.(screenshot). After that, our staging settings will be active and we can check it on admin/config/regional/settings page. That’s all :)
  18. 18. 3. Deployment with usage of git and drush commands Drush of 7 version has new commands for working with configurations in Drupal 8. More information you can find on http://drushcommands.com/drush-7x/. In general all steps of deployment are mostly the same as in case number 2, but, for example, on live site, after “git pull”, you can run “drush config-import -y” and all new changes will be immediately applied on site. Pretty handy! ;) In general that’s all ;)
  19. 19. FAQ How to install drush 7 for drupal 8? - https://drupalize.me/blog/201408/upgrading-drush-work-drupal-8 Why active configurations are stored in database and how to swap it to files? - https://www.drupal.org/node/2241059, for example, there is one module which saves active configuratins in files https://www.drupal.org/project/config_devel. After pulling new changes on live, I have an error “The staged configuration cannot be imported, because it originates from a different site than this site. You can only synchronize configuration between cloned instances of this site.” - please read notes from the slide number 3. After running “drush config-import -y” I have some errors. - Try to upload latest dev version of Drupal 8 and Drush 7.
  20. 20. Sources https://www.drupal.org/documentation/administer/config https://www.acquia.com/blog/ultimate-guide-drupal-8-episode-6-new-back-end-features-drupal-8 https://drupalize.me/blog/201408/upgrading-drush-work-drupal-8

×