Skip to content

Latest commit

 

History

History
142 lines (94 loc) · 4.48 KB

File metadata and controls

142 lines (94 loc) · 4.48 KB

AEM Compose Logo WTT Logo

Apache License, Version 2.0, January 2004

AEM Compose

Universal tool to manage AEM instances everywhere!

Developer setup

Prerequisites

  1. Install Go: https://go.dev/doc/install,

  2. Set up shell, append lines ~/.zshrc with content below then restart IDE/terminals,

    export GOPATH="$HOME/go"
    export PATH="$GOPATH/bin:$PATH"
  3. Setup IDE:

    • IntelliJ IDEA
      • Install Go Plugin
      • Remember to "Enable Go Modules" in settings to fix syntax highlighting and autocompletion.

Building & OS-wide installation

Ensure having installed Go then:

Manual installation (recommended)

Use this method to develop comfortably the tool.

  1. Clone repository: git clone git@github.com:wttech/aemc.git
  2. Enter cloned directory and run command: make*

*When using Git Bash on Windows, you will first need to add make to your Git Bash installation:

  1. Go to ezwinports.
  2. Download make-x.x.x-without-guile-w32-bin.zip (get the newest version without guile).
  3. Extract zip.
  4. Copy the contents to your Git\mingw64\ merging the folders, but do NOT overwrite/replace any existing files.

Go installation

Use this method to check particular commit/version of the tool.

  • latest released version: go install github.com/wttech/aemc/cmd/aem@latest,
  • specific released version: go install github.com/wttech/aemc/cmd/aem@v1.1.9,
  • recently committed version: go install github.com/wttech/aemc/cmd/aem@main,

After installing AEM CLI by one of above methods now instruct the wrapper script to use it by running the following command:

export AEM_CLI_VERSION=installed

To start using again version defined in wrapper file, simply unset the environment variable:

unset AEM_CLI_VERSION

Releasing

Simply run script:

sh release.sh <major.minor.patch>

It will:

  • bump version is source files automatically,
  • commit changes,
  • push release tag that will initiate release workflow.

Coding Conventions

File Naming

Pattern Purpose Example
local_*.go Local instance-specific functionality local_instance.go, local_instance_manager.go
*_manager.go Manager classes handling collections/operations package_manager.go, osgi_bundle_manager.go
*_test.go Unit tests instance_test.go
*_int_test.go Integration tests (require running AEM) osgi_int_test.go

Architectural Patterns

Manager Hierarchy

Three types of managers exist:

  1. AEM-level - owned by AEM facade, operate globally (VendorManager, ContentManager)
  2. Instance-level - owned by Instance, operate via HTTP (PackageManager, OSGiBundleManager)
  3. Sub-entity - owned by facade types (OSGi owns BundleManager, ConfigManager, etc.)

Entity + EntityState

Domain entities have paired *State structs for serialization:

type OSGiBundle struct { manager *OSGiBundleManager; symbolicName string }
type OSGiBundleState struct { SymbolicName string `yaml:"symbolic_name"` }

WithChanged Pattern

Methods returning (bool, error) indicate if change was made (for idempotent operations):

func (b OSGiBundle) Start() error { ... }           // Always attempts
func (b OSGiBundle) StartWithChanged() (bool, error) // Returns false if already started

Facade Pattern

OSGi, Sling, Repo, Auth group related managers:

type OSGi struct {
    bundleManager    *OSGiBundleManager
    componentManager *OSGiComponentManager
    configManager    *OSGiConfigManager
}

Utility Packages

Packages in pkg/common/ use *x suffix for extended stdlib functionality:

pathx, fmtx, httpx, stringsx, timex, osx, filex, cryptox, execx, tplx, netx

Sub-packages

pkg/{domain}/ contains pure data types without AEM dependencies:

  • pkg/osgi/ - OSGi data structures
  • pkg/instance/ - Instance constants and utilities
  • pkg/content/ - Content manipulation
  • pkg/keystore/ - Keystore types