How to run a wordpress.com hosted website locally using docker? - wordpress

Currently we have a WooCommerce webshop hosted on wordpress.com. This webshop was setup as a prototype and because of its succes we want to start developing the webshop further. We don't want to change the production website directly, but we want to develop inside a closed development environment (e.g. locally using docker).
I have tried to run the webshop locally by exporting all its data using the All-in-One WP Migration plugin. Afterwards I have created a docker environment with a wordpress and a mysql container. On the wordpress container I've also installed the All-in-One WP Migration plugin and I've imported all the data. It looked like this worked fine, but after a few clicks I saw that I could not navigate to any other URL besides the homepage. I have read online that the Wordpress codebase being used on wordpress.com differs from the default codebase which can be download on wordpress.org. So I think this means the wordpress.com export file can't be imported into a default wordpress container.
Because of this I've tried to download all the files on wordpress.com using FTP and run the website myself using a php container. This also didn't work, because I can't download all the files using FTP because of the permissions. I also contacted the support of wordpress.com, and they told me they couldn't sent me the contents of these files. But without these files, I don't know how I can run the wordpress.com website locally.
I hope someone can help me with getting the wordpress.com website to run locally in a development environment. A suggestion how we can implement a workflow where we can change the webshop in a development environment and deploy the changes to our production website is also very welcome.
Edit: For now I've chosen to run my site in a docker environment and write down all the changes I make locally. When I'm satisfied with the site locally, I will repeat the changes I made earlier on the production website. I've chosen this workflow because I don't really know the structures inside Wordpress. I don't know how I can migrate the files and database tables I need to switch theme, without overwriting the database tables I want to keep (e.g. WooCommerce orders table).

Have you tried running it on a localhost? MAMP is a good option for this.
https://www.mamp.info/en/

Related

Changing Wordpress Theme in Staging Environment

I have a live newspaper WordPress website with about 10 users updating it daily with about 2000+ unique visitors a day. I have a sum of about 30 posts a day added to my db and i host my own pictures.
My goal is to change my theme that has been used for over 4 years so smoothly that I don't experience much hiccup for my viewers.
I want a dev environment somewhere in my server that I can test my new theme with my current posts.
A solution I have in my head is to create a subdomain for example "dev.example.com" and deploy the new theme there and have two working wordpress themes with one database.
Is this even possible? I need to have my new theme that is in a dev environment have access to my live database.
What is the best practice for this situation?
for people looking into this like me, I will post my findings below and if you like you can comment to guide me or tell me what I'm doing wrong or right.
there is a wp-staging plugin that can be used but it seems to be paid if you want to push changes from staging version to production version of your website.
I have also figured out that another wp website can be installed on a subdomain that you can create through cpanel and install a brand new wordpress environment that is completely separate from your live site with its own db and config.
Since most of us don't have unlimited server resources its going to be pretty heavy to clone everything from live site to staging site and I figured they cant share a db because changes made to staging site can effect live site if they share a database.
So I looked over a very well summarized easy youtube video which basically explained the whole process for cloning your wordpress on your subdomain and using a new db, but this solution can be good if you have the server space and resources, for a website like mine i would guess that a local installation of wordpress would work.
One of the comments on that video was very usefull as well:
Just create a subdomain, install WordPress with Softaculous on the subdomain, install the All In One WP Migration Plugin on both the main site and the subdomain, export the file in All In One WP Migration on the main site and import it to the subdomain and vice versa, you have your staging.

Deploying First WP Site with Understrap, Can't Find Required Resources

I've transferred my database and entire Wordpress file structure over to the live site, but the live site is still looking for all its resources at localhost:8888/.
I looked back on what I did when getting started and I edited my gulpfile.js to include
var browserSyncOptions = {
proxy: 'localhost:8888',
notify: false
};
Thinking this was the issue, I switched it to proxy: $_SERVER['DOCUMENT_ROOT'], but still no luck. Any ideas for what I may be doing wrong?
Unfortunately I haven't been able to find a single bit of information about deploying an understrap themed site. Here are the docs for the theme though: https://understrap.com/demos/core/wp-content/themes/core-understrap/docs/.
I've transferred my database and entire Wordpress file structure over to the live site, but the live site is still looking for all its resources at localhost:8888/.
That is an easy to way to get into live server maintenance hell. UnderStrap is a unique theme package because it has strong npm dependencies running in the back-end that are appropriate for localhost development builds. For that reason, Here is an alternative approach I recommend instead.
Install a clean vanilla version of WordPress on your live server.
Install and activate UnderStrap.zip on your live server through wp-admin.
Import/Export your posts and pages from your local site, onto the live site. Add all media images. Adjust your settings, install your plugins, and clear your cache.
Now use the file manager in your C-Panel to only upload all modified theme files from your localhost to your live server.
Test your site, then go live.
That is more of a manual process, but it has its benefits. For one, you learn and see what each step looks like, you push up only what you need, you don't have localhost decencies running on your live site and the database is 100% targeted on live site content.
If you can access the wp-admin of your live site there's a great plugin called Velvet Blues Update URLs that you can install.
Install it, go to Tools > Update URLs and enter the localhost address and then the live site address.
Always works great for me.
Many developers have done this process by running its gulp dist when processing deployment. It will create dist folder which you can upload on the server. It contains all necessary files that supports running the scss. So try to use also the gulp dist-product as a "product" that the theme can be published and downloaded in the near future.

Developing on plesk

Trying to figure the best way to develop on plesk.
I would like to develop my wordpress website on a temporary url, and attach the production domain only when I am done developing.
From some reason I'm getting various dns errors, saw a guide referring to change of hosts file but it dosent seem like the perfect solution to me.
Any tips?
You may create the clone of your WP instance (staging) and use Plesk Git extension for developing this staging WP site. After making all necessary changes on staging non-public clone you can publish it to a production domain to make it publicly available.

Wordpress development/production sites in parallel

I have a production Wordpress site, but in parallel I want to run a development site. Once I am done with the development, I want to deploy it to the production site without ruining the current site regarding, users, comments, etc.
My current solution is to duplicate the production site, and re-install again- but than I can lose information.
Did not find any solution that can do it.
Any suggestions?
If you are developing a wordpress-theme/plugin, you can just dump the live-db, replace the domain and use it in development. After you finished developing, you can dump it again, insert/update your content for production, deploy only your theme and replace the db of your production environment with the one of your dev-environment
If your site has already go public, things will be more complex. I suggest you setup a maintenance mode and then dump the db to development site.
If you are developing theme/plugins, you can just upload the theme/plugins files. Leave the data in the dev site.
If you are modify the site through wp-admin(change theme/plugins settings), you have to upload the db data.You don't need to dump all data, for example, you don't need to dump the dev site's comment data and import to production site. But this way, you must know WordPress database schema very well.
Always, backup your site before you do any changes.

What files need to be overwritten to move an active WordPress site to a local version for development?

I want to take the files from an active online WordPress instance and develop on my local machine. I will only be doing front end development so I don't need any database other than my local dev environments which is a MAMP stack.
What folders and files do I need to pull from the online version to add to the local version?
An obvious example would be the 'Themes" folder , but what else? What is the full list? Is there a list of these items online?
Thank you.
You may have a look into wordpress plugin Duplicator meant for taking backups or transferring entire website from one location to another.
http://wordpress.org/plugins/duplicator/
The plugin page also contain short tutorial on what it is capable of..
You just need to get a theme on which you are going to work from the themes folder.
On your local machine have the same wordpress version installed as on live and install all the plugins that you have on live wordpress.
In this way you`ll only need the theme folder and nothing else for development.

Resources