{"id":7429,"date":"2016-04-02T10:54:41","date_gmt":"2016-04-02T08:54:41","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/"},"modified":"2016-04-02T10:54:41","modified_gmt":"2016-04-02T08:54:41","slug":"alfresco-cleanup-your-dev-environment","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/","title":{"rendered":"Alfresco: cleanup your dev environment"},"content":{"rendered":"<p>As an Alfresco developer\/administrator, you probably already made a few mistakes in your DEV environment while trying to add new features, a custom model or something like that. The result of that mistake might be a corrupted Database or Content Store. Yes I know it&#8217;s hard to recognize it! But then what can be done to solve the issue and restore an usable installation? Well if you don&#8217;t have a backup or don&#8217;t want to do that because it will take some time to restore a clean backup and you want to work immediately then a good solution might need to actually cleanup your entire installation.<\/p>\n<p>Using a few commands or a simple script, your Alfresco can be cleaned very easily and quickly to let you continue your development using a fresh and working installation. In this blog, I will therefore show you a few commands that help me to clean an Alfresco environment (Community or Enterprise).<\/p>\n<p style=\"padding-bottom: 5px\">Basically when talking about corruption in Alfresco, here are the different components that can be affected:<\/p>\n<ul>\n<li>Database<\/li>\n<li>Content Store (documents in File System)<\/li>\n<li>Search Index<\/li>\n<li>War Files &amp; Extensions (AMPs &amp; extension + web-extension folders) &#8211; Not covered in this blog as this kind of corruption will be solved by deploying a corrective version of the AMP or removing the faulty configuration in the extension or web-extension folders<\/li>\n<\/ul>\n<p>Cleaning an Alfresco installation is in fact just like simulating a corruption of all components mentioned above without any backup available and therefore some necessary steps need to be taken to solve this corruption.<\/p>\n<p style=\"padding-bottom:0px\">So let&#8217;s start our simulation with the first bullet point. The first thing to do is to stop the Alfresco installation and only let the Database running. Depending on how you built your Alfresco Installation, the commands can differ a little bit: are you using one service for Alfresco + Database or one service for Alfresco or no service at all? On my DEV environment, one service is managing all Alfresco components:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">alfresco@vmdevalf01:$ service alfresco stop\nalfresco@vmdevalf01:$ service alfresco start postgresql<\/pre>\n<p style=\"padding-bottom:0px;padding-top:20px\">As you can see above, I&#8217;m using postgresql. Of course if you are using MySQL or any other Database, please adapt the commands accordingly! When Alfresco is stopped, the next step is to drop and recreate the database. This can be done using scripts provided by Alfresco:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">alfresco@vmdevalf01:$ \/opt\/alfresco\/postgresql\/bin\/dropdb alfresco\n       =&gt; Password asked\n\nalfresco@vmdevalf01:$ \/opt\/alfresco\/postgresql\/bin\/createdb alfresco\n       =&gt; Password asked<\/pre>\n<p style=\"padding-bottom:0px;padding-top:20px\">Or manually:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">alfresco@vmdevalf01:$ \/opt\/alfresco\/postgresql\/bin\/psql\npostgres=# DROP DATABASE alfresco;\npostgres=# CREATE DATABASE alfresco WITH OWNER alfresco;\npostgres=# GRANT ALL PRIVILEGES ON DATABASE alfresco TO alfresco;\npostgres=# q<\/pre>\n<p style=\"padding-bottom:0px;padding-top:20px\">If you are using MySQL instead of PostgreSQL, then it will be something like that:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">mysql&gt; drop database alfresco;\nmysql&gt; create database alfresco default character set utf8 collate utf8_bin;\nmysql&gt; grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco_pwd' with grant option;<\/pre>\n<p style=\"padding-bottom:0px;padding-top:20px\">Now the Database has been cleaned and you need to align the File System to avoid inconsistencies (bullet points 2 and 3). This is really simple since we just remove the files. The following commands assume that the war file of solr4 has been deployed in the webapps folder of Tomcat and this folder \/opt\/alfresco\/alf_data\/solr4 only contain the model and index:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">alfresco@vmdevalf01:$ rm -rf \/opt\/alfresco\/alf_data\/contentstore\/*\nalfresco@vmdevalf01:$ rm -rf \/opt\/alfresco\/alf_data\/contentstore.deleted\/*\nalfresco@vmdevalf01:$ mv \/opt\/alfresco\/alf_data\/solr4 \/opt\/alfresco\/alf_data\/backup_solr4_$(date '+%Y%m%d_%H%M')<\/pre>\n<p style=\"padding-bottom:0px;padding-top:20px\">And&#8230; That&#8217;s all! Now you just have to restart your service and Alfresco will populate the database and create the necessary elements for the indexing during the first startup:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">alfresco@vmdevalf01:$ service alfresco stop postgresql\nalfresco@vmdevalf01:$ service alfresco start<\/pre>\n<p style=\"padding-bottom:0px;padding-top:20px\">It may take one or two minutes to boot the first time but this is usually much more faster than restoring a complete database schema! By doing that, you will of course loose any document stored in Alfresco but for a development phase, that&#8217;s usually OK.<\/p>\n<p><p style=\"padding-bottom:0px;padding-top:20px\">Note: Just to let you know, doing that for an Alfresco Enterprise Edition (or Alfresco One) with a Trial License will also reset the counter to: 30 days remaining. That&#8217;s why I would recommend you to only do that with the Alfresco Community Edition on your DEV environment or if you have a valid License Key because I don&#8217;t really know if that&#8217;s authorized by Alfresco!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As an Alfresco developer\/administrator, you probably already made a few mistakes in your DEV environment while trying to add new features, a custom model or something like that. The result of that mistake might be a corrupted Database or Content Store. Yes I know it&#8217;s hard to recognize it! But then what can be done [&hellip;]<\/p>\n","protected":false},"author":20,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[3169,789,101],"type_dbi":[],"class_list":["post-7429","post","type-post","status-publish","format-standard","hentry","category-application-integration-middleware","tag-alfresco","tag-clean","tag-installation"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Alfresco: cleanup your dev environment - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Alfresco: cleanup your dev environment\" \/>\n<meta property=\"og:description\" content=\"As an Alfresco developer\/administrator, you probably already made a few mistakes in your DEV environment while trying to add new features, a custom model or something like that. The result of that mistake might be a corrupted Database or Content Store. Yes I know it&#8217;s hard to recognize it! But then what can be done [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-04-02T08:54:41+00:00\" \/>\n<meta name=\"author\" content=\"Morgan Patou\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@MorganPatou\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Morgan Patou\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/\"},\"author\":{\"name\":\"Morgan Patou\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/c4d05b25843a9bc2ab20415dae6bd2d8\"},\"headline\":\"Alfresco: cleanup your dev environment\",\"datePublished\":\"2016-04-02T08:54:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/\"},\"wordCount\":612,\"commentCount\":0,\"keywords\":[\"Alfresco\",\"Clean\",\"Installation\"],\"articleSection\":[\"Application integration &amp; Middleware\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/\",\"name\":\"Alfresco: cleanup your dev environment - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2016-04-02T08:54:41+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/c4d05b25843a9bc2ab20415dae6bd2d8\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Alfresco: cleanup your dev environment\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/c4d05b25843a9bc2ab20415dae6bd2d8\",\"name\":\"Morgan Patou\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/5d7f5bec8b597db68a09107a6f5309e3870d6296ef94fb10ead4b09454ca67e5?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5d7f5bec8b597db68a09107a6f5309e3870d6296ef94fb10ead4b09454ca67e5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5d7f5bec8b597db68a09107a6f5309e3870d6296ef94fb10ead4b09454ca67e5?s=96&d=mm&r=g\",\"caption\":\"Morgan Patou\"},\"description\":\"Morgan Patou has over 12 years of experience in Enterprise Content Management (ECM) systems, with a strong focus in recent years on platforms such as Alfresco, Documentum, and M-Files. He specializes in the architecture, setup, customization, and maintenance of ECM infrastructures in complex &amp; critical environments. Morgan is well-versed in both engineering and operations aspects, including high availability design, system integration, and lifecycle management. He also has a solid foundation in open-source and proprietary technologies - ranging from Apache, OpenLDAP or Kerberos to enterprise-grade systems like WebLogic. Morgan Patou holds an Engineering Degree in Computer Science from ENSISA (\u00c9cole Nationale Sup\u00e9rieure d'Ing\u00e9nieurs Sud Alsace) in Mulhouse, France. He is Alfresco Content Services Certified Administrator (ACSCA), Alfresco Content Services Certified Engineer (ACSCE) as well as OpenText Documentum Certified Administrator. His industry experience spans the Public Sector, IT Services, Financial Services\/Banking, and the Pharmaceutical industry.\",\"sameAs\":[\"https:\/\/blog.dbi-services.com\/author\/morgan-patou\/\",\"https:\/\/x.com\/MorganPatou\"],\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/morgan-patou\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Alfresco: cleanup your dev environment - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/","og_locale":"en_US","og_type":"article","og_title":"Alfresco: cleanup your dev environment","og_description":"As an Alfresco developer\/administrator, you probably already made a few mistakes in your DEV environment while trying to add new features, a custom model or something like that. The result of that mistake might be a corrupted Database or Content Store. Yes I know it&#8217;s hard to recognize it! But then what can be done [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/","og_site_name":"dbi Blog","article_published_time":"2016-04-02T08:54:41+00:00","author":"Morgan Patou","twitter_card":"summary_large_image","twitter_creator":"@MorganPatou","twitter_misc":{"Written by":"Morgan Patou","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/"},"author":{"name":"Morgan Patou","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/c4d05b25843a9bc2ab20415dae6bd2d8"},"headline":"Alfresco: cleanup your dev environment","datePublished":"2016-04-02T08:54:41+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/"},"wordCount":612,"commentCount":0,"keywords":["Alfresco","Clean","Installation"],"articleSection":["Application integration &amp; Middleware"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/","url":"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/","name":"Alfresco: cleanup your dev environment - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2016-04-02T08:54:41+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/c4d05b25843a9bc2ab20415dae6bd2d8"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/alfresco-cleanup-your-dev-environment\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Alfresco: cleanup your dev environment"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/c4d05b25843a9bc2ab20415dae6bd2d8","name":"Morgan Patou","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/5d7f5bec8b597db68a09107a6f5309e3870d6296ef94fb10ead4b09454ca67e5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5d7f5bec8b597db68a09107a6f5309e3870d6296ef94fb10ead4b09454ca67e5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5d7f5bec8b597db68a09107a6f5309e3870d6296ef94fb10ead4b09454ca67e5?s=96&d=mm&r=g","caption":"Morgan Patou"},"description":"Morgan Patou has over 12 years of experience in Enterprise Content Management (ECM) systems, with a strong focus in recent years on platforms such as Alfresco, Documentum, and M-Files. He specializes in the architecture, setup, customization, and maintenance of ECM infrastructures in complex &amp; critical environments. Morgan is well-versed in both engineering and operations aspects, including high availability design, system integration, and lifecycle management. He also has a solid foundation in open-source and proprietary technologies - ranging from Apache, OpenLDAP or Kerberos to enterprise-grade systems like WebLogic. Morgan Patou holds an Engineering Degree in Computer Science from ENSISA (\u00c9cole Nationale Sup\u00e9rieure d'Ing\u00e9nieurs Sud Alsace) in Mulhouse, France. He is Alfresco Content Services Certified Administrator (ACSCA), Alfresco Content Services Certified Engineer (ACSCE) as well as OpenText Documentum Certified Administrator. His industry experience spans the Public Sector, IT Services, Financial Services\/Banking, and the Pharmaceutical industry.","sameAs":["https:\/\/blog.dbi-services.com\/author\/morgan-patou\/","https:\/\/x.com\/MorganPatou"],"url":"https:\/\/www.dbi-services.com\/blog\/author\/morgan-patou\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/7429","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=7429"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/7429\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=7429"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=7429"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=7429"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=7429"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}