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

New source: pleaserun #1119

merged 15 commits into from May 26, 2016


Copy link

jordansissel commented May 26, 2016

The pleaserun tool helps generate service manifests for different service platforms such as systemd and runit.

This PR introduces pleaserun as a package source. The goal is to have a package you can install that will "do the right thing" and install the best-fitting service manifest for the target system.

Example usage:

% fpm -s pleaserun -t rpm -a all -n redis-service --pleaserun-name redis /usr/bin/redis-server

% sudo yum install redis-service-1.0-1.noarch.rpm
  Installing  : redis-service-1.0-1.noarch                                                            1/1
Platform systemd (default) detected. Installing service.
To start this service, use: systemctl start redis
  Verifying   : redis-service-1.0-1.noarch                                                            1/1

  redis-service.noarch 1.0-1

% systemctl status redis
● redis.service - redis
   Loaded: loaded (/usr/lib/systemd/system/redis.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

Yay, easy services!

It also tries to clean up during package removal:

% sudo yum remove redis-service
Running cleanup to remove service for package redis-service

% sudo systemctl status redis
● redis.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
jordansissel added 15 commits May 13, 2016
Long term, we'll probably have a "smart" post-install that will choose
the correct service (systemd, etc) to install based on the platform
doing the installation, not the platform creating the package :)

Adds dependencies on pleaserun and upgrades clamp to suit.

Example using the defaults in pleaserun:

    # Create a package called 'example-service' that installs a service named 'example'
    % bin/fpm -s pleaserun -t rpm -n example-service --pleaserun-name example  =logger hello world
    No platform selected. Autodetecting... {:platform=>"systemd", :version=>"default", :level=>:warn}
    Writing file {:destination=>"/tmp/package-pleaserun-staging20160513-12576-1ozurnf/lib/systemd/system/example.service"}
    Writing install actions. You will want to run this script to properly activate your service on the target host {:path=>"/tmp/package-pleaserun-staging20160513-12576-1ozurnf/"}
    Created package {:path=>"example-service-1.0-1.x86_64.rpm"}

    # ^^ The above service will execute "logger hello world"

    # What's in our rpm?
    % rpm -qlp example-service-1.0-1.x86_64.rpm

    # What about any post-install steps?
    % rpm -qp example-service-1.0-1.x86_64.rpm --scripts
    postinstall scriptlet (using /bin/sh):
    systemctl --system daemon-reload

    # Install it.
    % sudo rpm -ivh example-service-1.0-1.x86_64.rpm

    # Start it.
    % sudo systemctl start example

    # Check the logs!
    % sudo tail -n1 /var/log/messages
    May 13 03:32:55 localhost root: hello world

Example choosing 'sysv' as the platform:

    % bin/fpm -s pleaserun -t rpm -n example-service --pleaserun-platform sysv --pleaserun-name example  =logger hello world
    Writing file
    Writing file
    Created package {:path=>"example-service-1.0-1.x86_64.rpm"}

    % rpm -qlp example-service-1.0-1.x86_64.rpm
… detected.

Also move files to be /platform/version/... instead of
* Only try install actions if they exist
* Add special case for Upstart 0.6.5 (CentOS 6)
The scripts will be written to the top-level `.scripts/` directory
The `` will generate a script that is executed when
the package is removed.
…. Without this, the default is 'no description given' which is not a helpful default

This comment has been minimized.

Copy link

untergeek commented May 26, 2016



This comment has been minimized.

Copy link
Owner Author

jordansissel commented May 26, 2016

Specs reasonably passing for me. This PR adds no meaningful tests, but that's partly because I'm still trying to figure out a nice way to actually test it.

@jordansissel jordansissel merged commit 77317e3 into master May 26, 2016
1 of 2 checks passed
1 of 2 checks passed
continuous-integration/travis-ci/pr The Travis CI build is in progress
continuous-integration/travis-ci/push The Travis CI build passed
jordansissel added a commit that referenced this pull request Jun 20, 2016
@josegonzalez josegonzalez deleted the feature/pleaserun branch Nov 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.