Copying content from dev to live sites in Drupal - drupal

We have several Drupal 6 sites. On most of the sites we will have some content editors, who will optimally log into a dev/test site and create content. Mostly just plain vanilla pages. What is the best method for migrating these newly created pages to the live server? I know there is the Deploy module and also Backup and Migrate. Are these the de facto standards? I was wondering if there is anything else I might be overlooking or if there is a better/easier solution. I am ONLY interested in moving content. We will be using GIT to move code and the Features module to migrate admin changes.
THANKS

In the past I've used node_export and recently I've found (in drupal 7) that the uuid module is invaluable. It means you can keep a track of content even if the nid's change as you move it over.
There are some legacy modules hanging around too that did an okay job but their functionality has really been surpassed by the modules you mention and the ones above.
If you're creating all your content using fields added with cck, you shouldn't have a problem. I personally use node_export along with features to allow easy importing and updating.
One gotcha you might want to look for on node_export is when importing on the new site, if a node is found with the same uuid (i.e. you're doing and update), the default is to create a new node. I prefer to create a new revision. Worth tracking down that setting (it's there in d7 so likely in d6 too).
EDIT: node_export doesn't currently export panels very well if at all - just in case.

It depends on the structure and diversity of the nodes (how many fields of which type, how many node types). My first try would be to generate a view with XML output (views_datasource.module or views_data_export) on the dev site and use the feeds.module for XML import on the live site.
The above XML export modules are avalable for D6 and D7. In Drupal 6 I used views_bonus.module for the XML export.

Related

CMS - How to work with multiple environments? Do I really need them?

I've never worked with any CMS and I simply wanted to play with such ones. As originally I come from .NET roots, so I was thinking about choosing Orchard Core CMS.
Let's imagine very simple scenario, together with my colleague I'd like to create a blog. As I'm used to work with web based systems and applications for a business for me it's kinda normal to work with code repository, having multiple environments dev/test/stage/prod, implementing CI / CD, adjusting database via migrations or scripts.
Now the question is do I need all of this with working on our blog with a usage of CMS.
To be more specific I can ask few questions:
Shall I create blog using CMS locally (My PC) -> create few articles and then deploy it to the web or I should create a blog over the internet and add articles in prod environment directly.
How to synchronize databases between environments (dev / prod).
I can add, that as I do not expect many visitors on a website I was thinking to use Orchard Core CMS together with SQLite. Also I expect that I can customize code, add new modules, extend existing ones etc. - not only add content (articles). You can take that into consideration in answering the question
So basically my question is what should be the workflow of a person who want to create / administer and maintain CMS (let it be blog) as a single person or as a team.
Shall I work and create content locally, then publish it and somehow synchronize both application and database (database is my main question mark - also in a context how to do that properly using SQLite).
Or simply all the changes - code + content should be managed directly on a server let's call it production environment.
Excuse me if question is silly and hard to understand, but I'm looking for any advice as I really didn't find any good examples / information about that or maybe I'm seeking in totally wrong direction.
Thanks in advance.
Great question, not at all silly ;)
When dealing with a CMS, you need to think about the data/content in very different terms from the code/modules, despite the fact that the boundary between them is not always completely obvious.
For Orchard, the recommendation is not to install modules in production, but to have a dev - staging - production type of environment: install new modules on a dev environment, test them in staging, and then deploy to production when it's safe to do so. Depending on the scale of the project, the staging may be skipped for a more agile dev to prod setting but the idea remains the same, and is not very different from any modular application.
Then you have the activation and configuration of the settings of the modules you deploy. Because in a CMS like Orchard, those settings are considered data and stored in the database, they should be handled like content. This includes metadata such as the very shape of the content of your site: content types are data.
Data is typically not deployed like code is, with staging and prod environments (although it can, to a degree, more on that in a moment). One reason for this is that a CMS will often feature user-provided data, such as reviews, ratings, comments or usage stats. Synchronizing all that two-ways is very impractical. Another even more important reason is that the very reason to use a CMS is to let non-technical owners of the site manage content themselves in a fast and direct manner.
The difference between code and data is also visible in the way you secure their changes: for code, usual source control is still the rule, whereas for the content, you'll setup database backups.
Also important to mention is the structure of the database. You typically don't have to worry about this until you write your own modules: Orchard comes with a rich data migration feature that makes sure the database structure gets updated with the code that uses it. So don't worry about that, the database will just update itself as you deploy code to production.
Finally, I must mention that some CMS sites do need to be able to stage contents and test it before exposing it to end-users. There are variations of that: in some cases, being able to draft and preview content items is enough. Orchard supports that out of the box: any content type can be marked draftable. When that is not enough, there is an optional feature called Deployments that enables rich content deployment workflows that can be repeated, scheduled and validated. An important point concerning that module is that the deployment only applies to the subset of the site's content you decide it should apply to (and excludes, obviously, stuff like user-provided content).
So in summary, treat code and modules as something you deploy in a one-way fashion from the dev box all the way to production, with ordinary source control and deployment methods, and treat data depending on the scenario, from simple direct in production database instances with a good backup policy, to drafts stored in production, and then all the way to complex content deployment rules.

