planet.plone.org/svx: WIP: docker

sven <jenkins-z4DKO/[email protected]> Sun, 30 Jul 2017 08:37:23 -0700 (PDT)
Newsgroups gmane.comp.web.zope.plone.cvs
Message-ID <[email protected]>
Repository: planet.plone.org
Branch: refs/heads/svx
Date: 2017-07-30T17:37:11+02:00
Author: sven (svx) <[email protected]>
Commit: https://github.com/plone/planet.plone.org/commit/c84a80ced1f39caad9dd8e4dd54bd2cd9354ae0e

WIP: docker

Files changed:
A dockerfiles/Caddyfile
A dockerfiles/Dockerfile
A dockerfiles/Procfile
A dockerfiles/crontab.tmp
M .gitignore
D Caddyfile
D Dockerfile

diff --git a/.gitignore b/.gitignore
index 2082be9..759c99b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,8 @@
 theme
 .vagrant
 *.tmplc
+plone_theme/templates/*.tmplc
+plone_theme/templates/inc/*.tmplc
 planet/planet-cache/
 planet/public_html/
 ubuntu-xenial-16.04-cloudimg-console.log
diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index 3f05654..0000000
--- a/Dockerfile
+++ /dev/null
@@ -1,37 +0,0 @@
-FROM testthedocs/ttd-caddy:latest
-LABEL maintainer "Sven <sven-wk1Y/SJ71nWGEaMKDC2e/[email protected]>" \
-    org.label-schema.vendor = "Plone Community" \
-    description="Planet Plone"
-
-ENV PIP_CACHE /root/.cache
-
-RUN builddeps=' \
-    git \
-    ' \
-    && apk --no-cache add \
-	ca-certificates \
-	$builddeps \
-        su-exec \
-	python \
-        dcron \
-	libxslt \
-    && adduser -g "Planet User" -D -s /bin/ash -h /srv/venus planet \
-    && apk del --purge $builddeps \
-    && rm -rf $PIP_CACHE
-
-COPY Caddyfile /etc/Caddyfile
-WORKDIR /srv/venus
-COPY planet planet
-RUN chown -R planet:planet planet
-
-USER planet
-
-RUN git clone https://github.com/rubys/venus.git source
-
-
-# Todo:
-# Change planet config to generate html and cache in /srv/planet and /srv/planet-cache
-# Check cache of dockerfile
-# Add cron to run planet script every 10 minutes
-# Check entrypoint
-# Add Caddyfile
diff --git a/Caddyfile b/dockerfiles/Caddyfile
similarity index 63%
rename from Caddyfile
rename to dockerfiles/Caddyfile
index 0d16128..9e7ea8e 100644
--- a/Caddyfile
+++ b/dockerfiles/Caddyfile
@@ -1,12 +1,13 @@
-planet.plone.org:443 {
+planet.plone.org:80 {
     0.0.0.0
     log stdout
     errors stdout
     gzip
+    tls no
 }
 
 header / {
     Cache-Control "max-age=86400"
 }
 
-root /srv/public_html
+root /srv/venus/public_html
diff --git a/dockerfiles/Dockerfile b/dockerfiles/Dockerfile
new file mode 100644
index 0000000..557d145
--- /dev/null
+++ b/dockerfiles/Dockerfile
@@ -0,0 +1,44 @@
+FROM testthedocs/ttd-caddy:latest
+LABEL maintainer "Sven <sven-wk1Y/SJ71nWGEaMKDC2e/[email protected]>" \
+    org.label-schema.vendor = "Plone Community" \
+    description="Planet Plone"
+
+ENV PIP_CACHE /root/.cache
+
+RUN builddeps=' \
+    git \
+    ' \
+    && apk --no-cache add \
+	ca-certificates \
+	$builddeps \
+        su-exec \
+	python2 \
+        dcron \
+	libxslt \
+        bash \
+        py-pip \
+    && mkdir -p /srv/venus \
+    && adduser -g "Planet User" -D -s /bin/bash -h /srv/venus planet \
+    && git clone https://github.com/rubys/venus.git /srv/venus/source \
+    && chown -R planet:planet /srv/venus \
+    && pip2 install --upgrade pip \
+    && pip2 install honcho \
+    && apk del --purge $builddeps \
+    && rm -rf $PIP_CACHE
+
+COPY dockerfiles/Caddyfile /etc/Caddyfile
+COPY dockerfiles/crontab.tmp /etc/cron.d/planet.cron
+RUN crontab /etc/cron.d/planet.cron
+
+WORKDIR /srv/venus
+#COPY dockerfiles/Procfile /Procfile
+COPY planet planet.plone.org
+RUN chown -R planet:planet planet.plone.org
+
+USER planet
+ENTRYPOINT ["/bin/bash"]
+
+# Todo:
+# Change planet config to generate html and cache in /srv/planet and /srv/planet-cache
+# Add cron to run planet script every hour
+# Check entrypoint
diff --git a/dockerfiles/Procfile b/dockerfiles/Procfile
new file mode 100644
index 0000000..e7fc5ff
--- /dev/null
+++ b/dockerfiles/Procfile
@@ -0,0 +1,2 @@
+crond: tini /usr/sbin/crond -f -L -
+caddy: tini /usr/bin/caddy
diff --git a/dockerfiles/crontab.tmp b/dockerfiles/crontab.tmp
new file mode 100644
index 0000000..2e8e328
--- /dev/null
+++ b/dockerfiles/crontab.tmp
@@ -0,0 +1,3 @@
+# This is a cron to update planet.plone every hour
+SHELL=/bin/bash
+0 * * * * planet python /srv/venus/source/planet.py /srv/planet/planet.ini >> /var/log/cron.log 2>&1



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot