Skip to content

Commit

Permalink
Add Docker Compose sample file and instructions (#21)
Browse files Browse the repository at this point in the history
* Added Docker Compose files

* #20 Adding notes to readme file for Docker Compose

* #20 added folder placeholders and improved documentation.
  • Loading branch information
teropikala authored Apr 26, 2023
1 parent 781ef9b commit bb0cd4c
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,22 @@ docker run -p 80:8080 -p 443:8443 -itd --rm --env-file scripts/env.sh --name dis
| --env-file | Environment file to bind to the container |
| --name dispatcher | assign name "dispatcher" to the container, consider setting a different name per project. |

### Using Docker Compose

Provided `docker-compose.yaml` can be modified to suit your needs. In a typical scenario you would incorporate it to your
own Docker Compose configuration.

You can start dispatcher with Docker Compose using script `dispatcher-docker-compose`

Following folders are mounted from the host os to make it easier to inspect cached files and monitor log files.

| Folder | |
| -------------------- | ------------------------------------------------------------ |
| mnt/author_docroot | Author cached files |
| mnt/publish_docroot | Publish cached files |
| mnt/log | Dispatcher logs |


## Checking the container's current state

```shell
Expand Down
53 changes: 53 additions & 0 deletions dispatcher-docker-compose
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/sh

VERSION="ams/2.6"
PATH_TO_CONF="etc/httpd"

if [ ! -d $(pwd)/$VERSION/$PATH_TO_CONF/conf ]; then
echo "**** ERROR ****"
echo "This script is supposed to be run in the root directory of the dispatcher project, "
echo "though we could not find a directory ./$VERSION/$PATH_TO_CONF/conf conf from the current directory."
echo "Please change to the projects main directory and try again."
echo ""
exit 1
fi

echo ""
echo "Starting dispatcher, mounting local configuration from ./$VERSION/$PATH_TO_CONF ..."
echo " Open your browser at http://publish.docker.local/content/we-retail/us/en.html "
echo " **** Press Ctrl-C to stop **** "
echo ""

# copy sample we-retail files
cp sample/weretail.vhost $VERSION/etc/httpd/conf.d/available_vhosts
cp sample/weretail_publish_farm.any $VERSION/etc/httpd/conf.dispatcher.d/available_farms/100_weretail_publish_farm.any
cp sample/weretail_filters.any $VERSION/etc/httpd/conf.dispatcher.d/filters

# create and link up default enabled vhosts
if [ ! -d $VERSION/etc/httpd/conf.d/enabled_vhosts ]; then
mkdir $VERSION/etc/httpd/conf.d/enabled_vhosts
fi

ln -Fs ../available_vhosts/aem_author.vhost $VERSION/etc/httpd/conf.d/enabled_vhosts/aem_author.vhost
ln -Fs ../available_vhosts/aem_flush_author.vhost $VERSION/etc/httpd/conf.d/enabled_vhosts/aem_flush_author.vhost
ln -Fs ../available_vhosts/aem_publish.vhost $VERSION/etc/httpd/conf.d/enabled_vhosts/aem_publish.vhost
ln -Fs ../available_vhosts/aem_flush.vhost $VERSION/etc/httpd/conf.d/enabled_vhosts/aem_flush.vhost
ln -Fs ../available_vhosts/aem_health.vhost $VERSION/etc/httpd/conf.d/enabled_vhosts/aem_health.vhost
ln -Fs ../available_vhosts/weretail.vhost $VERSION/etc/httpd/conf.d/enabled_vhosts/weretail.vhost

# create and link up default enabled farms
if [ ! -d $VERSION/etc/httpd/conf.dispatcher.d/enabled_farms ]; then
mkdir $VERSION/etc/httpd/conf.dispatcher.d/enabled_farms
fi
ln -Fs ../available_farms/000_ams_catchall_farm.any $VERSION/etc/httpd/conf.dispatcher.d/enabled_farms/000_ams_catchall_farm.any
ln -Fs ../available_farms/001_ams_author_flush_farm.any $VERSION/etc/httpd/conf.dispatcher.d/enabled_farms/001_ams_author_flush_farm.any
ln -Fs ../available_farms/001_ams_publish_flush_farm.any $VERSION/etc/httpd/conf.dispatcher.d/enabled_farms/001_ams_publish_flush_farm.any
ln -Fs ../available_farms/002_ams_author_farm.any $VERSION/etc/httpd/conf.dispatcher.d/enabled_farms/002_ams_author_farm.any
ln -Fs ../available_farms/002_ams_publish_farm.any $VERSION/etc/httpd/conf.dispatcher.d/enabled_farms/002_ams_publish_farm.any

# set up sample configs
ln -Fs ../available_farms/100_weretail_publish_farm.any $VERSION/etc/httpd/conf.dispatcher.d/enabled_farms/100_weretail_publish_farm.any

# start dispatcher with docker-compose
docker-compose up -d

44 changes: 44 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: "3.7"
services:

dispatcher:
image: dispatcher
container_name: dispatcher
environment:
- DISP_ID=docker
## Replace value with the Author IP and Port you are using:
- AUTHOR_IP=host.docker.internal
- AUTHOR_PORT=4502
- AUTHOR_DEFAULT_HOSTNAME=author.docker.local
- AUTHOR_DOCROOT=/mnt/var/www/author
## Replace value with the Publisher IP and Port you are using:
- PUBLISH_IP=host.docker.internal
- PUBLISH_PORT=4503
- PUBLISH_DEFAULT_HOSTNAME=publish.docker.local
- PUBLISH_DOCROOT=/mnt/var/www/html
## Replace value with the LiveCycle IP and Port you are using:
- LIVECYCLE_IP=127.0.0.1
- LIVECYCLE_PORT=8080
- LIVECYCLE_DEFAULT_HOSTNAME=aemforms-exampleco-dev.adobecqms.net
- LIVECYCLE_DOCROOT=/mnt/var/www/lc
- PUBLISH_FORCE_SSL=0
- AUTHOR_FORCE_SSL=0
## Enable / Disable CRXDE access. Production this should be disabled
- CRX_FILTER=deny
## Allow dispatcher flush from any IP
- DISPATCHER_FLUSH_FROM_ANYWHERE=allow

volumes:
- ./ams/2.6/etc/httpd/conf:/etc/httpd/conf:ro
- ./ams/2.6/etc/httpd/conf.d:/etc/httpd/conf.d:ro
- ./ams/2.6/etc/httpd/conf.dispatcher.d:/etc/httpd/conf.dispatcher.d:ro
- ./ams/2.6/etc/httpd/conf.modules.d:/etc/httpd/conf.modules.d:ro
- ./mnt/author_docroot:/var/www/author:rw
- ./mnt/publish_docroot:/var/www/html:rw
- ./mnt/log:/var/log/httpd:rw
tmpfs:
- /tmp
ports:
- 80:8080
- 443:8443

1 change: 1 addition & 0 deletions mnt/author_docroot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Folder for Author cache
1 change: 1 addition & 0 deletions mnt/log/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Folder for Dispatcher logs
1 change: 1 addition & 0 deletions mnt/publish_docroot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Folder for Publisher cache

0 comments on commit bb0cd4c

Please sign in to comment.