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-2868 Add acc app Dockerfile #59

Merged
merged 29 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
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
3 changes: 3 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down
24 changes: 24 additions & 0 deletions adf-apps/acc/Dockerfile
Original file line number Diff line number Diff line change
@@ -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}
81 changes: 81 additions & 0 deletions adf-apps/acc/README.md
Original file line number Diff line number Diff line change
@@ -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: ./
pmacius marked this conversation as resolved.
Show resolved Hide resolved
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
```
14 changes: 14 additions & 0 deletions adf-apps/acc/artifacts.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
}
26 changes: 26 additions & 0 deletions adf-apps/acc/default.conf.template
Original file line number Diff line number Diff line change
@@ -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;
}
}
21 changes: 19 additions & 2 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -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"]
pmacius marked this conversation as resolved.
Show resolved Hide resolved
}

group "community" {
targets = ["repository_community", "share", "search_service", "tengine_aio"]
targets = ["repository_community", "share", "search_service", "tengine_aio", "acc"]
}

group "content_service" {
Expand All @@ -26,6 +26,10 @@ group "connectors" {
targets = ["connector_msteams", "connector_ms365"]
}

group "adf_apps" {
targets = ["acc"]
}

variable "REGISTRY" {
default = "localhost"
}
Expand Down Expand Up @@ -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"
pmacius marked this conversation as resolved.
Show resolved Hide resolved
"org.opencontainers.image.description" = "Alfresco Control Center"
}
tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-control-center:${TAG}"]
output = ["type=docker"]
platforms = split(",", "${TARGETARCH}")
}
8 changes: 4 additions & 4 deletions test/community-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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`)"
Expand Down
100 changes: 100 additions & 0 deletions test/configs/acc.json
Original file line number Diff line number Diff line change
@@ -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": []
}
}
}
8 changes: 4 additions & 4 deletions test/enterprise-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions test/helm/test-overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading