wordpress deploying solution, ideas? - wordpress

I develop on a local machine a Wordpress site and I'm now looking for a mechanism to deploy it easy and fast. I'm thinking about a DEV environment (located on my local machine), a STAGING environment (a subdomain on the client page, maybe staging.example.com) and of course a LIVE environment (example.com)!
My current workaround:
As I work with Aptana I'm able to sync my changed files with the deploy mechanism the IDE provides. Exporting my local database, finding/replacing the permalinks and importing the whole thing - finish! To deploy live, I have to replace all staging files with the live files.
This should be easier! Is there anyone out there, having a better workflow?
I'm open and really excited about your ideas!
Thanks a lot
greetings

Yep, it's frustrating and completely insane that Wordpress requires this process because they put absolute urls in the database. I develop in a similar fashion using multiple staging sites for qa and client review. After my first deployment with Wordpress I almost gave up on the platform entirely. All of the solutions recommended by core developers and others simply didn't work.
So I wrote a plugin: http://wordpress.org/extend/plugins/root-relative-urls/
that fixes the problem. With this plugin you don't need to do a search & replace on your content. No hosts file hacks, or dns tricks. With my plugin you can access the site via IP address or Computername or any type of forwarded host. And since it converts urls to root relative before they enter the database, you won't have to worry about them working between the different domain formats. And since they don't hard-code the scheme (http/s) in the url you won't have to worry about the 520 or so bugs that were reported in the wordpress trac database if you use SSL.
It's a staple for any wordpress project I work on these days. And I have written a couple other plugins to deal with idiosyncrasies that exist in the platform that you can check out here: http://wordpress.org/extend/plugins/profile/marcuspope
Hope that answers your problem.

I use Capistrano https://github.com/capistrano/capistrano/wiki/ for all my deployment needs and it is really good solution. You can simply script anything and it just works.
It could work for your deployment scheme too.

I also use Capistrano for both WordPress and Drupal deployments. I typically install modules locally for testing then push to test and production environments. For uploads, etc. I add custom tasks to manage syncing files stored in scm and those that are not. Here is a simple guide I put together.
http://www.celerify.com/deploy-wordpress-drupal-using-capistrano

Related

Migrating structure and content between instances in Drupal 9

