Skip to main content

Dockerize Wordpress Stacks for Easy Migration

 

Assalamualaikum, 

 


 

After using Google Cloud free credit  for 3 months, its time to migrate our Wordpress website!

I have launched https://4nutz.tk an e-commerce website that sells our own home-brand Natural Nut Butters! 

To save money, development was done on Google Cloud Compute Engine, after 3 months running, putting all the contents there! Tracking our own sales, finally its time to migrate. 

At the beginning, i don't want to put so much effort in running it up, used Bitnami image to run the Wordpress. Everything was easy and breezy!

But aware of the time limit, yes we need to migrate eventually. Because the Google Cloud pricing is too expensive for me! $20 per month? kidding me. 

Running the website on Digital Ocean is much cheaper $5 per month! Register using my referral link ya! you will get free $100 credit for 2 months! gets your hands dirty and start running you own web app / projects~

Ive been a fan of DO since the beginning, the price offer is very attractive, documentation support are extensive, dashboard is stunning, no down time experienced so far. 

 Now its time to take a step more, by dockerizing the Wordpress and its dependents stacks. As migration is really a pain to setup all the environments! Having this configurations set up life will be easier later if I again want to change platform, or move around or replicate or whatever!

for the dockerizing steps i followed this full guide.

Issue encountered:

1. Nginx 404 Permission issue on accessing Wordpress Docker container web content:

 When try to accessing the the Wordpress site, the Nginx running in the docker container unable to access the Wordpress container contents. thus i tried to map the Wordpress content to host machine path too and update the user id for www-data and update the permission for the content path!. And it works! thanks to this article

Quoted the article as below :

     $ sudo userdel www-data
$ sudo useradd -u 82 www-data

 

      $ sudo mkdir -p /data/html
      $ sudo
chown -R www-data:www-data /data/html

 

2. Error on accessing wp-admin & data not added when add to cart:

Saw the following error, 
 
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/themes/storefront-child/functions.php:
 
it happened probably due to the file copies that i did from Google Cloud to DO is corrupted or changed. I just need to edit the functions.php files and remove the extra lines and space ended in the file.
 
 
 

Restoring Wordpress & DB backups 

Previously I have shared how to create backups and restore backups for Wordpress & DB, have a look on my tutorial!
 
I restored the Wordpress files to <docker_project_folder>/data/html folder, copied over the files and force recreate on Wordpress container. 
 
For DB i copied over the SQL dump file to <docker_project_folder>/data/mysql and access the container to run the restore command. it can be done outside container too~ google hehe.
 
Notice that i linked the container volume to host paths for both Wordpress and MySQL
 

Push the changes to remote repository

This time I am going push the files to remote repository. Its time to be more systematic~ 
 
For Docker repo, the files that I am pushing over is 
 
<docker_project_folder>/docker-compose.yml
<docker_project_folder>/nginx-conf/*
 
For Wordpress repo, there will be two repo, themes and plugins, as i havent write any custom plugin yet, i will be only focusing on theme repo
 
Pushing the changes of custom theme to remote repo~
 
 
OK that's all for these 2-3days exploring, improving, maintenance job!
 

Comments

Popular posts from this blog

C# Serialization Tutorial Part 1 : Serialize object in file stream

Hello Peeps. Came across this topic while doing our game saving data feature. this post only cover basic serialization. basically serialization help us to convert our object into stream of bytes so that our object can be stored or transmit over in memory/file/database. before we can proceed with the serialization tutorial, we need to set the user permission to our target folder path. 1. Set the folder path to be accessible and can be override. This step is to avoid our program/apps from throwing unauthorizedaccessexception.    - for my scenario, im choosing the path of D:\SelfLearning\c#\Serialization to store my data file. Right click the target folder, select on Security tab Select on Users and give full control or modify permission to the user. 2. Now we are going to write our code. First we need to setup our folder path. 3. We going to create our file.  In this tutorial we are using FileStream type, other then FileStream, we can make use of MemoryStream i

Tutorial on Min3D framework using Android Studio

Salam peeps, UPDATES***, the model on the old link is no longer working. so i have create a github repo, where i put the source code in a project, you guys can try to clone in and run on your android studio device emulator or directly on your phone, Ive replaced the model with a cube. https://github.com/aliaramli/Min3DTutorial Previously i ve posted tutorial on min3D using eclipse IDE, i believe most of us has moved to Android Studio IDE in developing android apps? As previous tutorial shows a lot of support from readers and among hot post in my blog, i ve decided to post the same tutorial but this time using Android Studio. For those who are familiar with Eclipse/Android Studio migration they might not have problem in running this tutorial . For more detail explanation on min3D please visit this website page Ok lets get started. Step One Create a new android project in android studio. you may name it as what you like, below are how i defined my project settings.

Tutorial on min3d framework

Salam all. This time I want to share a bit, how I tried out the mid3d framework for the first time. Acknowledge that I am new to android development.   I just follow the tutorial on Mat-d website but there are certain things that I don’t understand how they actually work. Thus I want to share what I did step by step to make this example work. For explanations on coding/steps or errors please visit Mat-d website here J you ll understand more …. mat-d original tutorial load a 3d obl model with min3d for android Step one . Download min3d into your eclipse . Select File>Import>SVN>Checkout projects from SVN Next. Choose radio button : Create a new repository location Next. Enter the svn location http://min3d.googlecode.com/svn/trunk the thing that we want to check out from the svn is the min3d framework code. Step two. Download obj file  www.3dvia.com …you need to register first..it has free acc version.. and download the followin