migrate upgrade code from BuildScripts

This commit is contained in:
Paul Brodner
2019-03-04 15:31:23 +00:00
parent fdd5774a52
commit c09e21fc14
7 changed files with 92 additions and 9 deletions

3
e2e-test/.gitignore vendored
View File

@@ -32,3 +32,6 @@ target
*.ear
qa/search/backup/host-bkp
qa/search/backup/host-bkp_T0
image-digests.txt
qa/search/upgrade/solr-data
qa/search/upgrade/solr-contentstore

View File

@@ -14,4 +14,11 @@ This folder contains code for provisioning ACS with SearchServices or InsightEng
├── 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
├── Makefile
├── README.md
└── docker-compose.sharding.yml
└── upgrade
├── Makefile # start here if you want to test the upgrade
└── docker-compose.upgrade.yml
```

View File

@@ -2,6 +2,7 @@
# execute any on the task that are found here from your terminal
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:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
@@ -47,7 +48,7 @@ shell: ## main: open a shell to search service: $ make shell
@$(dc) exec search sh
# kill all containers on default docker-compose.yml file
clean: ## kill containers
clean: ## main: kill containers
$(dc) kill && $(dc) rm -fv
# just waits for a alfresco and solr to start
@@ -55,5 +56,8 @@ wait: ## main: wait for alfresco service && solr to startup
$(helpers)/wait-service-to-start.sh && \
$(helpers)/wait-service-to-start.sh http://localhost:8083/solr
standard: ## start with standard docker-compose.yml file
make clean && $(dc) config && $(dc) up -d && make wait
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)

View File

@@ -3,9 +3,6 @@ include .env
# the suffix of the backup taken in time. It can be overriden on runtime: make SUFIX=T1 backup-perform
SUFIX ?=T0
suiteXmlFile ?=./src/test/resources/search-pre-backup-suite.xml
export COMPOSE_INTERACTIVE_NO_CLI=1
# this is used also in compose yml files
export HOST_BACKUP_LOCATION:=$(CURRENT_DIR)/backup/host-bkp
@@ -45,9 +42,6 @@ backup-restore: ## 3 - start restoring from backup location
docker-compose exec postgres bash -c 'psql --dbname=postgresql://alfresco:alfresco@127.0.0.1:5432/alfresco < /backup/db/alfresco.pg' && \
$(dc-backup) up -d
run-mvn-tests: ## run e2e suiteXmlFile: $make run-e2e-tests suiteXmlFile=./src/test/resources/search-post-backup-suite.xml
cd $(POM_DIR) && $(mvn) test -DsuiteXmlFile=$(suiteXmlFile)
all: show-config ## 0 - executes the entire backup process
# perform the backup and waits until the server is starting
# do some change on backed up data

View File

@@ -0,0 +1,38 @@
include ../Makefile
include .env
ifeq ($(dc-upgrade),)
dc-upgrade:=$(dc) -f ../docker-compose.yml -f docker-compose.upgrade.yml
endif
## ---- UPGRADE
set_version ?=latest # default version that will be used in tasks
as-previous: clean ## 1 - install the previous version: $ make set_version=1.2.1 as-previous
rm -rf ./solr-data && \
rm -rf ./solr-contentstore && \
rm -f ./image-digests.txt
export SEARCH_TAG=$(set_version) && \
$(dc-upgrade) pull && \
echo "\n====Previous====" > image-digests.txt && \
$(dc-upgrade) config --resolve-image-digests >> image-digests.txt && \
$(dc-upgrade) up -d && \
docker ps
as-current: ## 2 - upgrade previous to this version $ make set_version=2.0.x as-current
$(dc-upgrade) kill search && \
$(dc-upgrade) rm -f search && \
export SEARCH_TAG=$(set_version) && \
$(dc-upgrade) pull search && \
echo "\n====Current====" >> image-digests.txt && \
$(dc-upgrade) config --resolve-image-digests >> image-digests.txt && \
$(dc-upgrade) up -d search && \
docker ps
#
# Run the following commands if you need to test the upgrade e2e
#
#make set_version=1.2.1 as-previous wait
#make run-mvn-tests suiteXmlFile=./src/test/resources/search-pre-upgrade-suite.xml
#make set_version=2.0.x as-current wait
#make run-mvn-tests suiteXmlFile=./src/test/resources/search-post-upgrade-suite.xml

View File

@@ -0,0 +1,27 @@
# About
Testing the Upgrade of SearchService product
# Steps
* **a)** start the initial version
```shel
make set_version=1.2.1 as-previous wait
```
>notice that new folders will appear on you "upgrade" folder with data from container(s)
* **b)** create some data manually or using automated tests found on this project
```shel
make run-mvn-tests suiteXmlFile=./src/test/resources/search-pre-upgrade-suite.xml
```
* **c)** now upgrade to new version
```shel
make set_version=2.0.x as-current wait
```
* **d)** and test that upgrade data exist
```shel
make run-mvn-tests suiteXmlFile=./src/test/resources/search-post-upgrade-suite.xml
```
# 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,10 @@
version: '3'
services:
search:
environment:
- VERSION=${SEARCH_TAG}
image: quay.io/alfresco/search-services:${SEARCH_TAG}
volumes:
- "./upgrade/solr-data:/opt/alfresco-search-services/data"
- "./upgrade/solr-contentstore:/opt/alfresco-search-services/contentstore"