Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPSEXP-2732 Add search enterprise metadata image Dockerfile #1

Merged
merged 65 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
4ac6602
OPSEXP-2732 Add search enterprise metadata image Dockerfile
pmacius Jul 15, 2024
8678055
add readme
pmacius Jul 15, 2024
2c78b22
test
pmacius Jul 15, 2024
4b3b7e5
fix
pmacius Jul 15, 2024
04939c9
test
pmacius Jul 15, 2024
7ed2fe6
:)
pmacius Jul 15, 2024
1583c78
another spelling
pmacius Jul 15, 2024
8adfde9
test
pmacius Jul 15, 2024
74b7624
login to quay
pmacius Jul 15, 2024
50453c6
fix
pmacius Jul 15, 2024
efeddc2
fix
pmacius Jul 15, 2024
d777677
fix names
pmacius Jul 15, 2024
23eb5c9
test
pmacius Jul 15, 2024
3554ea5
test with custom run and dump
pmacius Jul 15, 2024
3b8766a
try cmd
pmacius Jul 15, 2024
4dc9521
try cmd
pmacius Jul 15, 2024
536ca18
test
pmacius Jul 15, 2024
623a2b3
fix
pmacius Jul 15, 2024
d325281
fix
pmacius Jul 15, 2024
6a47187
add pre-commit
pmacius Jul 15, 2024
a890166
test
pmacius Jul 15, 2024
a679d32
copy instead of add
pmacius Jul 15, 2024
4735659
debug
pmacius Jul 15, 2024
4df4fff
debug
pmacius Jul 15, 2024
7683138
test
pmacius Jul 15, 2024
2e60347
test with add
pmacius Jul 15, 2024
6a80130
test
pmacius Jul 15, 2024
c07505a
test
pmacius Jul 15, 2024
106f812
test
pmacius Jul 16, 2024
c86ab51
test
pmacius Jul 16, 2024
787ea7d
test
pmacius Jul 16, 2024
adb412c
try
pmacius Jul 16, 2024
b9d65b3
test
pmacius Jul 16, 2024
5074891
try another checkout
pmacius Jul 16, 2024
21cd9ee
test
pmacius Jul 16, 2024
502c4e4
test
pmacius Jul 16, 2024
efc49f7
wait for logs
pmacius Jul 16, 2024
b32f41e
test
pmacius Jul 16, 2024
e4182c0
add docker file
pmacius Jul 16, 2024
0f3f84c
image name fix
pmacius Jul 16, 2024
e1100ef
add uploading and downloading the images as a tar
pmacius Jul 16, 2024
0e9bc34
test
pmacius Jul 16, 2024
a585bb2
show available images
pmacius Jul 16, 2024
64cc380
test workflow
pmacius Jul 16, 2024
4b185e1
test dafult behavior
pmacius Jul 16, 2024
d5d58d2
revert
pmacius Jul 16, 2024
baedf11
dump container logs at the end of docker compose
pmacius Jul 16, 2024
1a2e489
hash github actions
pmacius Jul 16, 2024
74f1edf
add upstream image for alfresco
pmacius Jul 16, 2024
398e434
add share
pmacius Jul 16, 2024
fafb2c6
add whole docker compose with custom image
pmacius Jul 16, 2024
b1e3502
remove dearch componetns
pmacius Jul 16, 2024
68f1fba
test postman
pmacius Jul 16, 2024
eefaa55
compose in directory due to cd command in action
pmacius Jul 16, 2024
d0db7c2
fix
pmacius Jul 16, 2024
5ab3e7f
add search
pmacius Jul 16, 2024
25a2003
temporarly remove 01 ACS-basic-auth / search-api-validation
pmacius Jul 16, 2024
267fe06
add healthcheck for metadata
pmacius Jul 16, 2024
432ac70
review
pmacius Jul 17, 2024
78b1510
empty java
pmacius Jul 17, 2024
04afe5d
empty java
pmacius Jul 17, 2024
55a66cd
review
pmacius Jul 17, 2024
8c25b28
review
pmacius Jul 17, 2024
305ff04
review
pmacius Jul 17, 2024
2536a86
move the healthcheck to Dockerfile
pmacius Jul 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Build, Run and Test Docker Image

