Cleanup /opt/rhodecode/store

Dear Support,

Currently the /opt/rhodecode/store/ directory contains around 1380 subdirectories. As far as I can see these are the previous (and current) rhodecode server directories.
Is there a way to automatically clean them? (Some cleanup command of the rhodecoda-api, maybe?)
If not, how to identify the directories that are used currently?

Tamas

Please check this: https://docs.rhodecode.com/RhodeCode-Control/tasks/admin_tasks/nix-store-cleanup.html

Hi Marcin,

Kind of scary this hard core ‘rm -rf …’ stuff. I would expect an ‘rcontrol clean-store’ solution instead :).

Anyway, I probably won’t delete those directories, at least not at the first place. But before saving all those ~1500 directories, I would like to know how to find out which directories are currently active?
So what are those out of the 1500 that is used in the current instance of Rhodecode.

Marcin,

The steps on the linked page cleared my existing mysql configuration…
I told you it is dangerous :grimacing:

For anyone reading this later:
DO NOT ENTER YOUR CURRENT DATABASE CONFIGURATION WHEN INSTALLING VCSSERVER AND COMMUNITY (STEP 6.). IT WILL WIPE YOUR EXISTING DATABASE!

In my opinion it make sense to go to following steps to avoid the issue described by tcsabina:

  1. rename existing sql database(s) before STEP 6, f.e. community-1_db to community-1_backup
  2. create a new empty sql database named as the old database name, f.e. community-1_db
  3. Now “rccontrol install Community” could create the data structure in community-1_db without user data.
  4. “rccontrol stop community-1”
  5. Drop community-1_db
  6. Rename community-1_backup to community-1_db
  7. “rccontrol start community-1”

Thanks for your suggestion Andreas. IMHO these steps aren’t needed anymore. The documentation now provides setup instructions that would use a sqlite database just to create a dummy installation.

ie.

    rccontrol install --accept-license VCSServer '{"host":"127.0.0.1", "port": 9999}'
    rccontrol install --accept-license Enterprise '{"password":"secret", "email":"sup@rt.com", "username":"adm", "host":"127.0.0.1", "port": 9919, "database":"sqlite", "repo_dir":"/tmp"}'

So you’re sure that it wont touch the old databases.

Hi Marcin,

we use MySQL instead of sqlite. So it seems i need the steps, isnt it ?

Please note that use of sqlite here is important, and shouldn’t be changed despite using other type of Database.

During a new installation if user would point to an existing database it would be re-created destroying of old data. If we use always sqlite the trick here is that new DB will be created on sqlite database file, not touching existing database. The installation step is only for creating the binaries again since nix store was cleaned.

Hope this is clear now

Hi marcin,

I think the documentation is still not clear or misleading. It should be explicitly listed that “this solution is only for sqlite! For any other database, please be aware that it will destroy your existing database.”