diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index c1a1d218..783991ca 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -224,6 +224,9 @@ jobs: --from-file=.dockerconfigjson=$HOME/.docker/config.json --type=kubernetes.io/dockerconfigjson + - name: Create configmap for acc + run: kubectl create configmap acc-config --from-file=app.config.json=test/configs/acc.json + - name: Checkout acs-deployment sources uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: diff --git a/Makefile b/Makefile index 8efaceee..00a15d30 100644 --- a/Makefile +++ b/Makefile @@ -57,6 +57,10 @@ prepare_share: scripts/fetch-artifacts.sh setenv @echo "Fetching all artifacts for Share targets" @./scripts/fetch-artifacts.sh share +prepare_adf: scripts/fetch-artifacts.sh setenv + @echo "Fetching all artifacts for ADF targets" + @./scripts/fetch-artifacts.sh adf-apps + prepare_all: scripts/fetch-artifacts.sh setenv @echo "Fetching all artifacts" @./scripts/fetch-artifacts.sh @@ -85,6 +89,10 @@ share: prepare_share @echo "Building Share images" docker buildx bake ${DOCKER_BAKE_ARGS} share +adf_apps: prepare_adf + @echo "Building ADF Apps images" + docker buildx bake ${DOCKER_BAKE_ARGS} adf_apps + all: docker-bake.hcl prepare_all @echo "Building all images" docker buildx bake ${DOCKER_BAKE_ARGS} diff --git a/adf-apps/acc/Dockerfile b/adf-apps/acc/Dockerfile new file mode 100644 index 00000000..0cdb8b0c --- /dev/null +++ b/adf-apps/acc/Dockerfile @@ -0,0 +1,24 @@ +FROM busybox AS unpack +WORKDIR /unpack +COPY ./*zip / +RUN unzip /*zip && rm /*zip + +FROM nginxinc/nginx-unprivileged:alpine3.20 + +ARG CONFIG_PATH=/etc/nginx/conf.d + +USER root +RUN apk update && apk upgrade +COPY default.conf.template /etc/nginx/templates/ + +COPY --from=unpack /unpack/ /usr/share/nginx/html/ + +RUN chown -R 101:101 ${CONFIG_PATH} + +USER 101 + +# Nginx default settings +# ------------------------------- +ENV SERVER_PORT=8080 +ENV BASE_PATH=/ +ENV NGINX_ENVSUBST_OUTPUT_DIR=${CONFIG_PATH} diff --git a/adf-apps/acc/README.md b/adf-apps/acc/README.md new file mode 100644 index 00000000..61caf517 --- /dev/null +++ b/adf-apps/acc/README.md @@ -0,0 +1,81 @@ +# Alfresco control center image + +## Description + +This Docker file is used to build an Alfresco control center. + +## Building the image + +Make sure all required artifacts are present in the build context `adf-apps/acc/`. +You can put them manually in the `adf-apps/acc/` folder (for example if that's a +custom module of yours), or use the script `./scripts/fetch-artifacts.sh` to +download them from Alfresco's Nexus. + +Then, you can build the image from the root of this git repository with the +following command: + +```bash +docker buildx bake acc +``` + +## Running the image + +:warning: `BASE_PATH` should still be provided as a env or directly changed +inside `default.conf.template` + +To run the image it is recommended to review and provide the json config file. +Example configuration of that file is stored on this repository: `test/configs/acc.json`. + +:warning: It is recommended to get your own config file because it may differ +from the one stored on this repo. To get the config file either extract it from +the artifact zip or copy it from the running image with: + +```sh +docker run --name temp-container -d localhost/alfresco/alfresco-control-center:latest && \ +docker cp temp-container:/usr/share/nginx/html/app.config.json ./acc.config.json && \ +docker stop temp-container && \ +docker rm temp-container +``` + +There is few approaches you can use to provide a config +file e.g. + +### Providing app.config.json at run time using docker compose + +1. Point config file to specific path on container: + +```yaml +volumes: +- ./acc.config.json:/usr/share/nginx/html/app.config.json +``` + +### Providing app.config.json at run time using helm + +1. Change the `acc.config.json` according to needs +2. Create configmap from it, in the same namespace where acs is being deployed + +```sh +kubectl create configmap acc-config --from-file=app.config.json=acc.config.json +``` + +3. Mount created configmap to the acc deployment: + +```yaml +alfresco-control-center: + image: + repository: localhost/alfresco/alfresco-control-center + tag: latest + env: + BASE_PATH: / + volumeMounts: + - name: app-config + mountPath: /usr/share/nginx/html/app.config.json + subPath: app.config.json + volumes: + - name: app-config + configMap: + name: acc-config + items: + - key: app.config.json + path: app.config.json +``` diff --git a/adf-apps/acc/artifacts.json b/adf-apps/acc/artifacts.json new file mode 100644 index 00000000..4df6cb0a --- /dev/null +++ b/adf-apps/acc/artifacts.json @@ -0,0 +1,14 @@ +{ + "artifacts": { + "acs23": [ + { + "name": "alfresco-control-center", + "version": "9.1.0", + "path": "adf-apps/acc", + "classifier": ".zip", + "group": "org.alfresco", + "repository": "releases" + } + ] + } +} diff --git a/adf-apps/acc/default.conf.template b/adf-apps/acc/default.conf.template new file mode 100644 index 00000000..9b126b6e --- /dev/null +++ b/adf-apps/acc/default.conf.template @@ -0,0 +1,26 @@ +server { + listen ${SERVER_PORT}; + server_name localhost; + + root /usr/share/nginx/html; + + rewrite ^([^.]*[^/])$ $1/ permanent; + absolute_redirect off; + + location ${BASE_PATH} { + set $EVAL_BASE_PATH "${BASE_PATH}"; + if ($EVAL_BASE_PATH = "/") { + root /usr/share/nginx/html; + } + index index.html index.htm; + alias /usr/share/nginx/html; + } + + server_tokens off; + + error_page 500 502 503 504 /50x.html; + + location = /50x.html { + root /usr/share/nginx/html; + } +} diff --git a/docker-bake.hcl b/docker-bake.hcl index fed601dc..c1222037 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -1,9 +1,9 @@ group "default" { - targets = ["content_service", "enterprise-search", "ats", "tengines", "connectors", "search_service"] + targets = ["content_service", "enterprise-search", "ats", "tengines", "connectors", "search_service", "adf_apps"] } group "community" { - targets = ["repository_community", "share", "search_service", "tengine_aio"] + targets = ["repository_community", "share", "search_service", "tengine_aio", "acc"] } group "content_service" { @@ -26,6 +26,10 @@ group "connectors" { targets = ["connector_msteams", "connector_ms365"] } +group "adf_apps" { + targets = ["acc"] +} + variable "REGISTRY" { default = "localhost" } @@ -700,3 +704,16 @@ target "search_service" { output = ["type=docker"] platforms = split(",", "${TARGETARCH}") } + +target "acc" { + context = "./adf-apps/acc" + dockerfile = "Dockerfile" + labels = { + "org.label-schema.name" = "${PRODUCT_LINE} Control Center" + "org.opencontainers.image.title" = "${PRODUCT_LINE} Control Center" + "org.opencontainers.image.description" = "Alfresco Control Center" + } + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-control-center:${TAG}"] + output = ["type=docker"] + platforms = split(",", "${TARGETARCH}") +} diff --git a/test/community-docker-compose.yml b/test/community-docker-compose.yml index bbb6d4e6..72682822 100644 --- a/test/community-docker-compose.yml +++ b/test/community-docker-compose.yml @@ -118,12 +118,12 @@ services: - "traefik.http.routers.aca.middlewares=acachain@docker" control-center: - image: quay.io/alfresco/alfresco-control-center:9.0.0 + image: ${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-control-center:${TAG} mem_limit: 128m environment: - APP_CONFIG_PROVIDER: "ECM" - APP_CONFIG_AUTH_TYPE: "BASIC" - BASE_PATH: ./ + BASE_PATH: / + volumes: + - ./configs/acc.json:/usr/share/nginx/html/app.config.json labels: - "traefik.enable=true" - "traefik.http.routers.acc.rule=PathPrefix(`/admin`)" diff --git a/test/configs/acc.json b/test/configs/acc.json new file mode 100644 index 00000000..dde03dcd --- /dev/null +++ b/test/configs/acc.json @@ -0,0 +1,100 @@ +{ + "$schema": "../../../node_modules/@alfresco/adf-core/app.config.schema.json", + "providers": "ECM", + "ecmHost": "{protocol}//{hostname}{:port}", + "bpmHost": "{protocol}//{hostname}{:port}", + "authType": "BASIC", + "identityHost": "{protocol}//{hostname}{:port}/auth/admin/realms/alfresco", + "oauth2": { + "host": "{protocol}//{hostname}{:port}/auth/realms/alfresco", + "clientId": "alfresco", + "scope": "openid profile email", + "implicitFlow": true, + "codeFlow": false, + "silentLogin": true, + "publicUrls": [], + "redirectSilentIframeUri": "{protocol}//{hostname}{:port}/assets/silent-refresh.html", + "redirectUri": "", + "audience": "", + "redirectUriLogout": "/", + "skipIssuerCheck": true, + "strictDiscoveryDocumentValidation": false + }, + "application": { + "name": "Alfresco Admin App", + "copyright": "© 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved." + }, + "plugins":{ + "tagsEnabled": true, + "categoriesEnabled": true + }, + "logLevel": "trace", + "locale": "en", + "pagination": { + "size": 50, + "supportedPageSizes": [25, 50, 100] + }, + "export": { + "helm": true + }, + "alfresco-dependencies": [ + "rb", + "query" + ], + "content-identity": { + "presets": { + "default": [ + { + "key": "id", + "type": "text", + "title": "CONTENT_IDENTITY_USERS.USER_LIST.PROPERTIES.ID", + "sortable": true, + "draggable": true + }, + { + "key": "firstName", + "type": "text", + "title": "CONTENT_IDENTITY_USERS.USER_LIST.PROPERTIES.FIRST_NAME", + "sortable": true, + "draggable": true + }, + { + "key": "lastName", + "type": "text", + "title": "CONTENT_IDENTITY_USERS.USER_LIST.PROPERTIES.LAST_NAME", + "sortable": true, + "draggable": true + }, + { + "key": "email", + "type": "text", + "title": "CONTENT_IDENTITY_USERS.USER_LIST.PROPERTIES.EMAIL", + "sortable": false, + "draggable": true + }, + { + "key": "status", + "type": "text", + "title": "CONTENT_IDENTITY_USERS.USER_LIST.PROPERTIES.STATUS", + "sortable": false, + "draggable": true + } + ] + }, + "group-list-presets": { + "default": [ + { + "key": "displayName", + "type": "text", + "title": "CONTENT_IDENTITY_GROUPS.GROUP_LIST.PROPERTIES.DISPLAY_NAME", + "sortable": false + } + ] + } + }, + "security-controls": { + "presets": { + "default": [] + } + } +} diff --git a/test/enterprise-docker-compose.yml b/test/enterprise-docker-compose.yml index d79be879..59ab50f1 100644 --- a/test/enterprise-docker-compose.yml +++ b/test/enterprise-docker-compose.yml @@ -142,12 +142,12 @@ services: APP_CONFIG_PLUGIN_MICROSOFT_ONLINE: "false" APP_BASE_SHARE_URL: "http://localhost:8080/workspace/#/preview/s" control-center: - image: quay.io/alfresco/alfresco-control-center:8.4.1 + image: ${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-control-center:${TAG} mem_limit: 128m environment: - APP_CONFIG_PROVIDER: "ECM" - APP_CONFIG_AUTH_TYPE: "BASIC" - BASE_PATH: ./ + BASE_PATH: / + volumes: + - ./configs/acc.json:/usr/share/nginx/html/app.config.json proxy: image: alfresco/alfresco-acs-nginx:3.4.2 mem_limit: 128m diff --git a/test/helm/test-overrides.yaml b/test/helm/test-overrides.yaml index b3d8695e..ef88bf51 100644 --- a/test/helm/test-overrides.yaml +++ b/test/helm/test-overrides.yaml @@ -61,6 +61,21 @@ alfresco-transform-service: tag: latest alfresco-sync-service: enabled: false ## disable till release of 5.0.1 +alfresco-control-center: + image: + repository: localhost/alfresco/alfresco-control-center + tag: latest + volumeMounts: + - name: app-config + mountPath: /usr/share/nginx/html/app.config.json + subPath: app.config.json + volumes: + - name: app-config + configMap: + name: acc-config + items: + - key: app.config.json + path: app.config.json dtas: additionalArgs: - --tb=short