From f0d2f4f98cc6ef28ad5f4789e259791491d6177b Mon Sep 17 00:00:00 2001 From: Odewumi Babarinde Ayodeji Date: Wed, 14 Feb 2018 15:14:05 +0100 Subject: [PATCH 1/8] Themes to be stored on the host using persistent storage --- Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Makefile b/Makefile index 263eb0f..25469f5 100644 --- a/Makefile +++ b/Makefile @@ -80,6 +80,12 @@ ifndef UNATTENDED_CREATION @echo "chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-uploads" @echo "dokku storage:mount $(APP_NAME) /var/lib/dokku/data/storage/$(APP_NAME)-uploads:/app/wp-content/uploads" @echo "" + # setup themes persistent storage + @echo "" + @echo "mkdir -p /var/lib/dokku/data/storage/$(APP_NAME)-themes" + @echo "chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-themes" + @echo "dokku storage:mount $(APP_NAME) /var/lib/dokku/data/storage/$(APP_NAME)-themes:/app/wp-content/themes" + @echo "" # setup your mysql database and link it to your app @echo "" @echo "export MYSQL_IMAGE_VERSION=\"5.6\"" @@ -101,6 +107,7 @@ else $(DOKKU_CMD) apps:create $(APP_NAME) $(DOKKU_CMD) storage:mount $(APP_NAME) /var/lib/dokku/data/storage/$(APP_NAME)-plugins:/app/wp-content/plugins $(DOKKU_CMD) storage:mount $(APP_NAME) /var/lib/dokku/data/storage/$(APP_NAME)-uploads:/app/wp-content/uploads + $(DOKKU_CMD) storage:mount $(APP_NAME) /var/lib/dokku/data/storage/$(APP_NAME)-themes:/app/wp-content/themes $(DOKKU_CMD) mysql:create $(APP_NAME)-database $(DOKKU_CMD) mysql:link $(APP_NAME)-database $(APP_NAME) @/tmp/wp-salts @@ -111,6 +118,8 @@ else @echo "chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-plugins" @echo "mkdir -p /var/lib/dokku/data/storage/$(APP_NAME)-uploads" @echo "chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-uploads" + @echo "mkdir -p /var/lib/dokku/data/storage/$(APP_NAME)-themes" + @echo "chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-themes" @echo "" # now, on your local machine, change directory to your new wordpress app, and push it up @echo "" @@ -140,6 +149,7 @@ ifndef UNATTENDED_CREATION @echo "" @echo "rm -rf /var/lib/dokku/data/storage/$(APP_NAME)-plugins" @echo "rm -rf /var/lib/dokku/data/storage/$(APP_NAME)-uploads" + @echo "rm -rf /var/lib/dokku/data/storage/$(APP_NAME)-themes" @echo "" # now, on your local machine, cd into your app's parent directory and remove the app @echo "" @@ -154,6 +164,7 @@ else @echo "" @echo "rm -rf /var/lib/dokku/data/storage/$(APP_NAME)-plugins" @echo "rm -rf /var/lib/dokku/data/storage/$(APP_NAME)-uploads" + @echo "rm -rf /var/lib/dokku/data/storage/$(APP_NAME)-themes" @echo "" # now, on your local machine, cd into your app's parent directory and remove the app @echo "" From 7e61f298b6c3ff1fadff87baf2e39bca2a6add5f Mon Sep 17 00:00:00 2001 From: Odewumi Babarinde Ayodeji Date: Wed, 14 Feb 2018 15:20:50 +0100 Subject: [PATCH 2/8] Procfile added --- Procfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 Procfile diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..2bd5bed --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: heroku-php-apache2 From f3f75cf4d17cc56323d76080f0c199658c937aff Mon Sep 17 00:00:00 2001 From: Odewumi Babarinde Ayodeji Date: Fri, 16 Feb 2018 11:44:01 +0100 Subject: [PATCH 3/8] delete Procfile and create Procfile in cloned wordpress repository --- Makefile | 2 ++ Procfile | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) delete mode 100644 Procfile diff --git a/Makefile b/Makefile index 25469f5..be0f10d 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,8 @@ endif @test -d $(APP_NAME) || (git clone --quiet --branch=$(WORDPRESS_VERSION) --single-branch https://github.com/WordPress/WordPress.git $(APP_NAME) && cd $(APP_NAME) && git checkout -qb master) # adding wp-config.php from gist @test -f $(APP_NAME)/wp-config.php || (cp config/wp-config.php $(APP_NAME)/wp-config.php && cd $(APP_NAME) && git add wp-config.php && git commit -qm "Adding environment-variable based wp-config.php") + # adding Procfile to configure deployment + @test -f $(APP_NAME)/Procfile || (echo "web: heroku-php-apache2" > $(APP_NAME)/Procfile && cd $(APP_NAME) && git add Procfile && git commit -qm "Adding procfile to repository") # adding .env file to configure buildpack @test -f $(APP_NAME)/.buildpacks || (echo "https://github.com/heroku/heroku-buildpack-php.git#$(BUILDPACK_VERSION)" > $(APP_NAME)/.buildpacks && cd $(APP_NAME) && git add .buildpacks && git commit -qm "Forcing php buildpack usage") # ensuring our composer.json loads with php 5.6 and loads the mysql extension diff --git a/Procfile b/Procfile deleted file mode 100644 index 2bd5bed..0000000 --- a/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: heroku-php-apache2 From 3bd64245de69547dede1547dca8f82fc6df1ca61 Mon Sep 17 00:00:00 2001 From: Odewumi Babarinde Ayodeji Date: Fri, 16 Feb 2018 12:54:35 +0100 Subject: [PATCH 4/8] copy theme files to host mount directory as container mount point is overwritten with host mount point during installation --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index be0f10d..ada36a5 100644 --- a/Makefile +++ b/Makefile @@ -84,8 +84,8 @@ ifndef UNATTENDED_CREATION @echo "" # setup themes persistent storage @echo "" - @echo "mkdir -p /var/lib/dokku/data/storage/$(APP_NAME)-themes" - @echo "chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-themes" + @echo "cp -r $(APP_NAME)/wp-content/themes /var/lib/dokku/data/storage/$(APP_NAME)-themes" + @echo "chown -R 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-themes" @echo "dokku storage:mount $(APP_NAME) /var/lib/dokku/data/storage/$(APP_NAME)-themes:/app/wp-content/themes" @echo "" # setup your mysql database and link it to your app From 1a82e58bb80f2a858cd87bf36f2082a3fe36d418 Mon Sep 17 00:00:00 2001 From: Odewumi Babarinde Ayodeji Date: Fri, 16 Feb 2018 13:01:03 +0100 Subject: [PATCH 5/8] make changes of copying themes to host mount in unattended installation --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ada36a5..624199c 100644 --- a/Makefile +++ b/Makefile @@ -120,7 +120,7 @@ else @echo "chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-plugins" @echo "mkdir -p /var/lib/dokku/data/storage/$(APP_NAME)-uploads" @echo "chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-uploads" - @echo "mkdir -p /var/lib/dokku/data/storage/$(APP_NAME)-themes" + @echo "cp -r $(APP_NAME)/wp-content/themes /var/lib/dokku/data/storage/$(APP_NAME)-themes" @echo "chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-themes" @echo "" # now, on your local machine, change directory to your new wordpress app, and push it up From cb181930674ffb3d563b93c04d807fe6132aef97 Mon Sep 17 00:00:00 2001 From: Odewumi Babarinde Ayodeji Date: Fri, 16 Feb 2018 13:44:17 +0100 Subject: [PATCH 6/8] attempt to make installation of unattended part unattended --- Makefile | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 624199c..2284c40 100644 --- a/Makefile +++ b/Makefile @@ -116,17 +116,16 @@ else @echo "" # run the following commands on the server to ensure data is stored properly on disk @echo "" - @echo "mkdir -p /var/lib/dokku/data/storage/$(APP_NAME)-plugins" - @echo "chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-plugins" - @echo "mkdir -p /var/lib/dokku/data/storage/$(APP_NAME)-uploads" - @echo "chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-uploads" - @echo "cp -r $(APP_NAME)/wp-content/themes /var/lib/dokku/data/storage/$(APP_NAME)-themes" - @echo "chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-themes" + @mkdir -p /var/lib/dokku/data/storage/$(APP_NAME)-plugins + @chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-plugins + @mkdir -p /var/lib/dokku/data/storage/$(APP_NAME)-uploads + @chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-uploads + @cp -r $(APP_NAME)/wp-content/themes /var/lib/dokku/data/storage/$(APP_NAME)-themes + @chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-themes @echo "" # now, on your local machine, change directory to your new wordpress app, and push it up @echo "" - @echo "cd $(APP_NAME)" - @echo "git push dokku master" + @git push dokku master endif .PHONY: destroy @@ -164,11 +163,11 @@ else $(DOKKU_CMD) -- --force apps:destroy $(APP_NAME) # run the following commands on the server to remove storage directories on disk @echo "" - @echo "rm -rf /var/lib/dokku/data/storage/$(APP_NAME)-plugins" - @echo "rm -rf /var/lib/dokku/data/storage/$(APP_NAME)-uploads" - @echo "rm -rf /var/lib/dokku/data/storage/$(APP_NAME)-themes" + @rm -rf /var/lib/dokku/data/storage/$(APP_NAME)-plugins + @rm -rf /var/lib/dokku/data/storage/$(APP_NAME)-uploads + @rm -rf /var/lib/dokku/data/storage/$(APP_NAME)-themes @echo "" # now, on your local machine, cd into your app's parent directory and remove the app @echo "" - @echo "rm -rf $(APP_NAME)" + @rm -rf $(APP_NAME) endif From 327f2dbda3518c8efb04eab4945ba80e81e0a74e Mon Sep 17 00:00:00 2001 From: Odewumi Babarinde Ayodeji Date: Fri, 16 Feb 2018 13:56:15 +0100 Subject: [PATCH 7/8] change directory before push, change installation comments --- Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 2284c40..9c1dfb2 100644 --- a/Makefile +++ b/Makefile @@ -114,7 +114,7 @@ else $(DOKKU_CMD) mysql:link $(APP_NAME)-database $(APP_NAME) @/tmp/wp-salts @echo "" - # run the following commands on the server to ensure data is stored properly on disk + # create plugins,uploads and themes directory to ensure data is stored properly on disk @echo "" @mkdir -p /var/lib/dokku/data/storage/$(APP_NAME)-plugins @chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-plugins @@ -123,8 +123,9 @@ else @cp -r $(APP_NAME)/wp-content/themes /var/lib/dokku/data/storage/$(APP_NAME)-themes @chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-themes @echo "" - # now, on your local machine, change directory to your new wordpress app, and push it up + # push app to deploy @echo "" + @cd $(APP_NAME) @git push dokku master endif @@ -161,13 +162,14 @@ else $(DOKKU_CMD) mysql:destroy $(APP_NAME)-database # destroy the app $(DOKKU_CMD) -- --force apps:destroy $(APP_NAME) - # run the following commands on the server to remove storage directories on disk + # remove storage directories on disk @echo "" @rm -rf /var/lib/dokku/data/storage/$(APP_NAME)-plugins @rm -rf /var/lib/dokku/data/storage/$(APP_NAME)-uploads @rm -rf /var/lib/dokku/data/storage/$(APP_NAME)-themes @echo "" - # now, on your local machine, cd into your app's parent directory and remove the app + # removing the app @echo "" @rm -rf $(APP_NAME) + # done endif From f71cd9e555bc7264e05638c5d17e6b3d01f787a4 Mon Sep 17 00:00:00 2001 From: Odewumi Babarinde Ayodeji Date: Fri, 16 Feb 2018 14:11:07 +0100 Subject: [PATCH 8/8] revert: change directory before push --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9c1dfb2..4464e00 100644 --- a/Makefile +++ b/Makefile @@ -123,10 +123,10 @@ else @cp -r $(APP_NAME)/wp-content/themes /var/lib/dokku/data/storage/$(APP_NAME)-themes @chown 32767:32767 /var/lib/dokku/data/storage/$(APP_NAME)-themes @echo "" - # push app to deploy + # now, on your local machine, change directory to your new wordpress app, and push it up @echo "" - @cd $(APP_NAME) - @git push dokku master + @echo "cd $(APP_NAME)" + @echo "git push dokku master" endif .PHONY: destroy @@ -168,7 +168,7 @@ else @rm -rf /var/lib/dokku/data/storage/$(APP_NAME)-uploads @rm -rf /var/lib/dokku/data/storage/$(APP_NAME)-themes @echo "" - # removing the app + # removing the app directory @echo "" @rm -rf $(APP_NAME) # done