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

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...

Some weird keyboard ISSUE + Ubuntu

 Recently my ubuntu OS  drives me crazy until i keep upgrading to the latest version. Even had issue where post upgrade the system crashed. lol and i reformat back using bootable USB Drive. You can watch how i did it! recorded and uploaded to my YouTube channel . Now im at the Ubuntu 22.04.1 LTS version! Everytime i typed on my keyboard. the numbering goes crazy, the symbols goes crazy..the mouse goes crazy. Until one time i just tried to change the Keyboard setting to English (UK) from English (US)   and it works.    sometimes it works temporarily.  sometimes it work for long hours. still monitoring. but this is my current workaround.  really an old laptop.    takder ke yang nak sponser lappie baru :P