From 0a092d4432523eaab5eaade438643927c78ae6fb Mon Sep 17 00:00:00 2001
From: Michiel de Jong <michiel@unhosted.org>
Date: Tue, 4 Nov 2014 14:32:30 +0000
Subject: [PATCH] remove wordpress-subdir image

---
 doc/architecture-overview.md                  |  8 ++---
 importers/wordpress-subdir.sh                 | 18 ----------
 scripts/setup.sh                              |  1 -
 .../wordpress-subdir-discovery@.service       | 35 -------------------
 unit-files/wordpress-subdir-gitpuller@.path   |  2 --
 .../wordpress-subdir-gitpuller@.service       |  9 -----
 unit-files/wordpress-subdir-gitpuller@.timer  |  8 -----
 unit-files/wordpress-subdir-importer@.service | 15 --------
 unit-files/wordpress-subdir@.service          | 34 ------------------
 9 files changed, 4 insertions(+), 126 deletions(-)
 delete mode 100755 importers/wordpress-subdir.sh
 delete mode 100644 unit-files/wordpress-subdir-discovery@.service
 delete mode 100644 unit-files/wordpress-subdir-gitpuller@.path
 delete mode 100644 unit-files/wordpress-subdir-gitpuller@.service
 delete mode 100644 unit-files/wordpress-subdir-gitpuller@.timer
 delete mode 100644 unit-files/wordpress-subdir-importer@.service
 delete mode 100644 unit-files/wordpress-subdir@.service

