A few time ago, I wrote a post about move wordpress to dokku.
What changed from that? Why another article? Well, I found better tools 🙂
First of all, I moved from dokku to standard docker, less problems, more scalable.
After that, I found a great orchestration tool for multiple docker servers: Rancher .
This great tool allow with few click to create a container that simple “works”.
I need to move an existing wordpress blog, so i have to move content and DB from one server to another.
This simple command helps for move content:
scp -r blog_content/ root@NEW_SERVER:/home/volumes/
After that, move database to the new server (but this isn’t mandatory, because rancher allows to link container from one server to another, without the need to expose to the internet the mysql port).
Now we can configure the “service” in rancher with official wordpress image and link to mysql container:
Add some environment variables for connection:
And link the content folder to the container:
Press create and wait some seconds, after that You should see the service “running”.
In the configuration I didn’t set a Port Map, because I’ve a load balancer for this, but if you need you can add the port for expose the container.
Finally, we need only to fix permissions for wp-content folder, so access to container (with rancher it’s simple: “3 dots icon” at right of container -> “Execute Shell”) and launch this command:
chown -R www-data:www-data wp-content/
It’s all for now, the new wordpress container should works with no problems.