From 8399c71e4733aa59d36ec4fe0974331fa77e50aa Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Thu, 29 Feb 2024 05:50:40 -0400 Subject: [PATCH] Add sample launch.json file. --- Makefile | 16 ----------- README.md | 19 ++++++++++--- scripts/extra/launch.json | 58 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 20 deletions(-) create mode 100644 scripts/extra/launch.json diff --git a/Makefile b/Makefile index 012d09a8d..18a072e0d 100644 --- a/Makefile +++ b/Makefile @@ -608,23 +608,7 @@ run-islandora-migrations: .SILENT: solr-cores solr-cores: docker compose exec -T drupal with-contenv bash -lc "for_all_sites create_solr_core_with_default_config" - mkdir -p data - curl -k -L https://github.com/dbmdz/solr-ocrhighlighting/releases/download/0.8.4/solr-ocrhighlighting-0.8.4.jar > data/solr-ocrhighlighting.jar - docker-compose exec -T solr with-contenv bash -lc "mkdir -p /opt/solr/server/solr/contrib/ocrhighlighting/lib /opt/solr/server/solr/ISLANDORA/" - docker cp data/solr-ocrhighlighting.jar $$(docker-compose ps -q solr):/opt/solr/server/solr/contrib/ocrhighlighting/lib/solr-ocrhighlighting.jar - $(MAKE) solr-cores-lucene-highlighter - docker-compose exec -T solr with-contenv bash -lc "chown -R solr:solr /opt/solr/server/solr/contrib/ocrhighlighting" - docker-compose restart solr - sleep 10 - docker-compose restart solr - sleep 10 - docker-compose exec -T drupal with-contenv bash -lc "for_all_sites create_solr_core" -.PHONY: solr-cores-lucene-highlighter -.SILENT: solr-cores-lucene-highlighter -solr-cores-lucene-highlighter: - curl -k -L https://repo1.maven.org/maven2/org/apache/lucene/lucene-queries/9.4.0/lucene-queries-9.4.0.jar > data/lucene-queries-8.0.0.jar - docker cp data/lucene-queries-8.0.0.jar $$(docker-compose ps -q solr):/opt/solr/server/solr/contrib/ocrhighlighting/lib/lucene-queries-8.0.0.jar .PHONY: namespaces ## Creates namespaces in Blazegraph according to the environment variables. diff --git a/README.md b/README.md index 1264f26d7..3727c7cf0 100644 --- a/README.md +++ b/README.md @@ -225,7 +225,7 @@ To enable using secrets prior to running the `make` commands, copy sample.env to .env. Set `USE_SECRETS=true` in your .env file. Make a copy of the files in /secrets/template/ to /secrets/live/. -To enable using secrets after run `make local` or `make up`, set +To enable using secrets after run `make local` or `make up`, set `USE_SECRETS=true` in your .env file. When you run `make docker-compose.yml`, a large block of `secrets` will be added at the top of your `docker-compose.yml` file. @@ -312,13 +312,24 @@ the following. XDebug can be temporarily installed in the Drupal container via the 'make xdebug' command. -It uploads the contents of scripts/extra/xdebug.ini to the server. +The make xdebug command also uploads the contents of scripts/extra/xdebug.ini to the server. -This default configuration will automatically connect to the Docker host on every +This default configuration will automatically connect to the Docker host port 9003 on every request. You may wish to customize this file to your preference. When you run 'make down' and 'make up' again, XDebug will be gone. +### Sample launch.json file + +For Visual Studio: Code users, there is a sample launch.json file in scripts/extras. Put this in +your project codebase's .vscode folder and you should be able to launch "Listen for XDebug" to have +your editor stop at breakpoints you set. Check that the relative paths +correspond to your codebase, the file assumes +it sits in the root of an ISLE-DC project folder. + +The file also contains a "Launch Chrome" debug profile +which lets you set breakpoints in JavaScript code. + ### Watchtower The [watchtower](https://hub.docker.com/r/v2tec/watchtower/) container monitors @@ -397,7 +408,7 @@ lowercasename: echo "first line in command needs to be indented. There are exceptions to this, review functions in the Makefile for examples of these exceptions." ``` -NOTE: A target you add in the custom.Makefile will not override an existing target with the same label in this repository's defautl Makefile. +NOTE: A target you add in the custom.Makefile will not override an existing target with the same label in this repository's defautl Makefile. Running the new `custom.Makefile` commands are exactly the same as running any other Makefile command. Just run `make` and the function's name. ```bash diff --git a/scripts/extra/launch.json b/scripts/extra/launch.json new file mode 100644 index 000000000..a3183a567 --- /dev/null +++ b/scripts/extra/launch.json @@ -0,0 +1,58 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Launch Chrome", + "request": "launch", + "type": "chrome", + "url": "https://islandora.traefik.me", + "webRoot": "${workspaceFolder}/codebase/web" + }, + { + "name": "Listen for Xdebug", + "type": "php", + "request": "launch", + "port": 9003, + "pathMappings": { + "/var/www/drupal": "${workspaceRoot}/codebase", + } + }, + { + "name": "Launch currently open script", + "type": "php", + "request": "launch", + "program": "${file}", + "cwd": "${fileDirname}", + "port": 0, + "runtimeArgs": [ + "-dxdebug.start_with_request=yes" + ], + "env": { + "XDEBUG_MODE": "debug,develop", + "XDEBUG_CONFIG": "client_port=${port}" + } + }, + { + "name": "Launch Built-in web server", + "type": "php", + "request": "launch", + "runtimeArgs": [ + "-dxdebug.mode=debug", + "-dxdebug.start_with_request=yes", + "-S", + "localhost:0" + ], + "program": "", + "cwd": "${workspaceRoot}", + "port": 9003, + "serverReadyAction": { + "pattern": "Development Server \\(http://islandora.traefik.me:([0-9]+)\\) started", + "uriFormat": "http://islandora.traefik.me:%s", + "action": "openExternally" + } + } + ] +}