Skip to content

Complete Guide of own update center using Juseppe

Merkushev Kirill edited this page May 30, 2016 · 4 revisions

This guide will help you to do it with help of Juseppe (Jenkins Update Site Embedded for Plugin Publishing Easily), docker and UpdateSites Manager plugin.

Prepare Jenkins

First of all you need to install UpdateSites Manager plugin. This plugin will help you to add new update sites to your jenkins. Its easy and we don't waste time on writing/reading how to do it.

Setup Juseppe

Next step is installing docker and getting fresh juseppe image. This image can be found on Docker Hub

docker pull lanwen/juseppe

Now you should mount volume for container to watching to directory where the plugins are. As for me, it is convenient to save plugins in /var/lib/juseppe/plugins (remember to set corresponding rights on this folder).

Also need to setup port mapping (-p docker flag) and base uri (env var JUSEPPE_BASE_URI), which prefixes any link to plugin file inside of update-site.json.

docker run -d --name juseppe -v /var/lib/juseppe/plugins:/juseppe/plugins -p 80:8080 -e JUSEPPE_BASE_URI=http://juseppe.company.net lanwen/juseppe

Setup Jenkins

Goto your jenkins and add new site http://jenkins.company.net/updatesites/. You need to fill ID with juseppe and URL with http://juseppe.uri/update-center.json.

Also you should fill CA Certificate (under Need CA Certificate checkbox). This certificate can be retrieved with docker command docker run --rm lanwen/juseppe cert (as of it built-in to container by default and regenerated every docker image build)

Thats it! Now you can deploy your plugins to /var/lib/juseppe/plugins directory and watch them on update-center.json and release-history.json.

How to automatically deploy by ssh with maven

You need to enable wagon ssh extension in build section of your pom:

<build>
<!-- ... -->
    <extensions>
        <!-- Enabling the use of SSH -->
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-ssh-external</artifactId>
            <version>2.9</version>
        </extension>
    </extensions>
</build>

Then turn off default deploy and enable ssh deploy:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-deploy-plugin</artifactId>
    <configuration>
        <skip>true</skip>
    </configuration>
</plugin>

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>wagon-maven-plugin</artifactId>
    <version>1.0</version>
    <executions>
        <execution>
            <phase>deploy</phase>
            <goals>
                 <goal>upload-single</goal>
            </goals>
        </execution>
     </executions>
     <configuration>
         <fromFile>${project.build.directory}/${project.build.finalName}.hpi</fromFile>
         <url>scpexe://${plugin-repo}</url>
     </configuration>
</plugin>

Setup property with juseppe server location:

<properties>
        <!--make own with https://github.com/yandex-qatools/juseppe-->
        <plugin-repo>juseppe.company.net/var/lib/juseppe/plugins</plugin-repo>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
</properties>

Now you can just do mvn clean deploy and upload new version to update center.

Advanced usage

Own certificate

If you have your own certificate, then you should mount it to docker container. For example, generate own self-signed cert as described in juseppe readme. Then start juseppe with docker command:

docker run -d --name juseppe \
-v /var/lib/juseppe/plugins:/juseppe/plugins \
-v /home/user/uc.key:/juseppe/cert/uc.key \
-v /home/user/uc.crt:/juseppe/cert/uc.crt \
-p 80:8080 -e JUSEPPE_BASE_URI=http://juseppe.company.net lanwen/juseppe

This can help you to avoid updating cert content when updating juseppe docker image.

Only generate

You can just generate json files without starting jetty server to serve files. Just add generate at the end of docker command and add volume where you want to write json files.

docker run --rm \
-v /var/lib/juseppe/plugins:/juseppe/plugins \
-v /home/user/uc.key:/juseppe/cert/uc.key \
-v /home/user/uc.crt:/juseppe/cert/uc.crt \
-v /home/user/json:/juseppe/json \
-e JUSEPPE_BASE_URI=http://juseppe.company.net lanwen/juseppe generate

You can change it to --watch generate to watch for changes, but without starting web-server. It will be regenerate json files on any plugin list changes.

docker run -d --name juseppe \
-v /var/lib/juseppe/plugins:/juseppe/plugins \
-v /home/user/uc.key:/juseppe/cert/uc.key \
-v /home/user/uc.crt:/juseppe/cert/uc.crt \
-v /home/user/json:/juseppe/json \
-e JUSEPPE_BASE_URI=http://juseppe.company.net lanwen/juseppe --watch generate

More config options

All config options can be overridden. Complete list of them can be found with help of docker run --rm lanwen/juseppe env