Moving the Artifact Repository in Linux

2 minute readReference

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

  • set.default.INSTALL_DIRECTORY=/opt/cloudbees/sda

  • set.default.DATA_DIRECTORY=/opt/cloudbees/sda

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/cloudbees/sda/conf/repository/ 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:\ will not work until you change the DATA_DIRECTORY as described in this procedure.

  1. Publish the artifact under the /opt/cloudbees/sda/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/cloudbees/sda/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/cloudbees/sda/repository-data/NEW_DATA_DIRECTORY

  4. In /opt/cloudbees/sda/conf/repository/wrapper.conf, change set.default.DATA_DIRECTORY=/opt/cloudbees/sda to set.default.DATA_DIRECTORY=/NEW_DATA_DIRECTORY.

    Example: Change set.default.DATA_DIRECTORY=/opt/cloudbees/sda 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/cloudbees/sda/conf/repository/ and /opt/cloudbees/sda/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/cloudbees/sda/conf/repository/
    cp /opt/cloudbees/sda/conf/repository/keystore/
  7. In /etc/init.d/commanderRepository, change DATADIR=/opt/cloudbees/sda to DATADIR=/NEW_DATA_DIRECTORY.

    Example: Change DATADIR=/opt/cloudbees/sda to DATADIR=/vagrant_data.

  8. Start the repository server:

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

    netstat -aon | grep 8200


    vagrant@commander1:~$ netstat -aon | grep 8200
    tcp        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 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