building custom images (migrated from BuildScripts)

This commit is contained in:
Paul Brodner
2019-03-04 16:45:26 +00:00
parent b30dcea8ec
commit 9e303f55ed
11 changed files with 143 additions and 19 deletions

View File

@@ -4,13 +4,12 @@ UNAME := $(shell uname)
SHELL := /bin/bash
export COMPOSE_INTERACTIVE_NO_CLI=1
# CURRENT_DIR is the current location of this script: qa/search
# CURRENT_DIR is the folder where this Makefile is saved
CURRENT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
# ROOT_DIR is the location of 'qa' folder
# the root dir where E2E maven project resides
ROOT_DIR:=$(shell dirname $(CURRENT_DIR))
# TEST_DIR is the location of POM
POM_DIR:=$(shell dirname $(ROOT_DIR))
help: ## main: output this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@@ -60,4 +59,8 @@ standard: ## main: start with standard docker-compose.yml file
make clean && $(dc) config && $(dc) up -d && make wait
run-mvn-tests: ## run e2e maven suite: $make run-mvn-tests suiteXmlFile=src/path-to-suite.xml
cd $(POM_DIR) && $(mvn) test -DsuiteXmlFile=$(suiteXmlFile)
ifndef suiteXmlFile
@echo suiteXmlFile not specified! Usage: make run-mvn-tests suiteXmlFile=src/path-to-suite.xml
exit 1
endif
cd $(ROOT_DIR) && $(mvn) test -DsuiteXmlFile=$(suiteXmlFile)

View File

@@ -6,19 +6,31 @@ This folder contains code for provisioning ACS with SearchServices or InsightEng
```ruby
.
├── README.md # this readme file
── search # code related to search product
├── Makefile # main Makefile (with common tasks)
── backup # related to backup testing of Search Service
── Makefile # start here if you want to test backup
├── README.md # how you can use it
└── docker-compose.backup.yml # overrides standard docker-compose.yml with backup data
── docker-compose.yml # standard docker-compose.yml for Search Service
├── sharding # related to Sharding
├── README.md
── insight # INSIGHT ENGINE
├── docker-compose.yml
── upgrade
── Makefile
└── search # SEARCH SERVICES
├── Makefile # main Makefile - inherited by all Makefiles bellow
── backup
├── Makefile
├── README.md # start here if you want to test the backup
└── docker-compose.backup.yml
├── custom
├── Dockerfile
├── Makefile
├── README.md # start here if you want to built/test a custom image
├── docker-compose.custom.yml
└── spellcheck
└── enable-spellcheck.sh
├── docker-compose.yml
├── sharding
├── Makefile
├── README.md
└── docker-compose.sharding.yml
└── upgrade
├── Makefile # start here if you want to test the upgrade
├── Makefile
├── README.md
└── docker-compose.upgrade.yml
```

View File

@@ -1,11 +1,13 @@
include ../Makefile
include ../../Makefile
include .env
# the suffix of the backup taken in time. It can be overriden on runtime: make SUFIX=T1 backup-perform
SUFIX ?=T0
# CURRENT_DIR is the folder where this Makefile is saved
CURRENT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
# this is used also in compose yml files
export HOST_BACKUP_LOCATION:=$(CURRENT_DIR)/backup/host-bkp
export HOST_BACKUP_LOCATION:=$(CURRENT_DIR)/host-bkp
ifeq ($(dc-backup),)
dc-backup:=$(dc) -f ../docker-compose.yml -f docker-compose.backup.yml

View File

@@ -0,0 +1,11 @@
# docker-compose related environments
ALFRESCO_IMAGE=alfresco/alfresco-content-repository
ALFRESCO_TAG=6.1.0-EA3
SHARE_IMAGE=alfresco/alfresco-share
SHARE_TAG=6.0
POSTGRES_IMAGE=postgres
POSTGRES_TAG=10.1
SEARCH_IMAGE=quay.io/alfresco/search-services
SEARCH_TAG=latest
ACTIVEMQ_IMAGE=alfresco/alfresco-activemq
ACTIVEMQ_TAG=5.15.6

View File