diff --git a/doc/architecture-overview.md b/doc/architecture-overview.md
index 5ebb4d5..ce46570 100644
--- a/doc/architecture-overview.md
+++ b/doc/architecture-overview.md
@@ -12,12 +12,12 @@ There is currently no similar side-kick for updating `/data/server-wide/postfix/
 
 The `scripts/setup.sh` takes care of setting up etcd, enabling and starting the haproxy and postfix service (as well as one haproxy backend, to serve the default site), and the haproxy-confd side-kick to listen for changes in the backends configuration in etcd, so that new backends are automatically added to the haproxy config as soon as their IP address is written into etcd.
 
-## HAProxy backends: nginx, wordpress, wordpress-subdir
+## HAProxy backends: nginx, wordpress
 
-A per-user process is a haproxy backend for a specific domain name. At the time of writing we have three applications available: nginx, wordpress, and wordpress-subdir.
+A per-user process is a haproxy backend for a specific domain name. At the time of writing we have two applications available: nginx and wordpress.
 
-You will notice there are also some other units in the `unit-files/` folder of this repo, like the gitpuller and mysql ones. Whenever you start a wordpress or a wordpress-subdir unit, it requires a mysql service.
-Whenever you start a wordpress-subdir or an nginx unit, it wants a gitpuller unit. In all three cases, an -importer unit and a -discovery unit are required.
+You will notice there are also some other units in the `unit-files/` folder of this repo, like the gitpuller and mysql ones. Whenever you start a wordpress unit, it requires a mysql service.
+Whenever you start an nginx unit, it wants a gitpuller unit. In all three cases, an -importer unit and a -discovery unit are required.
 This works through a
 [`Requires=` directive](https://github.com/indiehosters/indiehosters/blob/0.1.0/unit-files/nginx@.service#L6-L7) which systemd interprets, so that if you start one service, its dependencies are also started (you can see that in `systemctl list-units`).
 
diff --git a/importers/wordpress-subdir.sh b/importers/wordpress-subdir.sh
deleted file mode 100755
index 977a311..0000000
--- a/importers/wordpress-subdir.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-if [ ! -d "/data/per-user/$USER/wordpress-subdir/data" ]; then
-  cd /data/per-user/$USER/
-  tar xvzf /data/indiehosters/blueprints/wordpress.tgz
-fi
-
-cat /data/per-user/$USER/mysql/.env | sed s/MYSQL_PASS/DB_PASS/ > /data/per-user/$USER/wordpress-subdir/.env
-
-if [ ! -e "/data/per-user/$USER/wordpress-subdir/data/www-content/index.html" ]; then
-  if [ -e "/data/per-user/$USER/wordpress-subdir/data/GITURL" ]; then
-    git clone `cat /data/per-user/$USER/wordpress-subdir/data/GITURL` /data/per-user/$USER/wordpress-subdir/data/www-content
-    cd /data/per-user/$USER/wordpress-subdir/data/www-content && git checkout master
-  else
-    mkdir -p /data/per-user/$USER/wordpress-subdir/data/www-content
-    echo Hello $USER > /data/per-user/$USER/wordpress-subdir/data/www-content/index.html
-  fi
-fi
diff --git a/scripts/setup.sh b/scripts/setup.sh
index 5a61542..764284d 100755
--- a/scripts/setup.sh
+++ b/scripts/setup.sh
@@ -19,7 +19,6 @@ docker pull indiehosters/postfix-forwarder
 docker pull indiehosters/nginx
 docker pull indiehosters/mysql
 docker pull indiehosters/wordpress
-docker pull indiehosters/wordpress-subdir
 
 # Install unit-files
 cp /data/indiehosters/unit-files/* /etc/systemd/system
diff --git a/unit-files/wordpress-subdir-discovery@.service b/unit-files/wordpress-subdir-discovery@.service
deleted file mode 100644
index 099c7b3..0000000
--- a/unit-files/wordpress-subdir-discovery@.service
+++ /dev/null
@@ -1,35 +0,0 @@
-[Unit]
-Description=%p for %i etcd registration
-
-# Requirements
-Requires=etcd.service
-Requires=wordpress-subdir@%i.service
-
-# Dependency ordering
-After=etcd.service
-After=wordpress-subdir@%i.service
-
-# Dependency binding
-BindsTo=wordpress-subdir@%i.service
-
-[Service]
-# Start
-## Test whether service is accessible and then register useful information
-ExecStart=/bin/bash -c ' \
-  sleep 3; \
-  while true; do \
-    app=`echo %p | cut -d"-" -f1,2`; \
-    ip=`docker inspect --format \'{{.NetworkSettings.IPAddress}}\' $app-%i`; \
-    curl -f $ip; \
-    if [ $? -eq 0 ]; then \
-      etcdctl set /services/$app/%i \'{"ip":"\'$ip\'", "port":"80"}\' --ttl 60; \
-    else \
-      etcdctl rm /services/$app/%i; \
-    fi; \
-    sleep 50; \
-  done'
-
-# Stop
-ExecStop=/bin/bash -ceux ' \
-  app=`echo %p | cut -d"-" -f1`; \
-  /usr/bin/etcdctl rm /services/$app/%i
diff --git a/unit-files/wordpress-subdir-gitpuller@.path b/unit-files/wordpress-subdir-gitpuller@.path
deleted file mode 100644
index 92ce7d1..0000000
--- a/unit-files/wordpress-subdir-gitpuller@.path
+++ /dev/null
@@ -1,2 +0,0 @@
-[Path]
-PathExists=/data/per-user/%i/wordpress-subdir/data/GITURL
diff --git a/unit-files/wordpress-subdir-gitpuller@.service b/unit-files/wordpress-subdir-gitpuller@.service
deleted file mode 100644
index f2a26b7..0000000
--- a/unit-files/wordpress-subdir-gitpuller@.service
+++ /dev/null
@@ -1,9 +0,0 @@
-[Unit]
-Description= git puller
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-Environment=USER=%i
-Environment=APP=wordpress-subdir
-ExecStart=/data/indiehosters/importers/gitpuller.sh
diff --git a/unit-files/wordpress-subdir-gitpuller@.timer b/unit-files/wordpress-subdir-gitpuller@.timer
deleted file mode 100644
index 78faa1e..0000000
--- a/unit-files/wordpress-subdir-gitpuller@.timer
+++ /dev/null
@@ -1,8 +0,0 @@
-[Unit]
-Description=Run git puller every 10 minutes
-
-[Timer]
-OnUnitActiveSec=10min
-
-[Install]
-WantedBy=timers.target
diff --git a/unit-files/wordpress-subdir-importer@.service b/unit-files/wordpress-subdir-importer@.service
deleted file mode 100644
index 2ab17f4..0000000
--- a/unit-files/wordpress-subdir-importer@.service
+++ /dev/null
@@ -1,15 +0,0 @@
-[Unit]
-Description=wordpress-subdir importer
-
-# Dependency ordering
-After=mysql-importer@%i.service
-Before=wordpress-subdir@%i.service
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-Environment=USER=%i
-ExecStart=/data/indiehosters/importers/wordpress-subdir.sh
-
-[Install]
-WantedBy=wordpress-subdir@%i.service
diff --git a/unit-files/wordpress-subdir@.service b/unit-files/wordpress-subdir@.service
deleted file mode 100644
index 263f31e..0000000
--- a/unit-files/wordpress-subdir@.service
+++ /dev/null
@@ -1,34 +0,0 @@
-[Unit]
-Description=%p-%i
-
-# Requirements
-Requires=docker.service
-Requires=etcd.service
-Requires=mysql@%i.service
-Requires=%p-importer@%i.service
-Requires=%p-discovery@%i.service
-Wants=%p-gitpuller@%i.service
-
-# Dependency ordering
-After=docker.service
-After=mysql@%i.service
-After=%p-importer@%i.service
-Before=%p-discovery@%i.service
-
-[Service]
-Restart=always
-ExecStartPre=-/usr/bin/docker kill %p-%i
-ExecStartPre=-/usr/bin/docker rm %p-%i
-ExecStart=/usr/bin/docker run \
-  --name %p-%i \
-  --link mysql-%i:db \
-  -v /data/per-user/%i/%p/data/wp-content:/wordpress/wp-content \
-  -v /data/per-user/%i/%p/data/.htaccess:/wordpress/.htaccess \
-  -v /data/per-user/%i/%p/data/www-content:/app \
-  --env-file /data/per-user/%i/%p/.env \
-  indiehosters/wordpress-subdir
-ExecReload=/usr/bin/docker restart %p-%i
-ExecStop=/usr/bin/docker stop %p-%i
-
-[Install]
-WantedBy=multi-user.target
-- 
GitLab