Keeping track of Drupal site configuration changes

I am developing Drupal sites sometimes. This development involves writing custom module and of course lots of configuration work on the admin interface.
I keep track of my custom module using SCM (git of course..). Unfortunately the configuration of all the drupal modules is even more important and fragile. These settings are spread in the database and therefore cannot be easily kept track of.
I create backup of my development DB on a daily basis, but having realized that something went wrong it is a pain to compare the backup with the actual state to hunt for differences.
Do you have any best practices or suggestions how to do it professionally? (I still use Drupal 6 if that matters, but I'm interested in new features of the 7 and 8 versions as well) I read about the Feature module that is very promising, but not exactly what I need.
My first ideas were (1) a module that would store all the settings in files that can be tracked with SCM easily, or (2) some automatism that would export the tables into files every time something changes
More and more configuration can be moved into SCM as time goes by.
At the state of Drupal 7 some people start developing their sites as an installation profiles. E.g:
http://walkah.net/blog/every-drupal-site-install-profile/
Features are another way of tracking changes and usefull to change configuration over time, e.g. when several people working on a site and want to share their configuration which they build on their local dev machine. The usability of features can be enhanced using ctools and drush (See Drush CTools Export Bonus module as if you take that route).
For quick import/export of Node types, Taxonomy, User, Field API fields and Field groups http://drupal.org/project/bundle_copy seems a good option.
Here is a good blog post about the different options: http://palantir.net/blog/multi-headed-drupal
With Drupal 8 we'll see a big shift in configuration management as configuration export will be built into core. There are several core initiatives and one is the configuration management initiative. A backport of some of the functionality is available as a Drupal 7 module.
Besides this a way I like to handle things when working is to note the things I have changed with my time or in the issue tracker of the projekt I am working on.

Dot net nuke without module development?

*This is more of an architecture level question.
I am new to DNN development , we are trying to build an e-commerce site which will showcase all the products which will be tied to our current order database.
Am I wrong in assuming that any custom development that I do via DNN would be in MODULE form ? I created few custom module (i.e. list of products) which would tie to database in code behind and display data from SQL. This seems to be very heavy approach if I have to make modules for every functionality.
Is there a better way here ? Can I (is it recommended) to directly change the DNN pages to accommodate this type of functionality ?
UPDATED
Is it possible to do development without moduels ? i.e. provide code right in the html text editor or something. If i create new module from DNN template then it adds many files ....that is why it feels heavy
It is strongly recommended that you not directly change DNN. This will make it very difficult to apply upgrades to DNN and cause headaches for whoever maintains the site after you.
The main extensibility point in DotNetNuke is the module. The module is just some executable controls that you can place on any page. It shouldn't be significantly heavier than any other approach you would take. Whatever you want to do in DNN itself, you should be able to do in a module, and just place the module on a page.
You could also potentially have some of your functionality in the skin, rather than the module, if that is easier or makes more sense. Generally, the skin has functionality that is shared across most pages in the site, and module are used to place specific content on specific pages.
If you're looking for something simpler, you might try using the core reports module, which will allow you to style the results of a query from the database (if you don't need the interactivity that a module would provide).
Your good options are as follows
Build a separate Web Application for your e-commerce, but provide heavy inter-linking with the DNN site. With this method, DNN would be used for content.
Purchase a third party e-commerce module-set like SmithCart and try to configure it to meet your business model
Build custom DNN modules
Our current project utilizes option #3. We have 25,000 products and about 3,000 product listings with heavy customer-customization functionality.
While it might seem heavy, as in, a distinct module project per section of e-commerce, it doesn't have to be too complex.
Example Modules:
Product Listing
Product Details
Shopping Cart
Order Checkout (we split this into 4 modules)
Search Module
Search Results Module
You can use URLRewrites to map all your products to the same DNN Page/Module.
As a result, we really have very few non-content DNN pages.
In summary, it might feel a bit heavy, but with the proper design it can go rather smoothly in comparison to a separate web app.
There are ways to use existing DNN features without module development. You can do it by adding a sub application in your folder.
For example, you can look at http://www.firstphera.com/GiftRegistry/Index.aspx, FirstPhera.com is a main dnn application and folder GiftRegistry is a pure asp.net sub application that uses dnn's providers to deal with database. Custom implementation of registration and login was the only thing that was challenge, everything else working fine.
But If are building an e-commerce application, at long term you will get benefit from module development way.
It is not strictly necessary that you create separate complected module like you shown in screen shot. If you look at blog module, it has feature like latest blogs, search blog, archives etc are all implemented in single module.
It is also possible to create a single module with related features in dotnetnuke using the technique called ModuleDefinitions. Look http://lakhlaniprashant.blogspot.com/2010/04/dotnetnuke-what-is-module-definition.html.
I would strongly recommend to visit NBStore source code if you want to understand the e-commerce related module development in detail.
Please let know if you have any other question.

