<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>cavaliba.com – SRE / Administration</title>
    <link>https://cavaliba.com/docs/admin_sre/</link>
    <description>Recent content in SRE / Administration on cavaliba.com</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    
	  <atom:link href="https://cavaliba.com/docs/admin_sre/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>CLI tools</title>
      <link>https://cavaliba.com/docs/admin_sre/cli/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://cavaliba.com/docs/admin_sre/cli/</guid>
      <description>
        
        
        &lt;p&gt;Cavaliba comes with various command-line tools.&lt;/p&gt;
&lt;p&gt;First, create these 2 aliases for easy access to command line commands (CLI):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ alias cavaliba=&amp;quot;docker exec -it cavaliba_app python manage.py cavaliba&amp;quot;
$ alias cavmanage=&amp;quot;docker exec -it cavaliba_app python manage.py&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add them to your &lt;code&gt;~/.basrc&lt;/code&gt; for persistence.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;cavmanage&lt;/code&gt;command will launch the integrated management framework.&lt;/p&gt;
&lt;p&gt;You can now type :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavmanage
$ cavaliba --help
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You&amp;rsquo;ll see all available commands.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;version&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavaliba version
3.17.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Load schema and data&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavaliba load /files/demo/
$ cavaliba load /files/demo/100_site.yaml --pass 2
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note: absolute folder for /files, inside containers ; local folder is files/ on host.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Load CSV data file&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;$ cavaliba load /files/demo/user/user.csv &amp;ndash;pipeline user_import_csv&lt;/p&gt;
&lt;p&gt;A pipeline is needed to map columns to Schema fields and usually apply some transformations.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;multipass&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;--pass 2
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;--pass&lt;/code&gt; option is recommanded for schema, because cross-references between schemas requires some schemas to be created before others. Multiple pass resolve dependencies.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;progress&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Display progression for large files :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;--progress 

File: /files/import/user.csv ...
Found: 55456 objects
Pipeline: user_import_csv
Loading to DB...
100 done
200 done
(...)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;first/last&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Choose quantity (first/last lines to process) ; 0 for last is unlimited.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;--first 1 
--last 0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;log view&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavaliba log
$ cavaliba log --first 0 --last 1000
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;log purge&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;apply automatic log purge:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavaliba log --log_purge
log entries: 203718
log deleted (old) : 48 entries
log done
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;purge all logs (!):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavaliba log --log_purge_all
log entries: 203676
log deleted (all) : 203676 entries
log done
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;conf view&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavaliba conf
$ cavaliba conf --text
$ cavaliba conf --json
$ cavaliba conf --yaml
$ cavaliba conf --yaml --key LOG_KEEP_DAYS_ERROR
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;conf sync&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Creates default entries / purge orphan. Run automatically during startup.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavaliba conf --confsync --verbose
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;conf backup/restore&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Backup conf:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavaliba conf &amp;gt; files/export/conf_backup.json
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Reload conf (from container accessible folder)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavaliba conf --conf_file /files/export/conf_backup.json --verbose
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;data query/export&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Get available schemas:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavaliba schema
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query a schema:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavaliba schema --schema user 
- login: admin
  displayname: Built-in Global Admin user
  is_enabled: true
  want_notifications: true
  want_24: true
  want_email: true
  classname: _user

- login: i.trento
  displayname: Izongua Trento
  is_enabled: true
  want_notifications: true
  want_24: true
  want_email: true
  classname: _user

  (...)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query a schema and a specific object:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavaliba cavaliba_export --schema user --key testuser01
