Issue
- Every so often, a situation may arise during development or testing where you need to bring your Liferay PaaS environment to a "clean" state and start over. Perhaps a deployment has caused data corruption or some other unintentional change causes an issue in the environment. This article covers steps one can use to "reset" their environment and bring it to a "clean" state.
Environment
- Liferay PaaS
Resolution
Warning! The below steps completely delete all data in the Database and Document Library!
Warning! These steps should not be used in a production environment! They cannot be undone and the data cannot be recovered!
There are two tasks that must be done in order to reset the environment. Before performing either task, you must set the scale of the Liferay service to 1.
Delete The Document Library
- Navigate to the Liferay service of the environment you are trying to clean
- Click the Shell tab
- Paste the following code and execute
rm -r /opt/liferay/data/document_library
Delete The Database
You will need to copy the database credentials from your projects secrets(found on the Settings page).
- Navigate to the Liferay service of the environment you are trying to clean
- Click the Shell tab
- Paste the following code and execute(replace the User and Password with the copied credentials)
mysql -u User -pPassword -e "drop database lportal; create database lportal" && /opt/liferay/tomcat/bin/catalina.sh stop
After restarting the liferay service, a full reindex from Control Panel/Search/Index Actions might also be beneficial (and recommended).