@@ -0,0 +1,16 @@
ARG SEARCH_TAG=latest
FROM quay.io/alfresco/search-services:$SEARCH_TAG
LABEL creator="Paul Brodner" maintainer="Alfresco Search Services Team"
ARG SCRIPTS_FOLDER=
USER root
RUN echo " &" >> $DIST_DIR/solr/bin/search_config_setup.sh && \
echo "bash -c \"find $DIST_DIR/scripts/ -maxdepth 1 -type f -executable -name '*.sh' -exec {} \\;\"" >> $DIST_DIR/solr/bin/search_config_setup.sh && \
echo "bash -c \"tail -f $DIST_DIR/logs/solr.log\"" >> $DIST_DIR/solr/bin/search_config_setup.sh
USER solr
COPY ${SCRIPTS_FOLDER}/* ${DIST_DIR}/scripts/
# we need this, because we tail on it in the search_config_setup.sh (see above)
RUN touch ./logs/solr.log

View File

@@ -0,0 +1,21 @@
include ../../Makefile
include .env
# CURRENT_DIR is the folder where this Makefile is saved
CURRENT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
ifeq ($(dc-custom),)
dc-custom:=$(dc) -f ../docker-compose.yml -f docker-compose.custom.yml
endif
## ---- CUSTOM
build: ## 1 - build a custom image: $ make SCRIPTS_FOLDER=spellcheck custom-build
ifndef SCRIPTS_FOLDER
@echo SCRIPTS_FOLDER not defined "Usage: make SCRIPTS_FOLDER=spellcheck custom-build"
exit 1
endif
$(dc-custom) build --force-rm --no-cache --pull --build-arg SCRIPTS_FOLDER=$(SCRIPTS_FOLDER)
start: ## 2 - starts the custom image built: $ make start
$(dc-custom) up -d && make wait

View File

@@ -0,0 +1,25 @@
# About
Start Search Service with a custom configuration
# Steps
* **a)** under `custom` folder create a new folder that will hold all settings
>checkout [spellcheck](.spellcheck) folder for example
>add here any shell scripts that will enable/disable a particular setting
* **b)** build the new image setting SCRIPTS_FOLDER to you folder already created
```shel
make SCRIPTS_FOLDER=spellcheck build
```
>notice that out [docker-compose.custom.yml](.custom/docker-compose.custom.yml) file is using a [Dockerfile](.custom/Dockerfile) to built you new image.
> at runtime, all shell scripts from your folder are executed and the settings are applied.
* **c)** the image is built locally, now start it up
```shel
make start
```
# Environment Settings
Pay attention at the values that exist in [.env](.env) file. These settings will be picked up in custom docker-compose.*.yml file(s)

View File

@@ -0,0 +1,9 @@
version: '3'
services:
search:
build:
context: ./custom
dockerfile: Dockerfile
image: quay.io/alfresco/search-services-custom:${SEARCH_TAG}
volumes:
- .:/backup

View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -ex
echo "Enabling SpellCheck"
cat <<EOF >> /opt/alfresco-search-services/solrhome/conf/shared.properties
# Enabling SpellCheck
# configuration:
# * http://docs.alfresco.com/6.0/concepts/solr-shared-properties.html
# * https://docs.alfresco.com/5.2/tasks/solr6-install-withoutSSL.html
# test it: http://docs.alfresco.com/6.0/concepts/search-api-spellcheck.html
# Suggestable Properties
alfresco.suggestable.property.0={http://www.alfresco.org/model/content/1.0}name
alfresco.suggestable.property.1={http://www.alfresco.org/model/content/1.0}title
alfresco.suggestable.property.2={http://www.alfresco.org/model/content/1.0}description
alfresco.suggestable.property.3={http://www.alfresco.org/model/content/1.0}content
EOF

View File

@@ -1,6 +1,9 @@
include ../Makefile
include ../../Makefile
include .env
# CURRENT_DIR is the folder where this Makefile is saved
CURRENT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
ifeq ($(sharding),)
sharding:=$(dc) -f ../docker-compose.yml -f docker-compose.sharding.yml
endif

View File

@@ -1,6 +1,9 @@
include ../Makefile
include ../../Makefile
include .env
# CURRENT_DIR is the folder where this Makefile is saved
CURRENT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
ifeq ($(dc-upgrade),)
dc-upgrade:=$(dc) -f ../docker-compose.yml -f docker-compose.upgrade.yml
endif