I'm very new to Drupal, so please don't be too mad in case I have any major misunderstandings :) I've tried searching for a similar problem, but is just couldn't find a suitable solution for my case.
We're currently setting up a Drupal 9 project, which will perspectively have a shared development environment and a production environment as well as a local instance to develop on. I'd wish to have a way to synchronize those instances to have the same configuration, content types and optionally even content.
At the moment, I'm developing a theme locally, which means I have installed a Drupal instance inside a XAMPP server. That theme is versioned by git, so it is migratable to another developer without a problem.
For migrating the structure and content (which is obviously saved in the database), I tried using Backup & Migrate, but there were two issues I was facing: The D9 version is not fully supported yet, so an installation via composer fails with default security settings, and there seems to be an already multiple times reported bug when trying to backup the entire site. You can workaround it by backing up the database and the files separately, but this is pretty inconvenient due to other issues (but let's keep it a little short...).
I also tried to export the whole database, which is actually working (after this little fix), but the overhead seems a little high for me. Especially when I just want to copy new content types from dev to prod environment without users, content and so on, for instance.
So, to finally come to an end, is there any best practice for this case? Or should I even consider to go a whole other way?
Thanks in advance!
I definitely wouldn't recommend using Backup & Migrate for this - that's so Drupal 7! Drupal 9 has better tools that are baked into core!
There are many possible ways to import/export Config and Content entities across environments, but I'll share what I believe to be the current best practices.
For Configuration, Drupal 9 has a built-in Configuration Management system that makes it quite easy to migrate Config across environments. It can be used within the Drupal UI, and also integrates with Drush (a command-line tool for Drupal).
Essentially, the Config system exports all Config settings as standardized YAML files, which can easily be included in your Git repository. This will make it incredibly easy to set up another Drupal environment that is identical in its Config settings.
More info on Configuration Management can be found here.
For Content, Drupal 9 has a built-in Migrate API, which facilitates migrations from any data source into a Drupal 9 environment. That means you could set up a migration that would allow you to migrate your Content entities across environments.
I've only ever used this for migrating Content (migrated from Drupal 7), but I believe it's also possible to use this to migrate Config as well.
If you decide to use the Migrate API, you may (depending on the setup of your content) need to install Migrate Tools and Migrate Plus.
More info on the Migrate API can be found here.

Subversion with Git and Wordpress

Good day Experts,
I need to implement subversion on our WordPress websites.
I have never worked with Subversion before. I have however read-up on it and understand the principles.
We have a Development environment consisting of only one server hosting multiple (about 10) WordPress websites. Then we have a Production Environment that consist of 2 servers, one hosting only the WordPress Files, and the other hosting the WordPress databases. The production Environment is the live environment and we want to completely stray away from making any changes directly on here before it has not been tested via the Development Environment.
I need to implement subversion to basically track the changes on the development environment (obviously with functionality to roll back to a previous version if something goes wrong) and then to make it quick and easy for the team to publish to the Production Environment without having to use FTP – may I add that the sites is about 6GB in size on average. Also as it is the design and development team that is going to work with this it would be nice to have a GUI to work from. (I think they are going to give me grey hair if I need to train them on using console commands.)
Our hosting provider supports SVN and Git. I only have been looking at Git and like I said I understand the principles.
But what I cannot get my head around is how to implement this in our environment. Keeping in mind that this is WordPress Websites and that the Production Environment consist of 2 different servers. Like how do I push the database over to the production environment to a different server than the files?
Sorry if this is maybe stupid questions, but like I said I have never worked with any form of subversion before.
If anyone can send me in the right direction on how I could implement this. It would really be much appreciated.
Thanks in advance.

For wordpress, Is it better to develop live or locally?

I am developing website by using word press. Now I am developing in live directly.
I recently get to know we can develop in local-host also. But I don't know which method is preferable and how to develop locally. If developing locally is good. Could you please suggest me the process too.
If you are developing your site in localhost. That's ok. But now problem arises here:
Uploading local site to live will be large time. Suppose that your site is about 150MB. Then it will take long time to upload.
Second problem is that all your featured image, media uploaded file or plugin may be reinstall again. Not sure, but may be.
You will have to change each path that you defined in localhost.
But if you are developing your site in live. Then it's very good.
Simply 4MB or 5MB wordpress files will not take long time.
There is no need to change any path
Since I am a wordpress developer so, I will prefer you to work on directly in live env.
Any help regarding this topic will be welcomed.
IMO, this really boils down to the characteristics of your Internet connection. If your connection is slow/unreliable/expensive, it would be better to develop locally first and then migrate to live when the dev work is completed. If the connection is not an issue, you can save yourself the trouble of migration by developing directly on live.
Another case in favor of live dev is if you need to show/share the work in progress with a client/others.
Finally, if/when you need to do local to live (or any other type of) migration, you can use this (excellent) plugin - works like a charm:
https://wordpress.org/plugins/duplicator/

Handling Git Deployment (WordPress)

So, like most of you, I develop my sites locally using MAMP. I've recently been learning git and in doing so, preparing to drop FTP from my workflow completely.
Though, I was wondering if there's a best practice for handling WordPress' databases.
Currently I'm only using version control on my current theme, but would like to expand this into controlling the whole site locally and pushing it to the server accordingly. That means making changes to files, adding posts/pages and generally mucking around with the whole site, keeping both local and remote site in sync. Is this possible?
I've read tons of guides over the past week, and followed countless tutorials, so any help would be appreciated.
Thanks in advance!
This is not really feasible, git is for file changes, not for your database. Due to how WordPress stores data in the database you cannot sync content without custom scripting (bash, ruby, etc) aka... jumping through hoops.
You can dump your database file using cron and throw it into git, but again you cannot sync the files due to how WordPress stores values.
This has been asked on https://wordpress.stackexchange.com/

How to develop wordpress site collaboratively?

For simple projects, it is suffice enough to use subversion to synchronise theme/plugin code between team's Wordpress installations. However, with larger projects, in which themes/plugins are content dependent, content needs to be synchronised as well. Is there a way to do it automatically instead of using Import / Export tools from Wordpress?
You can set this plugin to an hourly backup: http://wordpress.org/extend/plugins/wp-db-backup. It can send backups to email, save them on server or download them on your machine (if done manually). Content is saving its revisions anyway so I don't think you'll have problems with that.
SVN for the files sounds actually pretty neat, even without having other people working on your WordPress installation, but can you install svn client on a shared hosting? If you got a server of your own, this won't be an issue for you.
Hope this helps you a bit!

Resources