# redpill-linpro/alfresco-s3-adapter architecture

> Architecture diagram of the GitHub repository redpill-linpro/alfresco-s3-adapter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/redpill-linpro/alfresco-s3-adapter
- Repository: https://github.com/redpill-linpro/alfresco-s3-adapter

## Overview

##### Project type and purpose
- This is a full-stack, All-In-One (AIO) Docker-based Alfresco environment with a custom S3 content store adapter.
- It orchestrates multiple services (Alfresco Content Service, Share, Search Service, PostgreSQL) plus the AWS S3 backend for binary storage.

##### File structure
- Top-level modules (Maven artifacts):
- alfresco-s3-adapter-platform: The ACS extension jar, contains S3ContentStore, reader/writer, Spring contexts.
- alfresco-s3-adapter-share: The Share UI extension jar (web fragments).
- alfresco-s3-adapter-platform-docker & alfresco-s3-adapter-share-docker: Dockerfile + config for custom ACS and Share images.
- alfresco-s3-adapter-testdeps: Additional AMP dependencies.
- integration-tests: IT suite that exercises the running system.
- docker/docker-compose.yml: Orchestrates the containers.
- run.sh / run.bat: High-level script to build modules, build Docker images, start/stop the environment, run ITs.

##### Extracting insights from the README
- The AIO project builds JAR modules (no wars), packages them into custom Docker images, then starts containers for:
- ACS (Alfresco Content Service)
- Share (Alfresco Share UI)
- ASS (Alfresco Search Service)
- PostgreSQL
- The adapter uses AWS Java SDK to read/write content to an S3 bucket.
- Integration tests run against the live Docker environment.

##### Main components
a. Developer workstation
– Git repo + run.sh script → triggers Maven build and docker-compose
b. Docker Host (or Kubernetes) running containers:
1. Alfresco Content Service (custom image)
- Contains the platform jar (S3ContentStore beans, context XMLs)
- Connects to Postgres for metadata
- Connects to AWS S3 for content
- Connects to ASS for indexing
2. Alfresco Share (custom image)
- Contains the Share extension jar (UI web fragments)
- Talks to ACS via REST APIs
3. Alfresco Search Service
- Indexes content & metadata via Solr cores
4. PostgreSQL
- Stores Alfresco node and properties data
c. External AWS S3
- The actual storage backend for binaries
d. Integration-tests module (runs from developer machine or CI)
- Uses TestContainers or direct TCP to test ACS + Share + S3 behavior

##### Relationships and data flows
- User → Share UI (HTTP) → Share container
- Share → ACS (HTTP/Alfresco public API)
- ACS → Postgres (JDBC) for metadata
- ACS → S3 (AWS SDK calls over HTTPS) for binaries
- ACS → ASS (REST/Solr) for indexing
- Integration tests → Docker network → endpoints of ACS & Share & S3-mock

