How do I repack an existing site into Open Source repo with bundled content and configuration? I have been tasked to repack an existing live Drupal 7 site, that will go out of commission, to make it available as Open Source on Github so anyone interested may find some use of it.

This will require that the repository comes with a database dump containing an example configuration and content.

What I need to do is to first anonymize the database from usernames/passwords, and also remove any not needed old revisions of existing content to compact the dump.


Is there any best practice strategies for how this can be done as simple as possible, and in the documentation provide a simple step-by-step guide on how to install it using the database dump?


Please note: While a Drupal Distribution would be optimal, in this case the wast amount of extra work, and testing, required is not possible.
You can anonymize some content using drush and the sql-sanitize command found in Drush by default:
https://drushcommands.com/drush-8x/sql/sql-sanitize/

If that doesn't clean up enough of your content to be suitable for Open Source release, you can use the underlying hook drush exposes for this task and implement it for your site as seen in this blog post, https://www.codeenigma.com/support/blog/doing-more-drush-sql-sanitize, found on google. An excerpt of the additional sanitation examples you could do from the blog post are:

/**
* Implements hook_drush_sql_sync_sanitize.
*/
function my_module_drush_sql_sync_sanitize($source) {
  // The query to sanitise field_data_field_profile_linkedin_page
  $linkedin_page_query = "UPDATE field_data_field_profile_linkedin_page SET field_profile_linkedin_page_value = CONCAT('http://uk.linkedin.com/user-name/', FLOOR(100000 + (RAND() * 900000)));";

  // The query to sanitise field_revision_field_profile_linkedin_page
  $linkedin_page_query .= "UPDATE field_revision_field_profile_linkedin_page SET field_profile_linkedin_page_value = CONCAT('http://uk.linkedin.com/user-name/', FLOOR(100000 + (RAND() * 900000)));";

  drush_sql_register_post_sync_op('sanitise_linkedin_page', dt('Sanitise field_profile_linkedin_page'), $linkedin_page_query);

  // The query to sanitise field_data_field_profile_telephone_number
  $telephone_number_query = "UPDATE field_data_field_profile_telephone_number SET field_profile_telephone_number_value = CONCAT('+44', FLOOR(1000000000 + (RAND() * 100000000)));";

  // The query to sanitise field_data_field_profile_telephone_number
  $telephone_number_query .= "UPDATE field_revision_field_profile_telephone_number SET field_profile_telephone_number_value = CONCAT('+44', FLOOR(1000000000 + (RAND() * 100000000)));";

  drush_sql_register_post_sync_op('sanitise_telephone_number', dt('Sanitise field_profile_telephone_number'), $telephone_number_query);

  // The query to sanitise field_data_field_profile_twitter_handle
  $twitter_query = "UPDATE field_data_field_profile_twitter_handle SET field_profile_twitter_handle_value =  SUBSTRING(MD5(RAND()) FROM 1 FOR 8);";

  // The query to sanitise field_revision_field_profile_twitter_handle
  $twitter_query .= "UPDATE field_revision_field_profile_twitter_handle SET field_profile_twitter_handle_value =  SUBSTRING(MD5(RAND()) FROM 1 FOR 8);";

  drush_sql_register_post_sync_op('sanitise_twitter_handle', dt('Sanitise field_profile_twitter_handle'), $twitter_query);
}


If you dont want to attempt to delete revisions manually yourself, in packing the site for git (make a backup first), I would look at the following module: https://www.drupal.org/project/field_sql_norevisions

Once the above steps are done. I would simply provide a drush archive-dump (or the contents thereof) in a GIT repo and instruct users to use Drush and the provided zip (or place the contents of the git repo into a zip) to use drush archive-restore to install the site. The only gotcha with this approach is to assure they use the same database engine on their system as the live site expects (that I can think of).