- login: testuser01
  email: testuser01@test.com
  mobile: 0123456789
  displayname: Test User 01
  description: Test User 01
  is_enabled: true
  want_notifications: true
  want_24: true
  want_sms: true
  want_email: true
  classname: _user
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Specify an output format:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavaliba cavaliba_export --schema site --key testsite01 --json
[
    {
        &amp;quot;classname&amp;quot;: &amp;quot;site&amp;quot;,
        &amp;quot;keyname&amp;quot;: &amp;quot;testsite01&amp;quot;,
        &amp;quot;handle&amp;quot;: &amp;quot;testsite01&amp;quot;,
        &amp;quot;displayname&amp;quot;: &amp;quot;Test Site 01&amp;quot;,
        &amp;quot;p_read&amp;quot;: null,
        &amp;quot;p_update&amp;quot;: null,
        &amp;quot;p_delete&amp;quot;: null,
        &amp;quot;is_enabled&amp;quot;: true,
        &amp;quot;sirene_group&amp;quot;: [
            &amp;quot;testgroup01&amp;quot;
        ]
    }
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Run the integrated test suite&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;First, either create an empty test database in your database server or use the &lt;code&gt;root&lt;/code&gt; DµB user in your docker &lt;code&gt;.env&lt;/code&gt; file for variable &lt;code&gt;CAVALIBA_DB_USER&lt;/code&gt;. Alternatively you may prefer to grant create database privileges to your current CAVALIBA_DB_USER.&lt;/p&gt;
&lt;p&gt;Then,&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavmanage test
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Options exists such as:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavmanage test --keepdb
$ cavmanage test -v 2
$ cavmanage test --keepdb app_home.tests.test_home.ConfTest
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You may need to create a test database manually in MariaDB. Example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;docker exec -it cavaliba_db mysql -u root -p
create database test_cavaliba;
show grants for &#39;cavaliba&#39;;
GRANT ALL PRIVILEGES ON `test_cavaliba`.* TO `cavaliba`@`%`;
flush privileges;
&lt;/code&gt;&lt;/pre&gt;

      </description>
    </item>
    
    <item>
      <title>Backup and restore</title>
      <link>https://cavaliba.com/docs/admin_sre/backup_restore/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://cavaliba.com/docs/admin_sre/backup_restore/</guid>
      <description>
        
        
        &lt;h2&gt;System &lt;code&gt;.env&lt;/code&gt; file&lt;span class=&#34;hx-absolute -hx-mt-20&#34; id=&#34;system-env-file&#34;&gt;&lt;/span&gt;
    &lt;a href=&#34;#system-env-file&#34; class=&#34;subheading-anchor&#34; aria-label=&#34;Permalink for this section&#34;&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;You must backup and protect the docker .env file in the cavaliba app directory.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cd appdir/
$ cp .env /my/backup/dir/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It contains sensitive informations needed at startup time. It is created / modified during system setup and reconfig/&lt;/p&gt;
&lt;p&gt;Most needed data are encryption keys, and various credentials : DB, admin account, OIDC client secrets, etc.&lt;/p&gt;
&lt;p&gt;Restoration is a simple as copying back the file to the restored application folder.&lt;/p&gt;
&lt;h2&gt;Application configuration&lt;span class=&#34;hx-absolute -hx-mt-20&#34; id=&#34;application-configuration&#34;&gt;&lt;/span&gt;
    &lt;a href=&#34;#application-configuration&#34; class=&#34;subheading-anchor&#34; aria-label=&#34;Permalink for this section&#34;&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Most configuration items are managed from the application itself, and are stored in the database.&lt;/p&gt;
&lt;p&gt;You must backup this configuration:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cd appdir/                                              # or whatever your setup root dir is
$ cavaliba conf                                           # show current configuration
$ cavaliba conf --yaml &amp;gt; files/export/conf_backup.yaml    # load and replace in-DB configuration
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Remember to setup &lt;code&gt;cavaliba&lt;/code&gt; as an alias to management commands as explained in the command-line (CLI) doc page.&lt;/p&gt;
&lt;p&gt;To restore the configuration on a new  deployement :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cd appdir
$ cavaliba conf 
$ cavaliba conf --conf_file /files/export/conf_backup.json
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice the &lt;code&gt;/&lt;/code&gt; before files/ to ensure access from inside the containers.&lt;/p&gt;
&lt;h2&gt;Full database backup&lt;span class=&#34;hx-absolute -hx-mt-20&#34; id=&#34;full-database-backup&#34;&gt;&lt;/span&gt;
    &lt;a href=&#34;#full-database-backup&#34; class=&#34;subheading-anchor&#34; aria-label=&#34;Permalink for this section&#34;&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Cavaliba provides &lt;code&gt;script/db_backup.sh &lt;/code&gt; to backup the full MySQL/MariaDB automatically.&lt;/p&gt;
&lt;p&gt;Setup:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;1. create your backup dir
2. install standard zstd compression tool if missing
3. edit the script and set your choosen DB password (.env), BACKUPDIR
4. launch manually ./script/db_backup and check produced backup file in your Backupdir
3. add to crontab with provided example in the script

   25 */6 * * * /opt/cavaliba/script/db_backup.sh &amp;gt; /tmp/backup_db.log 2&amp;gt;&amp;amp;1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It creates a periodically rolling backup for 7 days.&lt;/p&gt;
&lt;p&gt;Restore:&lt;/p&gt;
&lt;p&gt;You can restore as a standard MariaDB / MySQL dump&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;1. stop the application
2. drop / create cavaliba_db in your mysql server
3. zstdcat mybackup.zstd | mysql cavaliba_db
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Logicial Data backup&lt;span class=&#34;hx-absolute -hx-mt-20&#34; id=&#34;logicial-data-backup&#34;&gt;&lt;/span&gt;
    &lt;a href=&#34;#logicial-data-backup&#34; class=&#34;subheading-anchor&#34; aria-label=&#34;Permalink for this section&#34;&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Cavaliba provides a simple data_export script:&lt;/p&gt;
&lt;div class=&#34;hextra-code-block hx-relative hx-mt-6 first:hx-mt-0 hx-group/code&#34;&gt;

&lt;div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# (c) cavaliba.com - DATA Export backup script&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;#&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# crontab example&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# 45 */6 * * * /opt/cavaliba/script/data_backup.sh &amp;gt; /tmp/backup_data.log 2&amp;gt;&amp;amp;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;BACKUPDIR&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;/opt/cavaliba/backup&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;USER&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;root&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;PASSWORD&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;xxxxxxxxxxxxxxxxxxx&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;cd&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;$BACKUPDIR&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;DAY&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;$(&lt;/span&gt;date &lt;span class=&#34;s2&#34;&gt;&amp;#34;+%u&amp;#34;&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;HOUR&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;$(&lt;/span&gt;date &lt;span class=&#34;s2&#34;&gt;&amp;#34;+%H&amp;#34;&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;DATE&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;$(&lt;/span&gt;date +%Y%m%d_%H:%M:%S&lt;span class=&#34;k&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;FILE&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$BACKUPDIR&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;DAY&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;_&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;HOUR&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;_schema.zst&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$DATE&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt; start dumping SCHEMA to &lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$FILE&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;docker &lt;span class=&#34;nb&#34;&gt;exec&lt;/span&gt; cavaliba_app python manage.py dumpdata --format json --indent &lt;span class=&#34;m&#34;&gt;2&lt;/span&gt; app_data.dataschema --natural-primary --natural-foreign &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; zstd &amp;gt;&lt;span class=&#34;nv&#34;&gt;$FILE&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;DATE&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;$(&lt;/span&gt;date +%Y%m%d_%H:%M:%S&lt;span class=&#34;k&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;FILE&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$BACKUPDIR&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;DAY&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;_&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;HOUR&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;_classname.zst&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$DATE&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt; start dumping CLASS to &lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$FILE&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;docker &lt;span class=&#34;nb&#34;&gt;exec&lt;/span&gt; cavaliba_app python manage.py dumpdata --format json --indent &lt;span class=&#34;m&#34;&gt;2&lt;/span&gt; app_data.dataclass --natural-primary --natural-foreign &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; zstd &amp;gt;&lt;span class=&#34;nv&#34;&gt;$FILE&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;DATE&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;$(&lt;/span&gt;date +%Y%m%d_%H:%M:%S&lt;span class=&#34;k&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;FILE&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$BACKUPDIR&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;DAY&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;_&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;HOUR&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;_instance.zst&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$DATE&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt; start dumping INSTANCE to &lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$FILE&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;docker &lt;span class=&#34;nb&#34;&gt;exec&lt;/span&gt; cavaliba_app python manage.py dumpdata --format json --indent &lt;span class=&#34;m&#34;&gt;2&lt;/span&gt; app_data.datainstance --natural-primary --natural-foreign &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; zstd &amp;gt;&lt;span class=&#34;nv&#34;&gt;$FILE&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;DATE&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;$(&lt;/span&gt;date +%Y%m%d_%H:%M:%S&lt;span class=&#34;k&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;FILE&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$BACKUPDIR&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;DAY&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;_&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;HOUR&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;_conf.zst&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$DATE&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt; start dumping CONF to &lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$FILE&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;docker &lt;span class=&#34;nb&#34;&gt;exec&lt;/span&gt; cavaliba_app python manage.py dumpdata --format json --indent &lt;span class=&#34;m&#34;&gt;2&lt;/span&gt; app_home.cavalibaconfiguration --natural-primary --natural-foreign &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; zstd &amp;gt;&lt;span class=&#34;nv&#34;&gt;$FILE&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;DATE&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;$(&lt;/span&gt;date +%Y%m%d_%H:%M:%S&lt;span class=&#34;k&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;FILE&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$BACKUPDIR&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;DAY&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;_&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;HOUR&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;_iam.zst&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$DATE&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt; start dumping IAM (USER GROUPS PERM ROLES) to &lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$FILE&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;docker &lt;span class=&#34;nb&#34;&gt;exec&lt;/span&gt; cavaliba_app python manage.py dumpdata --format json --indent &lt;span class=&#34;m&#34;&gt;2&lt;/span&gt; app_user --natural-primary --natural-foreign &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; zstd &amp;gt;&lt;span class=&#34;nv&#34;&gt;$FILE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&#34;hextra-code-copy-btn-container hx-opacity-0 hx-transition group-hover/code:hx-opacity-100 hx-flex hx-gap-1 hx-absolute hx-m-[11px] hx-right-0 hx-top-0&#34;&gt;
  &lt;button
    class=&#34;hextra-code-copy-btn hx-group/copybtn hx-transition-all active:hx-opacity-50 hx-bg-primary-700/5 hx-border hx-border-black/5 hx-text-gray-600 hover:hx-text-gray-900 hx-rounded-md hx-p-1.5 dark:hx-bg-primary-300/10 dark:hx-border-white/10 dark:hx-text-gray-400 dark:hover:hx-text-gray-50&#34;
    title=&#34;Copy code&#34;
  &gt;
    &lt;div class=&#34;copy-icon group-[.copied]/copybtn:hx-hidden hx-pointer-events-none hx-h-4 hx-w-4&#34;&gt;&lt;/div&gt;
    &lt;div class=&#34;success-icon hx-hidden group-[.copied]/copybtn:hx-block hx-pointer-events-none hx-h-4 hx-w-4&#34;&gt;&lt;/div&gt;
  &lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;CLI data export&lt;span class=&#34;hx-absolute -hx-mt-20&#34; id=&#34;cli-data-export&#34;&gt;&lt;/span&gt;
    &lt;a href=&#34;#cli-data-export&#34; class=&#34;subheading-anchor&#34; aria-label=&#34;Permalink for this section&#34;&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;You can export specific object to any file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavaliba schema --schema mybookstore --json &amp;gt; /my/backup/dir/schema_mybookstore.json
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And reload with&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cavaliba load schema_mybookstore.json
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Cavaliba Software distribution&lt;span class=&#34;hx-absolute -hx-mt-20&#34; id=&#34;cavaliba-software-distribution&#34;&gt;&lt;/span&gt;
    &lt;a href=&#34;#cavaliba-software-distribution&#34; class=&#34;subheading-anchor&#34; aria-label=&#34;Permalink for this section&#34;&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;You should also keep the downloaded software distribution for later reinstall :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ wget https://cavaliba.com/download/cavaliba/latest.tar.gz
$ cp latest.tar.gz /my/backup/dir
&lt;/code&gt;&lt;/pre&gt;

      </description>
    </item>
    
    <item>
      <title>Periodic tasks</title>
      <link>https://cavaliba.com/docs/admin_sre/peridodic_tasks/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://cavaliba.com/docs/admin_sre/peridodic_tasks/</guid>
      <description>
        
        
        &lt;p&gt;Cavaliba has an internal scheduler to run various periodic tasks. You have nothing to configure.&lt;/p&gt;
&lt;p&gt;The only tasks not handled internally are backup tasks which you should configure on your own (see dedicated doc page).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Current internal Tasks&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;quot;log_purge&amp;quot;: {
    &amp;quot;task&amp;quot;: &amp;quot;app_home.tasks.log_purge&amp;quot;,
    &amp;quot;schedule&amp;quot;: crontab(hour=20, minute=42),
},
&amp;quot;clear_expired_sessions&amp;quot;: {
    &amp;quot;task&amp;quot;: &amp;quot;app_home.tasks.clear_expired_sessions&amp;quot;,
    &amp;quot;schedule&amp;quot;: crontab(hour=19, minute=12),
},
&amp;quot;archive_expired_sirene&amp;quot;: {
    &amp;quot;task&amp;quot;: &amp;quot;app_sirene.notify.archive_expired_sirene&amp;quot;,
    &amp;quot;schedule&amp;quot;: 60.0,
},
&amp;quot;status_run_monitor&amp;quot;: {
    &amp;quot;task&amp;quot;: &amp;quot;app_status.tasks.task_run_monitor&amp;quot;,
    &amp;quot;schedule&amp;quot;: 15.0,
},
&amp;quot;status_sample_hour&amp;quot;: {
    &amp;quot;task&amp;quot;: &amp;quot;app_status.tasks.task_sample_hour&amp;quot;,
    &amp;quot;schedule&amp;quot;: 60.0,
},
&amp;quot;status_sample_day&amp;quot;: {
    &amp;quot;task&amp;quot;: &amp;quot;app_status.tasks.task_sample_day&amp;quot;,
    &amp;quot;schedule&amp;quot;: 900.0,
},
&amp;quot;status_cleanup_raw&amp;quot;: {
    &amp;quot;task&amp;quot;: &amp;quot;app_status.tasks.task_cleanup_raw&amp;quot;,
    &amp;quot;schedule&amp;quot;: 900.0,
},
&amp;quot;status_cleanup_hour&amp;quot;: {
    &amp;quot;task&amp;quot;: &amp;quot;app_status.tasks.task_cleanup_hour&amp;quot;,
    &amp;quot;schedule&amp;quot;: 18000.0,
},
&lt;/code&gt;&lt;/pre&gt;

      </description>
    </item>
    
  </channel>
</rss>
