How to deploy with Wordpress

Asked

Viewed 757 times

2

I want to increase the agility of my projects made with Wordpress. I usually use the git just in the themes. When everything is ready, I raise the theme in the traditional way, by FTP. Of course, I know it’s wrong and that’s not the right way to proceed.

My question is: should I see all the code of Wordpress and deploy it the same way I do with Ruby on Rails or just do theme versioning but do an automated deploy of it individually?

My question is why the development team of Wordpress launches updates with a certain frequency... and it is always advisable to keep it updated. How would I handle it? Every time an update is released I will have to make a new deploy with the new version for all my customers?

2 answers

2


The first thing you need to keep in mind is: I need to see the core of ?

You won’t have a problem with the deploy, as it will treat the project as a whole. For this, keep in mind that any automatic update or editing through the file editor Wordpress can bring conflicts in the structure of . To avoid these conflicts, there are settings that can be performed to prevent this:

  1. Disabling the Plugin and Theme Editor:

Example: define( 'DISALLOW_FILE_EDIT', true );

  1. Disabling automatic updates:

Example: define( 'WP_AUTO_UPDATE_CORE', false );

You may also need to add filter to avoid updating of plugin or themes:

add_filter( 'auto_update_plugin', '__return_false' );
add_filter( 'auto_update_theme', '__return_false' );
  1. Create a branch for each core update:

As the updates will not be performed automatically, each update you should do it manually (yes, that’s right). I find it particularly costly for the process.

  1. Some files should be on .gitignore:

Files like wp-config.php, and directories of uploads and upgrade must be outside the scope of versioning.

  1. Stay tuned for local settings:

Having more than one environment, there is a greater concern regarding the environment variables that will be in the wp-config.php.

All these and other tips I found in this article (very interesting): Keeping Wordpress Under [Version] Control with Git

About the deploy itself, the @Ivanferrer response has a link with more information.

1

You can do this through an online account, with the Github or the Bitbucket. This video guides how to do.

First create the versioning of your project on your machine and then clone your project on the remote server:

git clone user@servidor:/caminho/para/o/repositorio

If you haven’t cloned an existing repository and want to connect your repository to a remote server, you should add it with:

git remote add origin http://seu-endereco-repositorio.git

Once you have your repository launched, to deploy automatically follow this tutorial.

  • Yes yes... But what about core updates? For example. I have my repository there in production, beautiful and functional. A core update comes out. My client goes there and clicks to update. There will be changes in some core files, even a few. If I try to deploy automatically by pulling in my repository, it will be a problem because the changes have not been committed. My biggest question is this. With many customers it is unfeasible to leave site on site checking if you have updates not committed :/

  • You can add these settings to your . gitignore (https://gist.github.com/epeli/4c34d665d26cd8d8ea83d7d06b423e66)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.