Automatically:

ARTIFACTORY: Migration to S3

AuthorFullName__c
Nir Shervi
articleNumber
000005365
ft:sourceType
Salesforce
FirstPublishedDate
2022-08-07T16:58:43Z
lastModifiedDate
2024-03-10T07:44:30Z
VersionNumber
4
1. Stop Artifactory
2. Create “eventual” and “_pre” directories, under $JFROG_HOME/artifactory/var/data/artifactory/:
$ mkdir $JFROG_HOME/artifactory/var/data/artifactory/eventual
$ mkdir $JFROG_HOME/artifactory/var/data/artifactory/_pre

3. CD into the “eventual” directory, and create 2 symbolic links, _add and _pre. They should link to “filestore” (_add) and “pre”(_pre) directories we just created:
$ cd $JFROG_HOME/artifactory/var/data/artifactory/eventual
$ ln -s ../filestore/ _add
$ ln -s ../_pre/ _pre

4. Make sure that the system links were created, listed inside “eventual” and pointing to the correct targets (in the previous directory):
$ ls -la $JFROG_HOME/artifactory/var/data/artifactory/eventual
total 8
drwxr-xr-x 2 root root 4096 Sep  8 10:01 ./
drwxr-x--- 8 root root 4096 Sep  8 09:58 ../
lrwxrwxrwx 1 root root   13 Sep  8 10:01 _add -> ../filestore
lrwxrwxrwx 1 root root    8 Sep  8 10:01 _pre -> ../_pre

5. Assign the right permissions to the directory created in the first step, assign the user and group that owns your Artifactory installation, by default artifactory:artifactory:
$ chown  -R artifactory:artifactory
$JFROG_HOME/artifactory/var/data/artifactory/eventual
$ ​​chown  -R artifactory:artifactory
$JFROG_HOME/artifactory/var/data/artifactory/_pre

6. Configure the binarystore.xml with the S3 bucket. The example below shows an S3 bucket configuration : (for more S3 buckets - click here)
<config version="2">
     <chain>
        <provider id="cache-fs" type="cache-fs">
            <provider id="eventual" type="eventual">
                <provider id="retry" type="retry">
                    <provider id="s3-storage-v3" type="s3-storage-v3"/>
                </provider>
            </provider>
        </provider>
    </chain>
    <provider id="s3-storage-v3" type="s3-storage-v3">
       <endpoint>s3.amazonaws.com</endpoint>
       <bucketName>nirsh-artifactory-s3bucket</bucketName>
       <path>pathPrefix</path>
       <region>us-east-3</region>
       <useInstanceCredentials>true</useInstanceCredentials>
    </provider>
</config>​​​​​​

7. Start Artifactory.
8. The '../eventual/ add' folder should be empty to indicate that the migration is complete.
9. After the migration is completed, you can replace the template from step six to work as S3 Direct Upload Template - you can read about it and why is it recommended in the JFrog documentation .
<config version="2">
   <chain template="s3-storage-v3-direct"/>
   <provider id="s3-storage-v3" type="s3-storage-v3">
       <endpoint>s3.amazonaws.com</endpoint>
       <bucketName>bucketName</bucketName>
       <path>pathPrefix</path>
       <region>s3Region</region>
       <identity>yourIdentity</identity>
       <credential>yourCredentials</credential>
       <usePresigning>true</usePresigning>
       <signatureExpirySeconds>600</signatureExpirySeconds>
   </provider>
</config>

Note: if you require to create _delete file in the eventual directory, do it and give it permissions.