Skip to content

Commit

Permalink
Merge pull request #160 from Islandora-Devops/install-profile
Browse files Browse the repository at this point in the history
Install profile
  • Loading branch information
rosiel authored Mar 24, 2022
2 parents 3e77d34 + 8e0783b commit 5b04015
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 12 deletions.
70 changes: 65 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ update-settings-php:
update-config-from-environment:
-docker-compose exec -T drupal with-contenv bash -lc "for_all_sites configure_islandora_module"
-docker-compose exec -T drupal with-contenv bash -lc "for_all_sites configure_jwt_module"
-docker-compose exec -T drupal with-contenv bash -lc "for_all_sites configure_islandora_default_module"
-docker-compose exec -T drupal with-contenv bash -lc "for_all_sites configure_search_api_solr_module"
-docker-compose exec -T drupal with-contenv bash -lc "for_all_sites configure_matomo_module"
-docker-compose exec -T drupal with-contenv bash -lc "for_all_sites configure_openseadragon"
-docker-compose exec -T drupal with-contenv bash -lc "for_all_sites configure_islandora_default_module"
Expand Down Expand Up @@ -235,6 +237,10 @@ endif
docker cp "$(SRC)" $$(docker-compose ps -q drupal):/tmp/public-files.tgz
docker-compose exec -T drupal with-contenv bash -lc 'tar zxvf /tmp/public-files.tgz -C /var/www/drupal/web/sites/default/files && chown -R nginx:nginx /var/www/drupal/web/sites/default/files && rm /tmp/public-files.tgz'

# Composer Update
composer_update:
docker-compose exec -T drupal with-contenv bash -lc 'composer update'

# Dump fcrepo.
fcrepo-export:
ifndef DEST
Expand Down Expand Up @@ -345,10 +351,59 @@ local: generate-secrets
$(MAKE) hydrate ENVIRONMENT=local
$(MAKE) set-files-owner SRC="$(CURDIR)/codebase" ENVIROMENT=local

.PHONY: demo-install-profile
.SILENT: demo-instal-profile
demo-install-profile: generate-secrets
$(MAKE) download-default-certs ENVIROMENT=demo
$(MAKE) -B docker-compose.yml ENVIROMENT=demo
$(MAKE) pull ENVIROMENT=demo
mkdir -p $(CURDIR)/codebase
docker-compose up -d --remove-orphans
@echo "\n Sleeping for 10 seconds to wait for Drupal to finish initializing.\n"
sleep 10
$(MAKE) install
$(MAKE) update-settings-php ENVIROMENT=demo
$(MAKE) hydrate ENVIROMENT=demo
docker-compose exec -T drupal with-contenv bash -lc 'drush --root /var/www/drupal/web -l $${DRUPAL_DEFAULT_SITE_URL} upwd admin $${DRUPAL_DEFAULT_ACCOUNT_PASSWORD}'
docker-compose exec -T drupal with-contenv bash -lc 'drush migrate:rollback islandora_defaults_tags,islandora_tags'
$(MAKE) initial_content
$(MAKE) login

.PHONY: local-install-profile
.SILENT: local-install-profile
local-install-profile: generate-secrets
$(MAKE) download-default-certs ENVIROMENT=local
$(MAKE) -B docker-compose.yml ENVIRONMENT=local
$(MAKE) pull ENVIRONMENT=local
mkdir -p $(CURDIR)/codebase
if [ -z "$$(ls -A $(CURDIR)/codebase)" ]; then \
docker container run --rm -v $(CURDIR)/codebase:/home/root $(REPOSITORY)/nginx:$(TAG) with-contenv bash -lc 'git clone https://github.com/islandora-devops/islandora-sandbox /tmp/codebase; mv /tmp/codebase/* /home/root;'; \
fi
$(MAKE) set-files-owner SRC=$(CURDIR)/codebase ENVIROMENT=local
docker-compose up -d --remove-orphans
docker-compose exec -T drupal with-contenv bash -lc 'composer install; chown -R nginx:nginx .'
$(MAKE) remove_standard_profile_references_from_config ENVIROMENT=local
$(MAKE) install ENVIRONMENT=local
$(MAKE) hydrate ENVIRONMENT=local
# The - at the beginning is not a typo, it will allow this process to failing the make command.
-docker-compose exec -T drupal with-contenv bash -lc 'mkdir -p /var/www/drupal/config/sync && chmod -R 775 /var/www/drupal/config/sync'
docker-compose exec -T drupal with-contenv bash -lc 'chown -R `id -u`:101 /var/www/drupal'
docker-compose exec -T drupal with-contenv bash -lc 'drush migrate:rollback islandora_defaults_tags,islandora_tags'
$(MAKE) initial_content
$(MAKE) login

