test Drupal site working on Koality Theme Builder
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.5 KiB

  1. # Useful things for Drupal projects
  2. default: up
  3. DRUPAL_ROOT ?= /var/www/site/docroot
  4. PROJECT_ROOT ?= /var/www/site
  5. IMAGE_NAME = drupal-project
  6. # Spin up the docker container as defined in the docker-compose.yaml
  7. up:
  8. docker-compose up -d
  9. # Spin down the docker container when you're no longer needing this as a local site
  10. down:
  11. docker-compose down
  12. # This will do everything that is needed to get your site up and running for the first time
  13. # Right now spins up container, then makes sure all composer dependencies are downloaded
  14. first-launch:
  15. make up
  16. make install-dependencies
  17. # Rebuilds the Drupal cache, useful anytime you make template changes or edit module files
  18. cache-rebuild:
  19. docker exec -ti -w $(PROJECT_ROOT) $(IMAGE_NAME) /bin/bash -ci "drupal cr all"
  20. # Install all dependencies defined in the composer.json
  21. install-dependencies:
  22. docker exec -ti -w $(PROJECT_ROOT) $(IMAGE_NAME) /bin/bash -ci "composer install"
  23. # Example command looks like "make require-module module=recaptcha"
  24. require-module:
  25. docker exec -ti -w $(PROJECT_ROOT) $(IMAGE_NAME) /bin/bash -ci "composer require drupal/$(module)"
  26. # Example command looks like "make remove-module module=recaptcha"
  27. remove-module:
  28. docker exec -ti -w $(PROJECT_ROOT) $(IMAGE_NAME) /bin/bash -ci "drupal module:uninstall $(module)"
  29. docker exec -ti -w $(PROJECT_ROOT) $(IMAGE_NAME) /bin/bash -ci "composer remove drupal/$(module)"
  30. # Example command looks like "make install-module module=recaptcha"
  31. install-module:
  32. docker exec -ti -w $(PROJECT_ROOT) $(IMAGE_NAME) /bin/bash -ci "drupal module:install $(module)"
  33. # If you put the db you want in the root of the project and run this command it will import that database
  34. # the database filename must be starter.sql and in the root of this repo
  35. # WARNING: You will lose any local changes you have made
  36. import-db:
  37. docker-compose down
  38. sudo rm -Rf ../sites-databases/$(IMAGE_NAME)
  39. docker-compose up -d
  40. # See all the logs of the docker container, useful for finding PHP errors
  41. logs:
  42. docker logs $(IMAGE_NAME) -f
  43. login:
  44. docker exec -ti -w $(PROJECT_ROOT) $(IMAGE_NAME) /bin/bash
  45. # Export the config from the DB into config files
  46. config-export:
  47. docker exec -ti -w $(PROJECT_ROOT) $(IMAGE_NAME) /bin/bash -ci "drupal config:export"
  48. # import the config from config files into the DB
  49. config-import:
  50. docker exec -ti -w $(PROJECT_ROOT) $(IMAGE_NAME) /bin/bash -ci "drupal config:import"
  51. setup-config:
  52. docker exec -ti -w $(DRUPAL_ROOT) $(IMAGE_NAME) /bin/bash -ci "cp -R config_split/* config/default/default/. && drush config-import"