on: [push]

jobs:
build-run-test:
runs-on: ubuntu-latest
strategy:
matrix:
images:
- artifact: alfresco-elasticsearch-live-indexing-metadata
version: 4.0.1
name: alfresco-enterprise-search-metadata
path: search/enterprise/metadata
extension: -app.jar
pmacius marked this conversation as resolved.
Show resolved Hide resolved
group: org.alfresco

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 4.1.7

- name: Set up QEMU
uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # 3.1.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@2ad185228a349d19414702819e06df9fa4314287 # 3.4.0

- name: Login to Docker Hub
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # 3.2.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Setup .netrc
run: |
echo "machine nexus.alfresco.com" >> ~/.netrc
echo "login ${{ secrets.NEXUS_USERNAME }}" >> ~/.netrc
echo "password ${{ secrets.NEXUS_PASSWORD }}" >> ~/.netrc

pmacius marked this conversation as resolved.
Show resolved Hide resolved
- name: Fetch artifacts from nexus
run: bash ${{ github.workspace }}/scripts/fetch-artifact.sh ${{ matrix.images.artifact }} ${{ matrix.images.version }} ${{ matrix.images.extension }} ${{ matrix.images.group }} ${{ matrix.images.path }}
pmacius marked this conversation as resolved.
Show resolved Hide resolved
working-directory: ${{ github.workspace }}

- name: Build Docker image
uses: docker/build-push-action@a254f8ca60a858f3136a2f1f23a60969f2c402dd # 6.4.0
with:
context: .
tags: ${{ matrix.images.name }}:test
push: false
load: true
file: ${{ github.workspace }}/${{ matrix.images.path }}/Dockerfile

- name: Run Docker image
run: docker run -d -p 8080:8080 ${{ matrix.images.name }}:test

- name: Wait for container
run: sleep 30s

- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
pmacius marked this conversation as resolved.
Show resolved Hide resolved

- name: Save Docker image
run: docker save ${{ matrix.images.name }}:test -o /tmp/${{ matrix.images.name }}.tar
gionn marked this conversation as resolved.
Show resolved Hide resolved

- name: Upload image as a tar for next job
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # 4.3.4
with:
name: images
path: /tmp/${{ matrix.images.name }}.tar

compose:
name: docker-compose
needs: build-run-test
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@2ad185228a349d19414702819e06df9fa4314287 # 3.4.0

- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8
with:
name: images
path: /tmp

