Moving the Artifact Repository in Linux

In this scenario, the /opt/electriccloud/electriccommander/conf/repository/wrapper.conf file has these settings:

  • set.default.INSTALL_DIRECTORY=/opt/Electric Cloud/ElectricCommander

  • set.default.DATA_DIRECTORY=/opt/Electric Cloud/ElectricCommander

If the Linux server where the current artifact repository is stored is full and you want to move it to a new device with more disk space, map the artifact repository to a new network location.

In this procedure, the set.default.DATA_DIRECTORY value will change to the NEW_DATA_DIRECTORY value. The REPOSITORY_BACKING_STORE value in /opt/electriccloud/electriccommander/conf/repository/server.properties will remain the same, relative to the DATA_DIRECTORY, which will be NEW_DATA_DIRECTORY.

In the example, the DATA_DIRECTORY will be changed to /vagrant_data, and the REPOSITORY_BACKING_STORE value will be relative to this directory.

The REPOSITORY_BACKING_STORE value is always relative to the DATA_DIRECTORY and cannot be set to a fully qualified absolute path. The solution in link:https://ask.cloudbees.com/questions/2192/how-to-configure-which-directory-the-artifact-repository-uses\https://ask.cloudbees.com/questions/2192/how-to-configure-which-directory-the-artifact-repository-uses will not work until you change the DATA_DIRECTORY as described in this procedure.

  1. Publish the artifact under the /opt/electriccloud/electriccommander/repository-data/<artifact_name>/<version> directory:

    ectool publishArtifactVersion --artifactName <artifact_name> --version <version> --fromDirectory <directory> --compress 0

    Example: To publish an artifact under the /opt/electriccloud/electriccommander/repository-data/jdoe/2001/1.0.0 directory, enter:

    ectool publishArtifactVersion --artifactName "jdoe:2001" --version "1.0.0" --fromDirectory /tmp/job1 --compress 0

    The from Directory ( /tmp/job1 ) contains the files to be uploaded.

  2. Stop the repository server:

    /etc/init.d/commanderRepository stop

  3. Move the artifact repository data from the /DATA_DIRECTORY directory to the /NEW_DATA_DIRECTORY directory:

    mv /opt/electriccloud/electriccommander/repository-data/NEW_DATA_DIRECTORY

  4. In /opt/electriccloud/electriccommander/conf/repository/wrapper.conf, change set.default.DATA_DIRECTORY=/opt/Electric Cloud/ElectricCommander to set.default.DATA_DIRECTORY=/NEW_DATA_DIRECTORY.

    Example: Change set.default.DATA_DIRECTORY=/opt/Electric Cloud/ElectricCommander to set.default.DATA_DIRECTORY=/vagrant_data.

  5. Create a logs/repository/ subdirectory under NEW_DATA_DIRECTORY.

    Example: Create /vagrant_data/logs/repository using the following commands:

    mkdir /vagrant_data/logs
    mkdir /vagrant_data/logs/repository
  6. Copy /opt/electriccloud/electriccommander/conf/repository/server.properties and /opt/electriccloud/electriccommander/conf/repository/keystore to the NEW_DATA_DIRECTORY/conf/repository directory.

    Example: Copy the directories to the /vagrant_data/conf/repository using the following commands.

    mkdir /vagrant_data/conf
    mkdir /vagrant_data/conf/repository
    cp /opt/electriccloud/electriccommander/conf/repository/server.properties/
    vagrant_data/conf/repository
    cp /opt/electriccloud/electriccommander/conf/repository/keystore/
    vagrant_data/conf/repository
  7. In /etc/init.d/commanderRepository, change DATADIR=/opt/Electric Cloud/ElectricCommander to DATADIR=/NEW_DATA_DIRECTORY.

    Example: Change DATADIR=/opt/Electric Cloud/ElectricCommander to DATADIR=/vagrant_data.

  8. Start the repository server:

    /etc/init.d/commanderRepository start
  9. Check if CloudBees CD has started using the artifact repository in the new network location:

    netstat -aon | grep 8200

    Example:

    vagrant@commander1:~$ netstat -aon | grep 8200
    tcp        0      0 0.0.0.0:8200            0.0.0.0:*               LISTEN      off (0.00/0/0)

    This shows that the DATA_DIRECTORY repository has moved to /vagrant_data.

    The repository service.log, repository.log and repository.pid files will be created in the /vagrant_data/logs/repository directory.

  10. Publish a new artifact and check if it is published:

    ectool getArtifactVersions | grep artifactVersionName