Zum Inhalt springen

Drupal 8 Website Developer Environments: Unterschied zwischen den Versionen

Aus Computech CMS Wiki
Frederick (Diskussion | Beiträge)
Keine Bearbeitungszusammenfassung
Frederick (Diskussion | Beiträge)
Added Instructions on how to add custom themes from separate repositories to developer environments.
Zeile 13: Zeile 13:
* '''--remote=<origin>'''    The remote git branch to use to push changes.  Defaults to "origin".                                             
* '''--remote=<origin>'''    The remote git branch to use to push changes.  Defaults to "origin".                                             
* '''--skip-modules'''        A list of modules to ignore during export (e.g. to avoid listing dev-only modules in exported configuration).
* '''--skip-modules'''        A list of modules to ignore during export (e.g. to avoid listing dev-only modules in exported configuration).
== Add custom theme from separate repository to developer environment ==
In the developer environment:
cd themes/custom
Clone repository.
git clone <'''UrlToRepository'''>
z.B. MEOS Adminimal Theme
git clone http://192.168.60.12/Bonobo.Git.Server/meostheme.git
   
   
== Copy Drupal 8 Website to developer environments ==
== Copy Drupal 8 Website to developer environments ==

Version vom 23. Januar 2017, 09:20 Uhr

Export main development site configuration to sync directory

The location of site configuration sync directory should be configured in the settings.php file or settings.local.php. Many are using ../config/sync. This is outside the webroot for security reasons. To export a Drupal 8 website configuration to the configuration sync directory:

drush cex

Options:

  • --add Run `git add -p` after exporting. This lets you choose which config changes to sync for commit.
  • --branch=<branchname> Make commit on provided working branch. Ignored if used without --commit or --push.
  • --commit Run `git add -A` and `git commit` after exporting. This commits everything that was exported without prompting.
  • --destination An arbitrary directory that should receive the exported files. An alternative to label argument.
  • --message Commit comment for the exported configuration. Optional; may only be used with --commit or --push.
  • --push Run `git push` after committing. Implies --commit.
  • --remote=<origin> The remote git branch to use to push changes. Defaults to "origin".
  • --skip-modules A list of modules to ignore during export (e.g. to avoid listing dev-only modules in exported configuration).

Add custom theme from separate repository to developer environment

In the developer environment:

cd themes/custom

Clone repository.

git clone <UrlToRepository>

z.B. MEOS Adminimal Theme

git clone http://192.168.60.12/Bonobo.Git.Server/meostheme.git

Copy Drupal 8 Website to developer environments

  • cd in to the new developer environment:
cd /var/www/meos-fh
  • Initialize the folder for git:
git init
  • Add the Git Repository as a remote called origin:
git remote add origin <repository_URL>
  • Pull the repository to the directory:
git pull
  • Check out the development branch dev:
git checkout dev
  • Fix permissions on sites/default so Drupal can write to it:
chmod -R g+w docroot/sites/default/
  • Change to sites/default directory:
cd docroot/sites/default/
  • Copy as settings.local.php from another development site:
cp  /var/www/meos/docroot/sites/default/settings.local.php ./
  • Fix permissions of settings.local.php
chmod u+w settings.local.php
  • Edit the file:
nano settings.local.php

Change database settings to the new database for the website.

  • Change back to the project folder:
cd ../../../
  • Run Composer to install dependencies:
composer install
  • Pull the database from the main development site: Where @meos.fh is the Drush site alias you want to update.(NOTE:Drush shell alias needs to be created in the aliases file in /etc/drush/ for the pull-live.db command to work.)
drush @meos.fh pull-live-db
  • Import the configuration from the config/sync directory with Drush:
drush @meos.fh cim  #(cim is short for config-import)