- name: Load Docker images
run: |
ls -1 /tmp/*.tar | xargs --no-run-if-empty -L 1 docker load -i
docker image ls -a
gionn marked this conversation as resolved.
Show resolved Hide resolved

- name: Verify docker-compose
uses: Alfresco/alfresco-build-tools/.github/actions/dbp-charts/verify-compose@OPSEXP-2732-compose
pmacius marked this conversation as resolved.
Show resolved Hide resolved
timeout-minutes: 10
with:
compose_pull: false
compose_file_path: docker-compose.yml
quay_username: ${{ secrets.QUAY_USERNAME }}
quay_password: ${{ secrets.QUAY_PASSWORD }}

- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
pmacius marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.zip
dist
*.jar
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
repos:
# General hooks section
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
args: [--allow-multiple-documents]
- id: check-merge-conflict
- id: fix-byte-order-marker
- id: mixed-line-ending
args: ["--fix=lf"]
- id: end-of-file-fixer
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.14.3
hooks:
- id: check-github-workflows
32 changes: 32 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: "2"
services:
activemq:
image: alfresco/alfresco-activemq:5.18-jre17-rockylinux8
mem_limit: 1g
ports:
- "8161:8161" # Web Console
- "5672:5672" # AMQP
- "61616:61616" # OpenWire
- "61613:61613" # STOMP
elasticsearch:
image: elasticsearch:7.10.1
environment:
- xpack.security.enabled=false
- discovery.type=single-node
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
cap_add:
- IPC_LOCK
ports:
- 9200:9200
- 9300:9300
live-indexing-metadata:
image: alfresco-enterprise-search-metadata:test
environment:
SPRING_ELASTICSEARCH_REST_URIS: http://elasticsearch:9200
SPRING_ACTIVEMQ_BROKERURL: nio://activemq:61616
20 changes: 17 additions & 3 deletions scripts/fetch-artifact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ DEFAULT_ARTIFACT_NAME=alfresco-content-services-distribution
ARTIFACT_VERSION=$2
DEFAULT_ARTIFACT_VERSION=23.2.1

GROUP_ID=$3
EXTENSION=$3
DEFAULT_EXTENSION=.zip
pmacius marked this conversation as resolved.
Show resolved Hide resolved

GROUP_ID=$4
DEFAULT_GROUP_ID=org.alfresco

PATH_FOR_ARTIFACT=$5
DEFAULT_PATH_FOR_ARTIFACT=./

if [ -z "$ARTIFACT_NAME" ]; then
ARTIFACT_NAME=$DEFAULT_ARTIFACT_NAME
fi
Expand All @@ -18,13 +24,21 @@ if [ -z "$ARTIFACT_VERSION" ]; then
ARTIFACT_VERSION=$DEFAULT_ARTIFACT_VERSION
fi

if [ -z "$EXTENSION" ]; then
EXTENSION=$DEFAULT_EXTENSION
fi

if [ -z "$GROUP_ID" ]; then
GROUP_ID=$DEFAULT_GROUP_ID
fi

if [ -z "$PATH_FOR_ARTIFACT" ]; then
PATH_FOR_ARTIFACT=$DEFAULT_PATH_FOR_ARTIFACT
fi

GROUP_ID_AS_PATH=$(echo "$GROUP_ID" | tr . /)


echo "Downloading $GROUP_ID:$ARTIFACT_NAME $ARTIFACT_VERSION from Nexus"
wget --user "$NEXUS_USERNAME:$NEXUS_PASSWORD" \
"https://nexus.alfresco.com/nexus/service/local/repositories/enterprise-releases/content/$GROUP_ID_AS_PATH/$ARTIFACT_NAME/${ARTIFACT_VERSION}/$ARTIFACT_NAME-${ARTIFACT_VERSION}.zip"
wget "https://nexus.alfresco.com/nexus/service/local/repositories/enterprise-releases/content/$GROUP_ID_AS_PATH/$ARTIFACT_NAME/${ARTIFACT_VERSION}/$ARTIFACT_NAME-${ARTIFACT_VERSION}${EXTENSION}" \
-O $PATH_FOR_ARTIFACT/$ARTIFACT_NAME-${ARTIFACT_VERSION}${EXTENSION}
18 changes: 18 additions & 0 deletions search/enterprise/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Runtime variables

Sets of variables configurable with your docker image

## metadata

```yaml

live-indexing-metadata:
image: alfresco-enterprise-search-metadata:YOUR-TAG
environment:
SPRING_ELASTICSEARCH_REST_URIS: http://elasticsearch:9200
SPRING_ACTIVEMQ_BROKERURL: nio://activemq:61616

```

- `SPRING_ELASTICSEARCH_REST_URIS` - Elasticsearch server, by default `http://elasticsearch:9200`
- `SPRING_ACTIVEMQ_BROKERURL` - Alfresco ActiveMQ, by default `nio://activemq:61616`
8 changes: 8 additions & 0 deletions search/enterprise/metadata/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM quay.io/alfresco/alfresco-base-java:jre17-rockylinux9 as BUILD

ENV PORT 8080
EXPOSE 8080

ADD search/enterprise/metadata/*-app.jar /opt/app.jar

CMD ["java", "-jar", "/opt/app.jar"]
pmacius marked this conversation as resolved.
Show resolved Hide resolved
Loading