ARTIFACTORY: Upload License Bucket using REST API for fresh Artifactory installation
In this article, we are going to describe the steps that can help to upload license bucket using REST API for a fresh Artifactory installation.
Step 1:
Enabling MC after the installation of Artifactory:
To enable Mission Control, you need to add the following lines to the system.yaml file located at $JFROG_HOME/artifactory/var/etc/.
## Mission control template mc: enabled: true
Step 2:
Creating an Automatic Admin Token:
This Access admin-scoped token is designed to be used for a short time only and its purpose is to start up the system. This provides customers with the option of setting up their JFrog Platform in an automated, fully UI-free setup.
Generate an admin-scoped token by placing a generate.token.json file under the $JFROG_HOME/artifactory/var/bootstrap/etc/access/keys directory. For example:
$JFROG_HOME/artifactory/var/bootstrap/etc/access/keys/generate.token.json
When bootstrapping, if this file is created, this will generate a token and set it under the $JFROG_HOME/artifactory/var/etc/access/keys/ directory. For example:
$JFROG_HOME/artifactory/var/etc/access/keys/token.json
The generated token is limited to a 15 minute expiry, after which the system will revoke the token.
Step 3:
Creating an Admin Access Token for the JFrog Platform by using the automatic admin token generated above in step 2. This token is needed to execute the JFrog Mission Control REST API which handles the JFrog license bucket management.
Sample usage:
curl -H "Authorization: Bearer <Automatic Admin Token>" -XPOST "http://localhost:8082/access/api/v1/tokens" -d "scope=applied-permissions/admin"
Step 4:
Using the above generated Admin Access token we can run the JFrog Mission Control REST API for uploading License Bucket during the installation.
Sample usage:
curl -X POST 'http://localhost:8082/mc/api/v1/buckets' -H 'Authorization: Bearer <token>' -H 'Content-Type: multipart/form-data' -F 'file=@/tmp/728939433.json;type=application/octet-stream' -F 'key=d18fc5bc05dc3b6419ab6cd127f16cf6b57d7650ea0ef03cde130918f6f25487' -F 'name=mybucket'