diff --git a/01-personal-api-tokens/README.md b/01-personal-api-tokens/README.md index ba33021..2d5e19d 100644 --- a/01-personal-api-tokens/README.md +++ b/01-personal-api-tokens/README.md @@ -61,13 +61,7 @@ You should a `permission denied` message: In this tutorial we used `docker run` with an environment variable pointing to a [provisioning script](./provisioning.yaml) stored externally. -This [provisioning script](./provisioning.yaml) uses three different commands: - -- `installModule` to install a Jahia module. -- `startModule` to start a Jahia module. This command is useful to pause execution of the script until the module was started, - allowing further command using that module to be used in the script. - If you didn't need to use the module as part of Jahia provisioning, you could simply use `installModule` with the `autoStart` parameter. -- `executeScript` to execute a script (groovy or GraphQL). In our example the script is located in a remote location, but we could also execute a script on Jahia filesystem. +This [provisioning script](./provisioning.yaml) contains an `executeScript` that will executed a Groovy script or GraphQL query present at the provided location. ## Next diff --git a/02-luxe-mariadb/README.md b/02-luxe-mariadb/README.md index b381d61..803713f 100644 --- a/02-luxe-mariadb/README.md +++ b/02-luxe-mariadb/README.md @@ -18,7 +18,7 @@ To get started, execute the following commands: ```bash cd ~ git clone https://github.com/Jahia/provisioning-tutorials.git -cd provisioning-tutorials/02-luxe-mariadb +cd ./provisioning-tutorials/02-luxe-mariadb docker compose up --renew-anon-volumes ``` diff --git a/02-luxe-mariadb/docker-compose.yml b/02-luxe-mariadb/docker-compose.yml index ea88214..97098cd 100644 --- a/02-luxe-mariadb/docker-compose.yml +++ b/02-luxe-mariadb/docker-compose.yml @@ -1,4 +1,3 @@ -version: "3.9" services: mariadb: image: library/mariadb:10-focal diff --git a/03-augmented-search/README.md b/03-augmented-search/README.md index aa6a274..7f80f2e 100644 --- a/03-augmented-search/README.md +++ b/03-augmented-search/README.md @@ -16,21 +16,30 @@ To get started, execute the following commands: ```bash cd ~ git clone https://github.com/Jahia/provisioning-tutorials.git -cd provisioning-tutorials/03-augmented-search -docker compose up --renew-anon-volumes -d -sleep 10 +cd ./provisioning-tutorials/03-augmented-search + +# Start ElasticSearch container +docker compose up --renew-anon-volumes --wait elasticsearch + +# Install required plugins for ElasticSearch docker exec --tty elasticsearch /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch analysis-icu docker exec --tty elasticsearch /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch analysis-stempel docker exec --tty elasticsearch /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch analysis-kuromoji + +# Restart ElasticSearch container (required after plugins installation) docker compose restart elasticsearch + +# Start other docker-compose services; wait for services healthcheck to complete +docker compose up --wait + +# Watch out Jahia log docker logs -f jahia ``` - -While the elasticsearch cluster is starting, you will first see the MariaDB container booting up and Jahia creating the necessary tables and continue with its startup. +Here during the last steps, MariaDB and Elasticsearch containers will be started first, and once their healthchecks report a successful status, Jahia will start booting up. It might take a while for the docker-compose project to be ready due to the many provisioning and indexing operations being performed. ## After startup -At the end of startup (give it a minute or two), open a browser to Luxe's home page at http://localhost:8080 and navigate to the "Search" menu. +At the end of startup (*give it a minute or two for the reindexing to complete*), open a browser to Luxe's home page at http://localhost:8080 and navigate to the "Search" menu. Augmented Search UI and Luxe diff --git a/03-augmented-search/docker-compose.yml b/03-augmented-search/docker-compose.yml index 0f5772c..f40986e 100644 --- a/03-augmented-search/docker-compose.yml +++ b/03-augmented-search/docker-compose.yml @@ -14,6 +14,12 @@ services: MYSQL_DATABASE: jahia MYSQL_USER: jahia MYSQL_PASSWORD: jahia + healthcheck: + test: ["CMD-SHELL", "mysqladmin ping -h localhost -u root -p$$MYSQL_ROOT_PASSWORD || exit 1"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 30s elasticsearch: container_name: elasticsearch image: docker.elastic.co/elasticsearch/elasticsearch:9.3.1 @@ -31,13 +37,22 @@ services: - 9200:9200 networks: stack: + healthcheck: + test: ["CMD-SHELL", "curl -k -u elastic:$$ELASTIC_PASSWORD 'http://localhost:9200/_cluster/health?wait_for_status=green&timeout=5s' || exit 1"] + interval: 10s + timeout: 10s + retries: 30 + start_period: 60s jahia: container_name: jahia image: jahia/jahia-ee:8.2 networks: - stack depends_on: - - mariadb + mariadb: + condition: service_healthy + elasticsearch: + condition: service_healthy ports: - 8080:8080 deploy: @@ -54,5 +69,11 @@ services: PROCESSING_SERVER: "true" MAX_RAM_PERCENTAGE: 95 EXECUTE_PROVISIONING_SCRIPT: "https://raw.githubusercontent.com/Jahia/provisioning-tutorials/main/03-augmented-search/provisioning.yaml" + healthcheck: + test: ["CMD-SHELL", "curl -k 'http://localhost:8080/start' || exit 1"] + interval: 10s + timeout: 10s + retries: 60 + start_period: 600s networks: stack: diff --git a/03-augmented-search/provisioning.yaml b/03-augmented-search/provisioning.yaml index 3213ca3..a088562 100644 --- a/03-augmented-search/provisioning.yaml +++ b/03-augmented-search/provisioning.yaml @@ -5,7 +5,7 @@ # Augmented-Search dependencies are only available from Jahia store # So we're adding a new repository to be able to resolve these dependencies -- addMavenRepository: "https://devtools.jahia.com/nexus/content/repositories/jahia-public-app-store/@id=JahiaStore" +- addMavenRepository: "https://devtools.jahia.com/nexus/content/repositories/jahia-public-app-store/@id=JahiaPublicAppStore" # Install and start Modules for Augmented Search - installModule: @@ -24,15 +24,13 @@ elasticsearchConnector.password: "8gFk4F7r3nRz+yHBf7i+/oeEdHoPU0S8" # Encrypted version of "password" (see docker-compose.yml) elasticsearchConnector.useXPackSecurity: "true" elasticsearchConnector.useEncryption: "false" - elasticsearchConnector.additionalHostAddresses[0]: "elasticsearch:9210" # Enable Augmented Search sample UI on Luxe - enable: "augmented-search-ui" site: "luxe" -# Configure Augmented Search and Luxe and start indexation +# Configure Augmented Search and Luxe - executeScript: "https://raw.githubusercontent.com/Jahia/provisioning-tutorials/main/03-augmented-search/as-add-luxe.graphql" -- executeScript: "https://raw.githubusercontent.com/Jahia/provisioning-tutorials/main/03-augmented-search/as-index-luxe.graphql" # Create a new menu entry in Luxe and add Augmented Search UI - executeScript: "https://raw.githubusercontent.com/Jahia/provisioning-tutorials/main/03-augmented-search/asui-add-page.graphql" @@ -40,3 +38,6 @@ - executeScript: "https://raw.githubusercontent.com/Jahia/provisioning-tutorials/main/03-augmented-search/asui-add-as-node.graphql" - executeScript: "https://raw.githubusercontent.com/Jahia/provisioning-tutorials/main/03-augmented-search/asui-publish-page.graphql" - executeScript: "https://raw.githubusercontent.com/Jahia/provisioning-tutorials/main/03-augmented-search/asui-publish-node.graphql" + +# Trigger indexation +- executeScript: "https://raw.githubusercontent.com/Jahia/provisioning-tutorials/main/03-augmented-search/as-index-luxe.graphql" diff --git a/04-jexperience/.env b/04-jexperience/.env index eccc53e..235a6e9 100644 --- a/04-jexperience/.env +++ b/04-jexperience/.env @@ -1,4 +1,4 @@ -MAXMIND_KEY=CHANGEME +JCUSTOMER_MAXMIND_GEOIP2_CITY_DATABASE_URL=https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=CHANGEME&suffix=tar.gz JAHIA_IMAGE=jahia/jahia-ee:8.2 UNOMI_IMAGE=jahia/jcustomer:3 ELASTICSEARCH_IMAGE=docker.elastic.co/elasticsearch/elasticsearch:9.3.1 diff --git a/04-jexperience/README.md b/04-jexperience/README.md index 0f73954..fa55d3a 100644 --- a/04-jexperience/README.md +++ b/04-jexperience/README.md @@ -12,7 +12,7 @@ To get started, execute the following commands: ```bash cd ~ git clone https://github.com/Jahia/provisioning-tutorials.git -cd provisioning-tutorials/04-jexperience +cd ./provisioning-tutorials/04-jexperience ``` This tutorial is a bit more cumbersome when compared to the previous ones as it requires you to obtain a [GeoLite license key from maxmind](https://dev.maxmind.com/geoip/geoip2/geolite2/). This is used by Unomi to associate IP addresses with their geolocation. diff --git a/04-jexperience/docker-compose.yml b/04-jexperience/docker-compose.yml index 566b8e8..1a19d21 100644 --- a/04-jexperience/docker-compose.yml +++ b/04-jexperience/docker-compose.yml @@ -12,6 +12,12 @@ services: MYSQL_DATABASE: jahia MYSQL_USER: jahia MYSQL_PASSWORD: jahia + healthcheck: + test: ["CMD-SHELL", "mysqladmin ping -h localhost -u root -p$$MYSQL_ROOT_PASSWORD || exit 1"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 30s elasticsearch: container_name: elasticsearch image: ${ELASTICSEARCH_IMAGE} @@ -25,6 +31,12 @@ services: - ELASTIC_PASSWORD=${ELASTIC_PASSWORD} - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms2g -Xmx2g" + healthcheck: + test: ["CMD-SHELL", "curl -k -u elastic:$$ELASTIC_PASSWORD 'http://localhost:9200/_cluster/health?wait_for_status=green&timeout=5s' || exit 1"] + interval: 10s + timeout: 10s + retries: 30 + start_period: 60s ports: - 9200:9200 deploy: @@ -35,7 +47,12 @@ services: container_name: jahia image: ${JAHIA_IMAGE} depends_on: - - mariadb + mariadb: + condition: service_healthy + elasticsearch: + condition: service_healthy + jcustomer: + condition: service_healthy ports: - 8080:8080 mem_limit: 8gb @@ -52,6 +69,12 @@ services: PROCESSING_SERVER: "true" MAX_RAM_PERCENTAGE: 95 EXECUTE_PROVISIONING_SCRIPT: "https://raw.githubusercontent.com/Jahia/provisioning-tutorials/main/04-jexperience/provisioning.yaml" + healthcheck: + test: ["CMD-SHELL", "curl -k 'http://localhost:8080/start' || exit 1"] + interval: 10s + timeout: 10s + retries: 60 + start_period: 600s jcustomer: container_name: jcustomer image: ${UNOMI_IMAGE} @@ -75,8 +98,14 @@ services: - 9443:9443 - 8181:8181 - 8102:8102 + healthcheck: + test: ["CMD-SHELL", "curl -k -u karaf:$$UNOMI_ROOT_PASSWORD 'http://localhost:8181/cxs/cluster' || exit 1"] + interval: 10s + timeout: 5s + retries: 10 depends_on: - - elasticsearch + elasticsearch: + condition: service_healthy networks: stack: driver: bridge diff --git a/04-jexperience/provisioning.yaml b/04-jexperience/provisioning.yaml index 13c079f..3ffc19a 100644 --- a/04-jexperience/provisioning.yaml +++ b/04-jexperience/provisioning.yaml @@ -5,8 +5,9 @@ # Install and start Modules for Forms and jExperience - installModule: + - "mvn:org.jahia.modules/font-awesome/6.1.5" - "mvn:org.jahia.modules/forms-core/3.17.0" - - "mvn:org.jahia.modules/forms-extended-inputs/2.2.0" + - "mvn:org.jahia.modules/forms-extended-inputs/2.3.0" - "mvn:org.jahia.modules/forms-nocss-theme/2.1.0" - "mvn:org.jahia.modules/forms-prefill/2.1.0" - "mvn:org.jahia.modules/forms-snippets-extension/3.3.0" diff --git a/04-jexperience/startup.sh b/04-jexperience/startup.sh index fffd389..50c73c0 100644 --- a/04-jexperience/startup.sh +++ b/04-jexperience/startup.sh @@ -4,6 +4,12 @@ source .env docker compose up -d --renew-anon-volumes --remove-orphans --force-recreate elasticsearch +echo "$(date +'%d %B %Y - %k:%M') - Installing Elasticsearch plugins" +docker exec --tty elasticsearch /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch analysis-icu +docker exec --tty elasticsearch /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch analysis-stempel +docker exec --tty elasticsearch /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch analysis-kuromoji +docker compose restart elasticsearch + echo "$(date +'%d %B %Y - %k:%M') - Waiting for Elasticsearch to startup" while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://elastic:${ELASTIC_PASSWORD}@localhost:9200/_security/user)" != "200" ]]; do sleep 5; @@ -17,17 +23,13 @@ while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://elastic:${ELASTIC_PA do sleep 5; done -echo "\n$(date +'%d %B %Y - %k:%M') - Set jcustomer user in ES" +echo "$(date +'%d %B %Y - %k:%M') - Set jcustomer user in ES" curl -X POST http://elastic:${ELASTIC_PASSWORD}@localhost:9200/_security/user/jcustomer?refresh=wait_for --header "Content-Type: application/json" -d "{ \ \"password\" : \"${ELASTIC_PASSWORD}\",\ \"roles\" : [ \"jcustomer\" ] \ }" -echo "\n$(date +'%d %B %Y - %k:%M') - Installing Elasticsearch plugins" -docker exec --tty elasticsearch /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch analysis-icu -docker exec --tty elasticsearch /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch analysis-stempel -docker exec --tty elasticsearch /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch analysis-kuromoji -docker compose restart elasticsearch +echo "$(date +'%d %B %Y - %k:%M') - Starting remaining services" +docker-compose up --wait -echo "\n$(date +'%d %B %Y - %k:%M') - Starting remaining services" -docker-compose up -d +docker logs -f jahia