The following article describes how you can create and publish a custom UM plugin that is to be integrated into a cloud-hosted UM at AWS.
1. Create plugin using Kickstarter
Follow Install Kickstarter to prepare your local machine to create and develop Kickstarter-based UM projects.
Then, choose a Java-style package name for your new plugin – e.g. de.acme.projectx
. (See also ACME Corporation)
Please note that com...
, net...
and org...
denote reserved namespaces and can not be used as top-level package names.
Create a fresh plugin like this:
Codeblock | ||
---|---|---|
| ||
umkickstarter MY-PLUGIN-DIR -n de.acme.my.pluginprojectx |
Follow Kickstarter.md to locally develop your new plugin locally.
2. Provide meaningful artifact names
Edit build.gradle
and change the default project name and group id to something meaningful. These settings will make up the name of the artifact that you will publish later on.
Codeblock | ||
---|---|---|
| ||
pinuts.projectName = 'RestServices' pinuts.groupId = 'de.acme.projectx' |
3. Prepare publishing the plugin
If Pinuts is hosting your UM installation at AWS, there already is an S3 bucket ready to be used as a maven repository. Ask us for the respective credentials: Pinuts Support
You will receive an S3 bucket name and AWS access key. We will also provide you with AWS console credentials to enable you to view all the logfiles available.
Insert the following into your build.gradle
file right after pinuts.version = ...
and fill-in BUCKET_NAME
with the name you just received:
Codeblock | ||
---|---|---|
| ||
...
pinuts.projectName = 'RestServices'
pinuts.groupId = 'de.acme.projectx'
pinuts.version = getVersionFromPluginDescriptor('the_plugin/plugin.desc.json')
publishing {
publications {
cmsbsPlugin(MavenPublication) {
groupId = pinuts.groupId
artifactId = pinuts.projectName
version = "${pinuts.env}-SNAPSHOT"
artifact getCmsbsPluginDistFile()
}
}
repositories {
maven {
name "s3bucket"
url "s3://BUCKET_NAME/snapshots"
credentials(AwsCredentials) {
accessKey awsCredentials.AWSAccessKeyId
secretKey awsCredentials.AWSSecretKey
}
}
}
} |
Put the AWS credentials you received into the environment variables AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
respectively.
After that you can build and publish your plugin like this:
Codeblock |
---|
gradle publish -Penv=test # -> de.acme.projectx:RestServices:test-SNAPSHOT
gradle publish -Penv=staging # -> de.acme.projectx:RestServices:staging-SNAPSHOT
gradle publish -Penv=prod # -> de.acme.projectx:RestServices:prod-SNAPSHOT |
4. Have Pinuts integrate your plugin
After your new plugin has been published to the respective S3 bucket, contact Pinuts Support to have us integrate the new plugin into your UM cloud deployment.
Tell us the full maven artifact name of the plugin and which SNAPSHOT or VERSION should go on which environment.
We will also give you an HTTP endpoint to trigger a deployment to test, staging or prod.
5. Trigger deployment
You will be able to trigger a deployment of your published plugin into the cloud-hosted UM by sending an HTTP request to our GitLab like this:
Codeblock | ||
---|---|---|
| ||
curl -X POST -F token=$TOKEN -F ref=$REF_NAME https://gitext.pinuts.de/api/v4/projects/$PROJECT_ID/trigger/pipeline |
We will provide you with the appropriate values for TOKEN
and PROJECT_ID
. REF_NAME
is the name of the destination environment and should always be test
, staging
or prod
.
6. Login to AWS console to watch the logs
Whenever your UM instance won’t start up properly, you will not be able to open Tools / Logs from the backoffice GUI to see what went wrong.
Go to https://eu-central-1.console.aws.amazon.com/cloudwatch/home?region=eu-central-1#logsV2:log-groups and sign in with the credentials you received (see section 3 above).