.PHONY: initial_content
initial_content:
curl -u admin:$(shell cat secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD) -H "Content-Type: application/json" -d "@demo-data/homepage.json" https://${DOMAIN}/node?_format=json
curl -u admin:$(shell cat secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD) -H "Content-Type: application/json" -d "@demo-data/browse-collections.json" https://${DOMAIN}/node?_format=json

# Destroys everything beware!
.PHONY: clean
.SILENT: clean
## Destroys everything beware!
clean:
echo "**DANGER** About to rm your SERVER data subdirs, your docker volumes and your codebase/web"
$(MAKE) confirm
-docker-compose down -v
sudo rm -fr codebase certs secrets/live/*
git clean -xffd .
Expand All @@ -367,11 +422,16 @@ up:
down:
-docker-compose down --remove-orphans

GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
TARGET_MAX_CHAR_NUM=20
.PHONY: login
.SILENT: login
login:
echo "\n\n=========== LOGIN ==========="
docker-compose exec -T drupal with-contenv bash -lc "drush uli --uri=$(DOMAIN)"
echo "=============================\n"

.phony: confirm
confirm:
@echo -n "Are you sure you want to continue and drop your data? [y/N] " && read ans && [ $${ans:-N} = y ]

.PHONY: help
.SILENT: help
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Drupal container. This lets you update code using the IDE of your choice on you
changes are automatically reflected on the Drupal container. Simply place any exported Drupal site as
the `codebase` folder in `isle-dc` and you're good to go.

If you don't provide a codebase, you'll be given a vanilla Drupal 9 instance with the Islandora module
If you don't provide a codebase, you'll be given a basic setup from vanilla Drupal 9 instance with the Islandora module
installed and the bare minimum configured to run. This is useful if you want to build your repository
from scratch and avoid `islandora_defaults`.

Expand Down
28 changes: 28 additions & 0 deletions demo-data/browse-collections.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"type": [
{
"target_id": "page",
"target_type": "node_type"
}
],
"status": [
{
"value": true
}
],
"title": [
{
"value": "Browse Collections"
}
],
"path": [
{
"alias": "/browse-collections"
}
],
"field_display_title": [
{
"value": "Browse Collections"
}
]
}
8 changes: 4 additions & 4 deletions demo-data/drupal.sql

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions demo-data/homepage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"type": [
{
"target_id": "home_page",
"target_type": "node_type"
}
],
"status": [
{
"value": true
}
],
"title": [
{
"value": "Islandora Sandbox"
}
],
"body": [
{
"value": "<div class=\"node__links\">\r\n<ul class=\"links inline\">\r\n\t<li class=\"node-readmore\"><span class=\"node-readmore__link-wrapper\"><a aria-label=\"Browse all collections\" class=\"node-readmore__link\" href=\"/browse-collections\" hreflang=\"en\" rel=\"tag\" title=\"Browse our collections\">Browse All Collections<span class=\"visually-hidden\"> Browse All Collections</span></a></span></li>\r\n</ul>\r\n</div>\r\n\r\n<p>Welcome to the Islandora Community! (Note that all communication in Islandora is subject to our <a href=\"https://islandora.ca/codeofconduct\">code of conduct</a>).</p>\r\n\r\n<p>This demo is loaded with sample content and configurations to demonstrate features of Islandora and provide a starting point for development.&nbsp;&nbsp;Additional information is provided on the <a href=\"http://islandora.ca/\">Islandora Website</a>.&nbsp;</p>\r\n\r\n<p>The <a href=\"https://groups.google.com/g/islandora\">Islandora Google groups mailing list</a> is open to Islandora users who connect to share information. <a href=\"https://join.slack.com/t/islandora/shared_invite/zt-x7e0jj1x-C1pNzKrR7Fvs4QdQziPZ~g\">Join Islandora Slack</a> to ask questions and learn more about community events where you can learn more about Islandora. <a href=\"https://www.drupal.org/slack\">Drupal also maintains a Slack community</a> where you can ask more general questions about Drupal configuration.&nbsp;</p>\r\n\r\n<p>We welcome you to visit and edit <a href=\"https://islandora.github.io/documentation/\">Islandora documentation</a> or submit issues and code to Islandora via repositories in our <a href=\"https://github.com/Islandora\">Github organization. &nbsp;</a></p>\r\n\r\n<p>Thanks, and happy building!</p>\r\n\r\n<p> <a href=\"https://github.com/Islandora/documentation/wiki/Sandbox.Islandora.ca-online-credentials\"> login credentials </a></p>\r\n",
"format": "full_html",
"processed": "<div class=\"node__links\">\n<ul class=\"links inline\">\n\t<li class=\"node-readmore\"><span class=\"node-readmore__link-wrapper\"><a aria-label=\"Browse all collections\" class=\"node-readmore__link\" href=\"/browse-collections\" hreflang=\"en\" rel=\"tag\" title=\"Browse our collections\">Browse All Collections<span class=\"visually-hidden\"> Browse All Collections</span></a></span></li>\n</ul>\n</div>\n\n<p>Welcome to the Islandora Community! (Note that all communication in Islandora is subject to our <a href=\"https://islandora.ca/codeofconduct\">code of conduct</a>).</p>\n\n<p>This demo is loaded with sample content and configurations to demonstrate features of Islandora and provide a starting point for development.  Additional information is provided on the <a href=\"http://islandora.ca/\">Islandora Website</a>. </p>\n\n<p>The <a href=\"https://groups.google.com/g/islandora\">Islandora Google groups mailing list</a> is open to Islandora users who connect to share information. <a href=\"https://join.slack.com/t/islandora/shared_invite/zt-x7e0jj1x-C1pNzKrR7Fvs4QdQziPZ~g\">Join Islandora Slack</a> to ask questions and learn more about community events where you can learn more about Islandora. <a href=\"https://www.drupal.org/slack\">Drupal also maintains a Slack community</a> where you can ask more general questions about Drupal configuration. </p>\n\n<p>We welcome you to visit and edit <a href=\"https://islandora.github.io/documentation/\">Islandora documentation</a> or submit issues and code to Islandora via repositories in our <a href=\"https://github.com/Islandora\">Github organization.  </a></p>\n\n<p>Thanks, and happy building!</p>\n\n<p> <a href=\"https://github.com/Islandora/documentation/wiki/Sandbox.Islandora.ca-online-credentials\"> login credentials </a></p>\n",
"summary": ""
}
],
"field_display_title": [
{
"value": "Islandora Sandbox"
}
]
}
1 change: 1 addition & 0 deletions docker-compose.drupal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ services:
DRUPAL_DEFAULT_FCREPO_PORT: 8081
DRUPAL_DEFAULT_MATOMO_URL: https://${DOMAIN}/matomo/
DRUPAL_DEFAULT_SITE_URL: http://${DOMAIN} # Make sure this is just http and not https!
DRUPAL_DEFAULT_PROFILE: ${DRUPAL_INSTALL_PROFILE}
PHP_MEMORY_LIMIT: ${PHP_MEMORY_LIMIT}
PHP_POST_MAX_SIZE: ${PHP_POST_MAX_SIZE}
PHP_UPLOAD_MAX_FILESIZE: ${PHP_UPLOAD_MAX_FILESIZE}
Expand Down
4 changes: 2 additions & 2 deletions sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ REPOSITORY=islandora

# The version of the isle-buildkit images, non isle-buildkit images have
# their versions specified explicitly in their respective docker-compose files.
TAG=1.0.0-alpha-12
TAG=aed5adc95784c1dd24589a0f77c3bbb063c92113

###############################################################################
# Exposed Containers & Ports
Expand Down Expand Up @@ -124,7 +124,7 @@ PHP_MAX_EXECUTION_TIME=30

# If you're just demoing or are starting from scratch, use this.
INSTALL_EXISTING_CONFIG=false
DRUPAL_INSTALL_PROFILE=standard
DRUPAL_INSTALL_PROFILE=islandora_install_profile_demo

# If you're installing from an existing codebase, uncomment this
#INSTALL_EXISTING_CONFIG=true
Expand Down

0 comments on commit 5b04015

Please sign in to comment.