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 #1068

Merged
merged 14 commits into from
Mar 10, 2019
Merged

Issue-840: Create an RPM distribution #1068

merged 14 commits into from
Mar 10, 2019

Conversation

carlspring
Copy link
Member

@carlspring carlspring commented Feb 24, 2019

Fixes #840. Done by @v3rtumnus!

Rebased @v3rtumnus 's #855.

@v3rtumnus ,

Sorry for getting back to this with such a big delay (it's not typical for our project), but we had more pressing problems with our Spring Boot migration, as well as some issues with the parallelization of our tests. I have rebased your original pull request and pushed it to a different branch.

@steve-todorov , @v3rtumnus : Would you like to try this out?

@steve-todorov : We will have to come up with a build process in Jenkins that either runs separately on a CentOS/Opensuse node after strongbox has been built, or make the Jenkins nodes have rpmbuild on them.

Tasks:

  • Rebase Issue-840: Create an RPM distribution #855 onto the master.
  • Apply any required fixes to the rebased code, caused by changes from the master.
  • Update the version of the maven-assembly-plugin in the strongbox-parent to 3.1.1.
  • Make the rpm-maven-plugin output the rpm under target, (instead of target/rpm/strongbox-distribution/RPMS/noarch).
  • Attach the produced rpm as a Maven artifact.
  • Fix the Maven plugin version warnings.
  • Drop the timestamp from the RPM's version. [Not possible].
  • Re-structure the rpm to use /opt.
  • The lib directory contains a ton of dependencies which shouldn't be there.
  • Add a the rpm build in a Maven profile, which is triggered by invoking mvn clean install -Pbuild-rpm.
  • Make the finalName of the RPM follow the RPM naming when deploying to Github. [Not possible]
  • Sort out variable comments raised by @steve-todorov.

Useful rpm commands:

  • List installed packages:
rpm -qa 
  • Check if the strongbox package is installed:
rpm -qa | grep strongbox
  • Install package:
rpm -ivh strongbox-distribution-1.0-SNAPSHOT.rpm
  • List package contents
rpm -qlp strongbox-distribution-1.0-SNAPSHOT20190309035450.x86_64
  • Remove package:
rpm -e strongbox-distribution-1.0-SNAPSHOT20190309035450.x86_64

@steve-todorov
Copy link
Member

steve-todorov commented Feb 24, 2019

There are a few things which need to be changed here:

  1. /usr/local/strongbox is probably not the best place to put the distribution. According to Linux Foundation

    No other directories, except those listed below, may be in /usr/local after first installing a FHS-compliant system.

    If we are going to be putting Strongbox under /usr/local/ it will need to be under /usr/local/bin/strongbox, /usr/local/etc, /usr/local/lib`, etc.

    In my opinion, a better place to place the distribution under /opt/strongbox (link)

  2. I suggest a few changes to the .service:

[Unit]
Description=Strongbox Repository Manager
Documentation=https://strongbox.github.io/
After=network-online.target firewalld.service
Wants=network-online.target

[Service]
Type=simple
User=strongbox
Environment=STRONGBOX_HOME=/opt/strongbox
Environment=STRONGBOX_VAULT=/opt/strongbox-vault
Environment=STRONGBOX_PORT=48080
ExecStart=/opt/strongbox/bin/strongbox console
ExecStop=/opt/strongbox/bin/strongbox stop
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always

# Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
# Both the old, and new location are accepted by systemd 229 and up, so using the old location
# to make them work for either version of systemd.
StartLimitBurst=3

# Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
# Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
# this option work for either version of systemd.
StartLimitInterval=60s

[Install]
WantedBy=multi-user.target

Also, I have a feeling this might need to be separated into a new project (maybe similar to strongbox-web-integration-tests):

  1. How is this going to build on a Windows or MacOS ? (I doubt windows has rpm-build in a package manager somewhere? :D )
  2. We will probably need to create some tests which check if the distribution actually works:
    • Does it start from tar.gz and does it work (i.e. strongbox against strongbox build) ?
    • Does it start from zip and does it work (i.e. strongbox against strongbox build) ?
    • Does it start from rpm and does it work (i.e. strongbox against strongbox build) ?
    • Does it start from deb and does it work (i.e. strongbox against strongbox build) ?

@carlspring carlspring force-pushed the issue-840-rebased branch 2 times, most recently from 19e939f to b21200c Compare March 5, 2019 01:40
@carlspring
Copy link
Member Author

@v3rtumnus ,

Would you like to give this a try?

- Set the directories to `/opt/strongbox` and `/opt/strongbox-vault`.
- Fixed the truncating of the long file names in the distributions.
- Updated the `Jenkinsfile` to deploy the `rpm` to Github.
@carlspring carlspring merged commit 2e3a39a into master Mar 10, 2019
@carlspring carlspring deleted the issue-840-rebased branch March 10, 2019 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create an RPM distribution
3 participants