Disk quota

Note

This only applies to self hosted Scalr.

Scalr customers are recommended to configure disk quota. The function of using disk quotas is to allocate limited disk space in a reasonable way. By assigning quotas, no single user or area can consume enough space to cause an outage to the system or impact other users.

Configuration of the xfs volume

To enable disk quota, xfs volume, mounted in advance with “pquota” option is required. To enable disk quota in configuration:

  1. Update the /etc/scalr-server/scalr-server.rb file on the app server:

    Note

    We recommend to mount xfs volume to /opt/scalr-server/var/lib directory and set it as a home directory, as seen in the example below. If you have to use another directory, please perform data migration, which is described in the following sections of this document.

    app[:disk_quota] = {
      # has to be true
      :enable => true,
      # directory on the xfs volume, which will be used as a home directory
      :home_dir => "/opt/scalr-server/var/lib"
    }
    
  2. By default, disk quota limits are set to 3072 mb (3 gb). If you have to set custom limits, please update the /etc/scalr-server/scalr-server.rb file on the app server:

    app[:configuration] = {
      :scalr => {
        "tf_worker" => {
          "disk_quota" => {
            # Size (in mb) of the disk quota limit for terraform run's directories.
            "run_dir_size_limit" => 3072,
            # Size (in mb) of the disk quota limit for the VCS repositories
            # (Terraform configuration versions, registries, policies).
            "vcs_size_limit" => 3072,
          }
        }
      }
    }
    
  3. Migrate application data:

    Note

    This only applies if disk quota is configured for already installed Scalr, and directory other than /opt/scalr-server/var/lib has been specified as working directory. Skip if this is a first installation, or recommended directory is used.

    If directory other than /opt/scalr-server/var/lib has been specified as working directory, Scalr will use non-default directories for tf-worker and docker services. Any data stored in those directories (docker images, tf-worker tasks results, etc.) will be lost. To prevent data loss, those directories have to migrated.

    To migrate docker and tf-worker data:

    1. Stop Scalr services:

      scalr-server-manage stop all
      
    2. Move directories which are used to store application data:

      Note

      Please use value which has been set as home_dir parameter instead of /path/to/directory.

      mv /opt/scalr-server/var/lib/docker /path/to/directory/docker
      mv /opt/scalr-server/var/lib/tf-worker /path/to/directory/tf-worker
      
  4. Reconfigure the Scalr server:

    /opt/scalr-server/bin/scalr-server-ctl reconfigure
    

Disk quotas will now be enabled.