Versions of Drupal content

I'm working at a company that uses Drupal 6 to host documentation for it's SAAS products. The documentation is organized in various books using Book.module.
We have a Production Drupal site with the documentation for the production SAAS product.
Secondly, we have a "Preview" site, for the upcoming version of our product - the documentation is slightly different than on the Production site.
Thirdly, we have a "Development" site, which contains the unstable version of our product documentation. The documentation here changes frequently
Documents are originally authored on Development, moved to Preview, and then finally to Production.
It's quite unwieldy to manually update each Drupal site as our product evolves. I've looked at Deploy.module, and although it looks promising, it has limitations wrt books (ie: it can't handle the book structure/menus). It also makes for a solution that is quite complex with lots or moving parts.
I'm hoping that I've been over-thinking everything and some Drupal rockstar out there can point out an obvious (or not-so-obvious) solution.
(An obvious non-drupal solution would probably just be store the documentation pages as html in version control and update each site with the appropriate revision. But with this I lose the ACL functionality that Drupal is so good at.)
Thoughts?
Cheers
I've had good luck with the Feeds module to get one site to consume a certain view from another site when I choose or periodically. It will take some configuration work to get going but it's more flexible than a turn-key solution and it's less fragile than any SQL dump -> import of the node revisions table.

Working with version control on a Drupal/CMS project

I was wondering how teams that develop sites using Drupal (or any other CMS) integrate version control, subversion, git or similar, into their workflow. You'd obviously want your custom code and theme files under version control but when you use a CMS such as Drupal a lot of the work consists of configuring modules and settings all of which is stored in the database.
So when you are a team of developers, how do you collaborate on a project like this? Dumping the database into a file and putting that file under version control might work I guess, but when the site is live the client is constantly adding content which makes syncing a bit problematic.
I'd love to know how others are doing this.
You are correct that this is an issue for Drupal--version control works fine until you turn the site over to your client or open it up to users.
Your question seems like a more specific version of this one, which touched on version control in the Drupal workflow. You may find some answers there that help.
For some projects, I have exported all of the views to code, using that feature of the Views module, and I have one project where all of the blocks have been exported, as well. (Although that was a development exercise and not a customary thing to do with blocks.)
Take a look at the work that Development Seed is doing to work around this problem. They are leading the development of the Context, Features, and Spaces modules that work together to store configuration data in modules (outside of the DB) so that it can be versioned with the code.
There is a Drupal group called Packaging & Deployment for discussing the various solutions that are being developed for this issue.
Right now there are a lot of efforts towards creating something that will handle the dev -> production difficulties with drupal in relation to the database. Features, that flaminglogos mentioned is one, but I feel that is more focused on creating stand alone projects, ie ones that would be installed on many sites.
For simple maintaining you dev and prod databases I'd take a look at http://drupal.org/project/deploy and http://drupal.org/project/dbscripts. They support syncing and merging db side drupal config data.
I can't guarantee they are ready for prime time though...
There is a lot of effort of shipping the next drupal version with configuration in code. That's is the key to have it in a version system.
For now you can use the features module, with that you can export things like content types, views, etc. to code, and then compare, version and revert it as you need.

Resources