Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue-840: Create an RPM distribution #855

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
93 changes: 91 additions & 2 deletions strongbox-distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>2.0.0</version>

<configuration>
<configurationDirectory>conf</configurationDirectory>
Expand Down Expand Up @@ -338,7 +337,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
Expand All @@ -355,6 +353,97 @@
<tarLongFileMode>gnu</tarLongFileMode>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>rpm</goal>
</goals>
</execution>
</executions>
<configuration>
<group>Strongbox</group>
<description>Strongbox distribution version ${project.version}.</description>
<defineStatements>
<defineStatement>_binaries_in_noarch_packages_terminate_build 0</defineStatement>
</defineStatements>
<mappings>
<mapping>
<filemode>0755</filemode>
<directory>/usr/local/strongbox/bin</directory>
<sources>
<source>
<location>${project.build.directory}/assembly/strongbox-${project.version}/bin</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/usr/local/strongbox/etc</directory>
<sources>
<source>
<location>${project.build.directory}/assembly/strongbox-${project.version}/etc</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/usr/local/strongbox/lib</directory>
<sources>
<source>
<location>${project.build.directory}/assembly/strongbox-${project.version}/lib</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/usr/local/strongbox/logs</directory>
<sources>
<source>
<location>${project.build.directory}/assembly/strongbox-${project.version}/logs</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/usr/local/strongbox/tmp</directory>
<sources>
<source>
<location>${project.build.directory}/assembly/strongbox-${project.version}/tmp</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/usr/local/strongbox/webapp</directory>
<sources>
<source>
<location>${project.build.directory}/assembly/strongbox-${project.version}/webapp</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/usr/bin</directory>
<sources>
<softlinkSource>
<location>/usr/local/strongbox/bin/strongbox</location>
</softlinkSource>
</sources>
</mapping>
<mapping>
<directory>/etc/systemd/system</directory>
<directoryIncluded>false</directoryIncluded>
<sources>
<source>
<location>${project.basedir}/src/main/resources/strongbox.service</location>
</source>
</sources>
</mapping>
</mappings>
<postinstallScriptlet>
<scriptFile>src/main/resources/postinstall</scriptFile>
<fileEncoding>utf-8</fileEncoding>
<filter>true</filter>
</postinstallScriptlet>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
3 changes: 3 additions & 0 deletions strongbox-distribution/src/main/resources/postinstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
groupadd strongbox
useradd -d /usr/local/strongbox -g strongbox strongbox
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be a regular user but rather a system one. Could you please add --system here?

Suggested change
useradd -d /usr/local/strongbox -g strongbox strongbox
useradd -d /usr/local/strongbox -g strongbox --system strongbox

chown -R strongbox:strongbox /usr/local/strongbox/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, make sure you add new lines to the end of files when creating, or editing them, as this can sometimes be a problem on different operating systems.

13 changes: 13 additions & 0 deletions strongbox-distribution/src/main/resources/strongbox.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Strongbox
After=network.target network-online.target
Wants=network-online.target

[Service]
ExecStart=/usr/local/strongbox/bin/strongbox start
ExecStop=/usr/local/strongbox/bin/strongbox stop
ExecReload=/usr/local/strongbox/bin/strongbox restart
User=strongbox

[Install]
WantedBy=multi-user.target
15 changes: 15 additions & 0 deletions strongbox-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,21 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.5.RELEASE</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>2.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.2.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
Expand Down