This is an automated email from the ASF dual-hosted git repository.
dklco pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git
The following commit(s) were added to refs/heads/master by this push:
new b2d70f6 Updated docker configuration to use docker-compose rather
than the single image
b2d70f6 is described below
commit b2d70f634d565fb0b641b00b10cf757db2ab72ab
Author: Dan Klco <[email protected]>
AuthorDate: Sun Feb 2 13:00:39 2020 -0500
Updated docker configuration to use docker-compose rather than the single
image
---
docker/README.md | 29 +++++++++++++++
docker/{cache_disk.conf => cms/Dockerfile} | 22 +++++++++---
docker/docker-compose.yml | 10 ++++++
docker/site.conf | 58 ------------------------------
docker/{ => webcache}/Dockerfile | 24 ++++---------
docker/{ => webcache}/cms.conf | 6 ++--
docker/webcache/site.conf | 58 ++++++++++++++++++++++++++++++
7 files changed, 125 insertions(+), 82 deletions(-)
diff --git a/docker/README.md b/docker/README.md
new file mode 100644
index 0000000..33de3ea
--- /dev/null
+++ b/docker/README.md
@@ -0,0 +1,29 @@
+# Apache Sling CMS Docker Support
+
+This is a sample Docker Compose configuration for using Apache Sling CMS in a
containerized environment.
+
+It will start a container with the Apache Sling CMS and a webcache container
pre-configured to proxy and cache two URLs.
+
+## Dependencies
+
+This requires:
+
+- [Docker](https://docs.docker.com/install/)
+- [Docker Compose](https://docs.docker.com/compose/install/)
+
+## Building
+
+To build, run the command:
+
+`docker-compose build`
+
+## Use
+
+To use the containers, run the command:
+
+`docker-compose up`
+
+Then map the URLs *sling2.apache.org* and *cms.sling.apache.org* to your
docker host. On local hosts, you can add the following entries into your
/etc/hosts file:
+
+ 127.0.0.1 sling2.apache.org
+ 127.0.0.1 cms.sling.apache.org
diff --git a/docker/cache_disk.conf b/docker/cms/Dockerfile
similarity index 62%
rename from docker/cache_disk.conf
rename to docker/cms/Dockerfile
index 1028b14..cc2dd50 100644
--- a/docker/cache_disk.conf
+++ b/docker/cms/Dockerfile
@@ -9,8 +9,22 @@
# either express or implied. See the License for the specific language
governing permissions
# and limitations under the License.
#
+# Apache Sling CMS Dockerfile
-<IfModule mod_cache_disk.c>
- CacheDirLevels 2
- CacheDirLength 1
-</IfModule>
\ No newline at end of file
+# Pull base image.
+FROM adoptopenjdk:11-jre-openj9
+MAINTAINER [email protected]
+
+# Configure directories
+WORKDIR /opt/sling
+VOLUME /opt/sling/sling
+
+# Setup Sling CMS
+RUN mkdir -p /opt/sling
+RUN curl -L
https://search.maven.org/remotecontent?filepath=org/apache/sling/org.apache.sling.cms.builder/0.14.0/org.apache.sling.cms.builder-0.14.0.jar
--output org.apache.sling.cms.jar
+
+# Expose endpoints
+EXPOSE 8080
+
+# Start Sling CMS
+CMD exec java -jar org.apache.sling.cms.jar
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
new file mode 100644
index 0000000..aa64ca9
--- /dev/null
+++ b/docker/docker-compose.yml
@@ -0,0 +1,10 @@
+version: '3'
+services:
+ cms:
+ build: cms
+ ports:
+ - "8080:8080"
+ webacache:
+ build: webcache
+ ports:
+ - "80:80"
diff --git a/docker/site.conf b/docker/site.conf
deleted file mode 100644
index 7c595db..0000000
--- a/docker/site.conf
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or
more contributor license
-# agreements. See the NOTICE file distributed with this work for
additional information
-# regarding copyright ownership. The ASF licenses this file to you
under the Apache License,
-# Version 2.0 (the "License"); you may not use this file except in
compliance with the
-# License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
distributed under the
-# License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND,
-# either express or implied. See the License for the specific language
governing permissions
-# and limitations under the License.
-#
-
-<VirtualHost *:80>
- ServerName sling2.apache.org
- DocumentRoot /var/www/vhosts/sling
- ErrorLog /var/log/apache2/sling-err.log
- TransferLog /var/log/apache2/sling-access.log
-
- # Configure mod_cache
- CacheEnable disk /
- CacheIgnoreNoLastMod On
- CacheRoot /var/cache/httpd/danklco-com
- CacheDefaultExpire 600
-
- # Configure mod_expire
- ExpiresActive On
- ExpiresDefault "access plus 1 month"
- ExpiresByType text/html "access plus 5 minutes"
- ExpiresByType application/json "access plus 5 minutes"
- ExpiresByType image/gif "access plus 1 year"
- ExpiresByType image/jpeg "access plus 1 year"
- ExpiresByType image/png "access plus 1 year"
- ExpiresByType text/css "access plus 1 month"
- ExpiresByType text/javascript "access plus 1 month"
- ExpiresByType application/javascript "access plus 1 month"
-
- # Configure Proxy
- ProxyPass /.well-known !
- ProxyPass /ERROR !
- ProxyPass /static/clientlibs/reference/
http://localhost:8080/static/clientlibs/reference/ connectiontimeout=10
timeout=60 retry=0
- ProxyPassReverse /static/clientlibs/reference/
http://localhost:8080/static/clientlibs/reference/
- ProxyPass / http://localhost:8080/content/apache/sling-apache-org/
connectiontimeout=10 timeout=60 retry=0
- ProxyPassReverse /content/apache/sling-apache-org/
http://localhost:8080/content/apache/sling-apache-org/
-
- # Security / Hardening
- AllowEncodedSlashes on
- RewriteRule "^.+\..*\.json" - [F,L]
- RewriteCond %{REQUEST_METHOD} ^(delete|post|trace|track) [NC]
- RewriteRule .* - [F,L]
- Header set X-Frame-Options SAMEORIGIN
- Header set X-XSS-Protection "1; mode=block"
- Header set X-Content-Type-Options "nosniff"
-
-
- # Compress text files
- AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
text/javascript application/javascript application/json
-
-</VirtualHost>
\ No newline at end of file
diff --git a/docker/Dockerfile b/docker/webcache/Dockerfile
similarity index 69%
rename from docker/Dockerfile
rename to docker/webcache/Dockerfile
index 18f0963..b6e2c4f 100644
--- a/docker/Dockerfile
+++ b/docker/webcache/Dockerfile
@@ -9,25 +9,14 @@
# either express or implied. See the License for the specific language
governing permissions
# and limitations under the License.
#
-# Apache Sling CMS Dockerfile
-
+# Apache Sling CMS Web Cache Dockerfile
# Pull base image.
-FROM openjdk:8-jre
+FROM ubuntu:latest
MAINTAINER [email protected]
-# Configure directories
-WORKDIR /opt/sling
-VOLUME /opt/sling/sling
-
-# Setup Sling CMS
-RUN mkdir -p /opt/sling
-RUN wget -O org.apache.sling.cms.jar
https://search.maven.org/remotecontent?filepath=org/apache/sling/org.apache.sling.cms.builder/0.12.0/org.apache.sling.cms.builder-0.12.0.jar
-ENV JAVA_OPTS -Xmx512m
-ENV SLING_OPTS ''
-
# Install Apache
-RUN apt-get update
+RUN apt-get update
RUN apt-get install apache2 -y
# Configure mod_rewrite
@@ -50,7 +39,8 @@ COPY cms.conf /etc/apache2/sites-enabled
COPY site.conf /etc/apache2/sites-enabled
# Expose endpoints
-EXPOSE 80 443
+EXPOSE 80
-# Background Apache httpd and start Sling CMS
-CMD exec service apache2 start & service apache-htcacheclean start & java
$JAVA_OPTS -jar org.apache.sling.cms.jar $SLING_OPTS
+# Start Apache httpd
+RUN service apache-htcacheclean start
+CMD ["/usr/sbin/apache2ctl", "-DFOREGROUND"]
diff --git a/docker/cms.conf b/docker/webcache/cms.conf
similarity index 92%
rename from docker/cms.conf
rename to docker/webcache/cms.conf
index 24d3be6..47fa459 100644
--- a/docker/cms.conf
+++ b/docker/webcache/cms.conf
@@ -15,8 +15,8 @@
DocumentRoot /var/www/vhosts/sling-cms
ErrorLog /var/log/apache2/sling-cms-err.log
TransferLog /var/log/apache2/sling-cms-access.log
-
+
ProxyPass /.well-known !
- ProxyPass / http://localhost:8080/
- ProxyPassReverse / http://localhost:8080/
+ ProxyPass / http://cms:8080/
+ ProxyPassReverse / http://cms:8080/
</VirtualHost>
diff --git a/docker/webcache/site.conf b/docker/webcache/site.conf
new file mode 100644
index 0000000..57ae148
--- /dev/null
+++ b/docker/webcache/site.conf
@@ -0,0 +1,58 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
contributor license
+# agreements. See the NOTICE file distributed with this work for additional
information
+# regarding copyright ownership. The ASF licenses this file to you under the
Apache License,
+# Version 2.0 (the "License"); you may not use this file except in compliance
with the
+# License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
distributed under the
+# License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND,
+# either express or implied. See the License for the specific language
governing permissions
+# and limitations under the License.
+#
+
+<VirtualHost *:80>
+
+ ServerName sling2.apache.org
+ DocumentRoot /var/www/vhosts/sling
+ ErrorLog /var/log/apache2/sling-err.log
+ TransferLog /var/log/apache2/sling-access.log
+
+ # Configure mod_cache
+ CacheEnable disk /
+ CacheIgnoreNoLastMod On
+ CacheRoot /var/cache/httpd/sling2-apache-org
+ CacheDefaultExpire 600
+
+ # Configure mod_expire
+ ExpiresActive On
+ ExpiresDefault "access plus 1 month"
+ ExpiresByType text/html "access plus 5 minutes"
+ ExpiresByType application/json "access plus 5 minutes"
+ ExpiresByType image/gif "access plus 1 year"
+ ExpiresByType image/jpeg "access plus 1 year"
+ ExpiresByType image/png "access plus 1 year"
+ ExpiresByType text/css "access plus 1 month"
+ ExpiresByType text/javascript "access plus 1 month"
+ ExpiresByType application/javascript "access plus 1 month"
+
+ # Configure Proxy
+ ProxyPass /.well-known !
+ ProxyPass /ERROR !
+ ProxyPass /static/clientlibs/reference/
http://cms:8080/static/clientlibs/reference/ connectiontimeout=10 timeout=60
retry=0
+ ProxyPassReverse /static/clientlibs/reference/
http://cms:8080/static/clientlibs/reference/
+ ProxyPass / http://cms:8080/content/apache/sling-apache-org/
connectiontimeout=10 timeout=60 retry=0
+ ProxyPassReverse /content/apache/sling-apache-org/
http://cms:8080/content/apache/sling-apache-org/
+
+ # Security / Hardening
+ AllowEncodedSlashes on
+ RewriteRule "^.+\..*\.json" - [F,L]
+ RewriteCond %{REQUEST_METHOD} ^(delete|post|trace|track) [NC]
+ RewriteRule .* - [F,L]
+ Header set X-Frame-Options SAMEORIGIN
+ Header set X-XSS-Protection "1; mode=block"
+ Header set X-Content-Type-Options "nosniff"
+
+ # Compress text files
+ AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
text/javascript application/javascript application/json
+
+</VirtualHost>