##### Architectural patterns & technologies
- Micro-services in containers behind Docker Compose
- Modular JARs deployed via Docker images (no WARs)
- Spring bean configuration via XML (S3 contexts, module contexts)
- Assembly of AMPs via Maven assembly plugin (but packaging into jars)
- Use of AWS SDK 1.x, Alfresco SDK 3.0/4.0, Docker volumes for persistence
- Optional hot-reloading with JRebel in dev images

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer machine and orchestration
    Dev["Developer Workstation\n(run.sh, top-level pom.xml)"]:::process
    Dev -->|"build & deploy via run.sh"| Compose["docker-compose.yml"]:::process
    click Compose "https://github.com/redpill-linpro/alfresco-s3-adapter/blob/master/docker/docker-compose.yml"

    %% Docker host and containers
    subgraph "Docker Host"
        subgraph "Containers"
            ACS["ACS Container\n(custom image)"]:::container
            Share["Share Container\n(custom image)"]:::container
            ASS["Alfresco Search Service"]:::container
            Postgres["PostgreSQL Database"]:::database
        end
    end

    click ACS "https://github.com/redpill-linpro/alfresco-s3-adapter/tree/master/alfresco-s3-adapter-platform-docker/src/main/docker/Dockerfile"
    click Share "https://github.com/redpill-linpro/alfresco-s3-adapter/tree/master/alfresco-s3-adapter-share-docker/src/main/docker/Dockerfile"

    %% External dependencies and test runner
    S3["AWS S3 Backend"]:::external
    click S3 "https://github.com/redpill-linpro/alfresco-s3-adapter/blob/master/alfresco-s3-adapter-platform/src/main/java/org/redpill/alfresco/s3/S3ContentStore.java"

    IT["Integration Tests"]:::process
    click IT "https://github.com/redpill-linpro/alfresco-s3-adapter/tree/master/integration-tests/src/test/java/org/redpill/alfresco/s3"

    %% Compose starts containers
    Compose --> ACS
    Compose --> Share
    Compose --> ASS
    Compose --> Postgres

    %% Data flows
    Share -->|"HTTP/API"| ACS
    ACS -->|"JDBC"| Postgres
    ACS -->|"REST/Solr"| ASS
    ACS -->|"AWS SDK"| S3
    IT -->|"test traffic"| ACS
    IT -->|"test traffic"| Share

    %% ACS internal modules
    subgraph "ACS Module Components"
        ACSModule["S3 Adapter Platform Module"]:::process
        ACSConfig["s3-context.xml"]:::process
        ACSProps["alfresco-global.properties"]:::process
    end

    ACS --> ACSModule
    ACSModule --> ACSConfig
    ACSConfig --> ACSProps

    click ACSModule "https://github.com/redpill-linpro/alfresco-s3-adapter/tree/master/alfresco-s3-adapter-platform/src/main/java/org/redpill/alfresco/s3"
    click ACSConfig "https://github.com/redpill-linpro/alfresco-s3-adapter/blob/master/alfresco-s3-adapter-platform/src/main/resources/alfresco/module/alfresco-s3-adapter-platform/context/s3-context.xml"
    click ACSProps "https://github.com/redpill-linpro/alfresco-s3-adapter/blob/master/alfresco-s3-adapter-platform/src/main/resources/alfresco/module/alfresco-s3-adapter-platform/alfresco-global.properties"

    %% Share internal modules
    subgraph "Share Module Components"
        ShareModule["S3 Adapter Share Module\n(amp.xml)"]:::process
        ShareConfig["share-config-custom.xml"]:::process
        ShareWebExt["web-extension context"]:::process
    end

    Share --> ShareModule
    ShareModule --> ShareConfig
    ShareConfig --> ShareWebExt

    click ShareModule "https://github.com/redpill-linpro/alfresco-s3-adapter/blob/master/alfresco-s3-adapter-share/src/main/assembly/amp.xml"
    click ShareConfig "https://github.com/redpill-linpro/alfresco-s3-adapter/blob/master/alfresco-s3-adapter-share/src/main/resources/META-INF/share-config-custom.xml"
    click ShareWebExt "https://github.com/redpill-linpro/alfresco-s3-adapter/blob/master/alfresco-s3-adapter-share/src/main/resources/alfresco/web-extension/alfresco-s3-adapter-share-jar-slingshot-application-context.xml"

    %% Test dependencies module
    TestDeps["Test Dependencies AMP\n(amp.xml)"]:::process
    click TestDeps "https://github.com/redpill-linpro/alfresco-s3-adapter/blob/master/alfresco-s3-adapter-testdeps/src/main/assembly/amp.xml"
    Dev --> TestDeps

    %% Styles
    classDef container fill:#add8e6,stroke:#333,stroke-width:1px
    classDef database fill:#90ee90,stroke:#333,stroke-width:1px
    classDef external fill:#ffe4b5,stroke:#333,stroke-width:1px
    classDef process fill:#f0e68c,stroke:#333,stroke-width:1px
```
