Setup for Production and Development Environment when most of your "code" is in the database? - development-environment

I want to set up a production and development environment for a wordpress website. The Wordpress site uses a lot of plugins. These plugins consist of php files which I upload to a directory within the main wordpress directory.
When activating and modifying the plugins, much of the configurations are stored in the mysql database. Developing on wordpress means much of my "code" and "changes" are stored in the database, as opposed to physical files that can be committed to and updated from a CVS repository. So instead of having a CVS keep track of my changes, I have to frequently and manually do mysqldumps of the database on production and import it into the development server.
Is there a better way to set up a development and production environment where much of the development changes are happening in the database?

Use CVS's hooks to perform the dump whenever you commit. I'm not familiar with how CVS does them, since I've only done it with SVN. However, from reading a bit of the manual, it seems pretty similar.
This section of the CVS manual explains what happens, script-wise, when you commit. Take a look at the section further down, "C.4.4.2 Keeping a checked out copy". You should be able to modify this example to put in your mysqldump command.

Related

Deploy Typo3 database changes

I wonder if there is a good way of deploying database changes made on a typo3 website (on dev) to a live website?
In Magento for example there are folders containg sql install statements (for the structure, new tables etc.) and data install scripts (inserting data into the tables).
These scripts are automatically executed when deployed to live.
Good ways of getting rid of manual database adaptions are welcome.
Thanks!
cweiske explained it well, for common admin it's enough to know that Install Tool has Database Analyser > Compare functionality, which is dedicated for handling DB schema differences.
TYPO3 extensions have their ext_tables.sql files which define the database structure they need.
When installing the extension, the necessary database structure changes are made by the TYPO3 extension manager. You can also apply the changes yourself by using the install tool -> database update.
So as long as your extensions have the correct table definitions, you're fine and can rely on TYPO3 to update the actual database.

How to use APC on a periodically updated system?

we have a system written in PHP stored on the production server. We have APC installed also.
Our system uses a special local repository on Mercurial and is periodically updated - some scripts are modified by developers, according to customer demands.
But as far as I understand, the APC cache will store the old versions of the files being modified? Does this mean, that the process of updating should look like this:
Pull the latest changes from repository.
Update the system.
Execute
the script in order to force APC clear it's cache.
I ask this because I don't understand the mechanism that APC uses. Does it calculate a checksum in order to see, if the scripts have been updated? Or it cannot handle such a situation and I will have to clear cache manually?
APC will by default check file for changes and update automatically.
No need to do anything manual.
On very high traffic apps It is possible to set it not to check for file changes but the time it takes APC to do the test is negligible so its probably not what you need.

How to set up a stageing-enviorment for wordpress/wordpress mu?

I have a wordpress mu-site. I need to set up a test-version of it so that the client can run test on the changes we make, test the plugins with new updates etc.
Anybody who has worked with wordpress know it's a bit off a hassle to move between servers and/or domain-names, due to the absolute paths used. Does anybody have a good solution how to create a stage-enviorment of wordpress?
Here's how I do it + some adjustments I want to make:
Two WP installs on identical environments - dev & production
They each have their own FQDN
Version control (SVN in this case) to handle merges from dev to production
When merging, I don't ever merge database changes. I only merge code, and modify any of the domain specific things during the merge (which really should only be in the DB.)
Recreate any DB changes needed during deployment
There are other ways to do it, but they often require changing the hosts file or access to internal systems. So if you want to be able to show an external client a site, then those methods aren't likely to work.
I also sometimes copy the DB back from production to dev, and just do a find & replace for the FQDN.
You can also dev locally and use the above listed method for staging only.

How to set up a Staging Environment for Existing Sites? Esp. using subdomains?

I have about 5 sites where till date all development changes have happened directly on the live server, where the change would be made on a test file first and if ok, would replace it with the original file.
However, I can't really continue with this approach now because the site has become quite complex and testing changes usually involves changes to DB as well. I will also be having some outsourced developers working on the site. So now need to figure out how to set up an environment such that the dev. team can make changes to a test environment running perhaps on the same server, as a subdomain on the main domain perhaps, but not sure how to go about it.
Our sites are hosted on a single dedicated server with WHM/Cpanel setup. Now,
a) how do I go about creating a staging environment where they have access to the latest files and a db copy of the live db?
b) how do I track what all files they've changed/updated, so that I can then copy them to the live server and upload?
Is there some other approach I can/should consider? Am not really sure how to go about this.

Joomla 1.5 Site Backup Strategy

I would like to make a complete backup of my whole joomla 1.5 based site from time to time. How would this ideally be done? Are there any common pitfalls? Not that I only have ftp access to the hosting server. Is there a step by step tutorial somewhere? I am using latest Joomgallery and Kunena 1.0.9 (Legacy mode).
Maybe there is a good way to automate this?
There's two parts of the backup you have to worry about, the database and the files.
The first part is the database. It can be backed up using something like phpMyAdmin. If you don't have this available on your server already, it's not too hard to upload and get it going yourself. From there, you can just Export the entire database to a gzip file.
The second part is the code and uploaded files. The code base shouldn't change too often, so you could probably just make one backup of this. There's a number of ways. The simplest is to just download the entire folder via FTP, though if you're Linux, I'm sure someone will know a single command line to get all the changed files (rsync?).
The database is the main thing you have to worry about though: everything else should be able to be rebuilt just by reinstalling.
I think this: http://www.joomlapack.net/ is what you need. I use it myself and it works like a charm. Both for backups and for moving my Joomla installations from developer sites and to the real site.
get an FTP synchronisation tool and keep an up-to-date copy of your site locally. Then you could run the batch script
mysqldump -hhost -uuser -p%1 schema > C:\backup.sql
to create a backup of your mysql tables at various points in time.
edit
you would have to have MySQL Server installed on your local machine and path to its bin directory in you PATH, in order to run the mysqldump command without much hassle. -p%1 would take the command-line provided password, as you wouldn't want to store passwords in your batch script.
If you only have FTP access you are in a bit of a problem, as beside all files you'll also have to backup the database. Without accessing the database, a full-backup won't do you any good.
Whatever backup strategy you choose - be sure it can handle UTF-8 correctly. Joomla 1.5 stores all content with UTF-8, even when the database charset is set on 'iso-5589-1' - so when the backup solution is detecting the database charset, some characters like € or é will result in "strange" ¬ / é - not really what you'll want.
I absolutely endorse using Joomlapack - it works great. The optional remote tools allow you to initiate the backup from a Windows desktop machine - it performs the backup and downloads it. The remote has a scheduler, and you can also set it off to backup and download a list of sites.
Joomlapack also provides a file "kickstart.php" which you copy to your empty server account along with the backup, which automates the restore procedure. You do have to create an empty database with PHPMyAdmin or similar, and you are given the opportunity to supply the database parameters (host, database, username, password) during the process.
One pitfall I did run into with this though is that some common components can have absolute URLs in their configuration - e.g. SOBI2, Virtuemart. It's then just a matter of finding the appropriate configuration file, editing it and re-uploading it.
Another problem was one archive file (either ZIP or their JPA format) got a filename with a "?" character in it (from a Linux server) and this caused a bit of a problem trying to install it locally on a Windows WAMP stack - the extract process on the ZIP file failed, and it stopped the process completing cleanly.
I suggest using automatic backup service by http://www.everlive.net
Update:
Ok, here is some more information. EverLive.net is a website where you can create a free account. Enter your website details and you are ready to take your backups withe just one click. Restore is also possible in the same way.
Further you can use automatic backup option to take automatic backups at defined intervals. Other than that, you can use the website health check service to inform you if your website is not available.