Skip to content

Commit

Permalink
Docker/Podman switch
Browse files Browse the repository at this point in the history
  • Loading branch information
krystian-panek-vmltech committed Nov 18, 2024
1 parent 171f3f8 commit 8f70bc3
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
16 changes: 8 additions & 8 deletions pkg/project/app_classic/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,12 @@ tasks:
# dereference symbolic links causing problems on Windows
- rm -fr home/src && mkdir -p home && cp -rL src home/src
# enforce typical architecture to avoid problems on M1/ARM Mac
- docker build --platform linux/amd64 -t acme/aem-ams/dispatcher-publish .
- '{{.DOCKER_COMMAND}} build --platform linux/amd64 -t acme/aem-ams/dispatcher-publish .'

dispatcher:test:
desc: test AEM dispatcher image
dir: dispatcher
cmd: docker run --rm -it --entrypoint bash acme/aem-ams/dispatcher-publish:latest
cmd: '{{.DOCKER_COMMAND}} run --rm -it --entrypoint bash acme/aem-ams/dispatcher-publish:latest'

dispatcher:start:
desc: start AEM dispatcher using custom image
Expand All @@ -256,13 +256,13 @@ tasks:
dir: dispatcher
cmds:
- mkdir -p home/docker/httpd/logs home/docker/httpd/cache/author home/docker/httpd/cache/publish
- docker compose up -d
- '{{.DOCKER_COMPOSE_COMMAND}} up -d'

dispatcher:stop:
desc: stop AEM dispatcher
aliases: [ dispatcher:down ]
dir: dispatcher
cmd: docker compose down
cmd: '{{.DOCKER_COMPOSE_COMMAND}} down'

dispatcher:restart:
desc: restart AEM dispatcher
Expand All @@ -274,19 +274,19 @@ tasks:
desc: check status of AEM dispatcher
dir: dispatcher
cmds:
- docker compose ps
- docker compose logs --tail 20
- '{{.DOCKER_COMPOSE_COMMAND}} ps'
- '{{.DOCKER_COMPOSE_COMMAND}} logs --tail 20'

dispatcher:login:
desc: login to AEM dispatcher shell
cmd: docker exec -it dispatcher bash
cmd: '{{.DOCKER_COMMAND}} exec -it dispatcher bash'
ignore_error: true

dispatcher:destroy:
desc: destroy AEM dispatcher
dir: dispatcher
cmds:
- docker compose rm -fsv
- '{{.DOCKER_COMPOSE_COMMAND}} down -v --remove-orphans'
- rm -fr target/docker target/src

dispatcher:hosts:
Expand Down
5 changes: 5 additions & 0 deletions pkg/project/app_classic/local.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ AEM_DISPATCHER_IP=127.0.0.1
AEM_DISPATCHER_HTTP_URL=http://${AEM_DISPATCHER_IP}
AEM_DISPATCHER_DOMAIN=publish.aem.local
AEM_DISPATCHER_DOMAINS=${AEM_DISPATCHER_DOMAIN} author.aem.local

# Docker/Podman switch

DOCKER_COMMAND=podman
DOCKER_COMPOSE_COMMAND=podman-compose
17 changes: 9 additions & 8 deletions pkg/project/app_cloud/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,19 +235,20 @@ tasks:
aliases: [ dispatcher:up ]
dir: dispatcher
cmds:
- 'command -v docker || { echo "Docker is not installed! Visit: https://www.docker.com/products/docker-desktop"; exit 1; }'
- 'command -v {{.DOCKER_COMMAND}} || { echo "Docker or Podman is not installed!"; exit 1; }'
- 'test -d ../aem/home/opt/sdk/dispatcher || { echo "Dispatcher SDK is not available. Try providing AEM SDK ZIP instead of JAR to directory: aem/home/lib"; exit 1; }'
- test -d home/sdk || (rm -fr home/sdk && mkdir -p home && cp -r ../aem/home/opt/sdk/dispatcher home/sdk)
# - sh home/sdk/bin/validate.sh src > ../aem/home/var/log/dispatcher-validate.log
- docker tag "$(docker load --input "home/sdk/lib/dispatcher-publish-{{ARCH}}.tar.gz" | tail -n 1 | awk -v 'FS= ' '{print $3}')" "adobe/aem-ethos/dispatcher-publish:latest"
# TODO fix syntax of below / while testing
- '{{.DOCKER_COMMAND}} tag "$({{.DOCKER_COMMAND}} load --input "home/sdk/lib/dispatcher-publish-{{ARCH}}.tar.gz" | tail -n 1 | awk -v 'FS= ' '{print $3}')" "adobe/aem-ethos/dispatcher-publish:latest"'
- mkdir -p home/sdk/logs home/sdk/cache
- docker compose up -d
- '{{.DOCKER_COMPOSE_COMMAND}} up -d'

dispatcher:stop:
desc: stop AEM dispatcher
aliases: [ dispatcher:down ]
dir: dispatcher
cmd: docker compose down
cmd: '{{.DOCKER_COMPOSE_COMMAND}} down'

dispatcher:restart:
desc: restart AEM dispatcher
Expand All @@ -259,19 +260,19 @@ tasks:
desc: check status of AEM dispatcher
dir: dispatcher
cmds:
- docker compose ps
- docker compose logs --tail 20
- '{{.DOCKER_COMPOSE_COMMAND}} ps'
- '{{.DOCKER_COMPOSE_COMMAND}} logs --tail 20'

dispatcher:login:
desc: login to AEM dispatcher shell
cmd: docker exec -it dispatcher bash
cmd: '{{.DOCKER_COMMAND}} exec -it dispatcher bash'
ignore_error: true

dispatcher:destroy:
desc: destroy AEM dispatcher
dir: dispatcher
cmds:
- docker compose rm -fsv
- '{{.DOCKER_COMPOSE_COMMAND}} down -v --remove-orphans'
- rm -fr home

dispatcher:hosts:
Expand Down
5 changes: 5 additions & 0 deletions pkg/project/app_cloud/local.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ AEM_DISPATCHER_IP=127.0.0.1
AEM_DISPATCHER_HTTP_URL=http://${AEM_DISPATCHER_IP}
AEM_DISPATCHER_DOMAIN=publish
AEM_DISPATCHER_DOMAINS=${AEM_DISPATCHER_DOMAIN}

# Docker/Podman switch

DOCKER_COMMAND=podman
DOCKER_COMPOSE_COMMAND=podman-compose

0 comments on commit 8f70bc3

Please sign in to comment.