Top Related Projects
Logstash - transport and process your logs, events, or other data
:tropical_fish: Beats - Lightweight shippers for Elasticsearch & Logstash
Mirror of Apache Kafka
Apache Flume is a distributed, reliable, and available service for efficiently collecting, aggregating, and moving large amounts of log-like data
Apache NiFi
Apache Spark - A unified analytics engine for large-scale data processing
Quick Overview
pleaserun is a command-line tool that helps manage and run various types of system services, such as daemons, init scripts, and systemd units. It provides a unified interface for creating and managing these service types, making it easier to deploy and maintain applications across different operating systems and init systems.
Pros
- Cross-platform Compatibility: pleaserun supports a wide range of init systems, including SysV, Upstart, and systemd, allowing it to work seamlessly across different Linux distributions and operating systems.
- Simplified Service Management: The tool abstracts the complexities of service management, providing a simple and consistent interface for creating, starting, stopping, and monitoring system services.
- Flexible Configuration: pleaserun supports various configuration options, enabling users to customize the service behavior, such as environment variables, dependencies, and resource limits.
- Extensibility: The project is designed to be extensible, allowing users to add support for new init systems or service types through plugins.
Cons
- Limited Documentation: The project's documentation could be more comprehensive, making it challenging for new users to get started and understand the full capabilities of the tool.
- Dependency on Ruby: pleaserun is written in Ruby, which may not be the preferred language for some users, especially those who are more familiar with other programming languages.
- Potential Performance Overhead: As a Ruby-based tool, pleaserun may have some performance overhead compared to native init system commands, especially for simple service management tasks.
- Maintenance Concerns: The project's activity has slowed down in recent years, which could raise concerns about its long-term maintenance and support.
Code Examples
Not applicable, as pleaserun is a command-line tool and not a code library.
Getting Started
To get started with pleaserun, follow these steps:
- Install the pleaserun gem:
gem install pleaserun
- Create a new service configuration file. For example, to create a service for a simple Ruby script:
pleaserun --name my-service --program /path/to/my-script.rb
This will generate a service configuration file in the current directory.
- Install the service:
pleaserun --install my-service
This will install the service on your system, depending on the init system in use.
- Start the service:
pleaserun --start my-service
- Check the service status:
pleaserun --status my-service
- Stop the service:
pleaserun --stop my-service
You can also customize the service configuration by editing the generated file and using additional options, such as environment variables, dependencies, and resource limits. Refer to the pleaserun documentation for more information on the available configuration options.
Competitor Comparisons
Logstash - transport and process your logs, events, or other data
Pros of Logstash
- Logstash is a widely-used and well-supported open-source data processing pipeline, part of the Elastic Stack.
- It offers a rich set of input, filter, and output plugins, making it highly extensible and adaptable to various data processing needs.
- Logstash has a large and active community, providing extensive documentation, support, and community-contributed plugins.
Cons of Logstash
- Logstash can be more complex to set up and configure compared to pleaserun, especially for simpler use cases.
- The learning curve for Logstash may be steeper, as it has a more comprehensive feature set and configuration options.
Code Comparison
Logstash configuration example:
input {
file {
path => "/var/log/messages"
start_position => "beginning"
}
}
filter {
grok {
match => { "message" => "%{SYSLOGLINE}" }
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "logstash-%{+YYYY.MM.dd}"
}
}
pleaserun example:
require 'pleaserun'
p = PleaseRun.for_platform('systemd').new
p.name = 'my-service'
p.description = 'My custom service'
p.executable = '/path/to/my/script.sh'
p.user = 'myuser'
p.install
:tropical_fish: Beats - Lightweight shippers for Elasticsearch & Logstash
Pros of Beats
- Beats is a collection of lightweight data shippers, each with a specific purpose, such as collecting system metrics, logs, or network data.
- Beats are highly configurable and can be easily integrated with the Elastic Stack, providing a comprehensive solution for data collection and analysis.
- Beats have a large and active community, with a wide range of available plugins and integrations.
Cons of Beats
- Beats may have a steeper learning curve compared to pleaserun, as they are part of a larger ecosystem and require more configuration.
- Beats may have a higher resource footprint than pleaserun, as they include additional features and functionality.
Code Comparison
pleaserun:
def run(self, command, env=None, cwd=None, user=None, group=None, umask=None, chroot=None, workdir=None, pidfile=None, stdout=None, stderr=None, detach=False, wait=False, signal=None):
"""
Run a command with the given parameters.
"""
# ...
Beats:
func (b *Beat) Run() error {
defer logp.Sync()
defer logp.Info("Exiting %s", b.Info.Beat)
// ...
return b.launch(b.SetupMetrics, b.Run)
}
Mirror of Apache Kafka
Pros of Kafka
- Kafka is a highly scalable and fault-tolerant distributed streaming platform, making it suitable for handling large volumes of data.
- Kafka provides a robust set of features, including message replication, partitioning, and consumer groups, which enhance its reliability and performance.
- Kafka has a large and active community, with extensive documentation and a wide range of integrations with other tools and platforms.
Cons of Kafka
- Kafka has a steeper learning curve compared to pleaserun, as it requires a deeper understanding of distributed systems and message queuing concepts.
- Kafka's setup and configuration can be more complex, especially for smaller-scale use cases where pleaserun may be a simpler and more lightweight solution.
- Kafka's resource requirements, such as CPU, memory, and storage, can be higher than pleaserun, making it less suitable for resource-constrained environments.
Code Comparison
Kafka (Java):
Properties props = new Properties();
props.put("bootstrap.servers", "localhost:9092");
props.put("acks", "all");
props.put("retries", 0);
props.put("batch.size", 16384);
props.put("linger.ms", 1);
props.put("buffer.memory", 33554432);
props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
Producer<String, String> producer = new KafkaProducer<>(props);
producer.send(new ProducerRecord<>("my-topic", "key", "value"));
pleaserun (Ruby):
require 'pleaserun'
service = PleaseRun::Service.new do
name "my-service"
description "My awesome service"
command "/path/to/my/service"
user "myuser"
environment "FOO" => "bar"
end
service.install
Apache Flume is a distributed, reliable, and available service for efficiently collecting, aggregating, and moving large amounts of log-like data
Pros of Flume
- Flume is a robust and scalable distributed system for collecting, aggregating, and moving large amounts of log data.
- Flume provides a wide range of source, sink, and channel types, making it highly configurable and adaptable to various use cases.
- Flume is actively maintained and supported by the Apache community, ensuring ongoing development and bug fixes.
Cons of Flume
- Flume has a steeper learning curve compared to pleaserun, as it requires more configuration and setup to get started.
- Flume may be overkill for smaller-scale logging requirements, where pleaserun's simplicity and ease of use could be more suitable.
- Flume's complexity can make it more challenging to troubleshoot and debug issues, especially for beginners.
Code Comparison
Flume configuration (excerpt):
a1.sources = r1
a1.sinks = k1
a1.channels = c1
a1.sources.r1.type = spooldir
a1.sources.r1.spoolDir = /var/log/myapp
a1.sources.r1.fileHeader = true
a1.sources.r1.filePattern = *.log
a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path = /logs/%{host}/%y-%m-%d/%H%M/%S
a1.sinks.k1.hdfs.fileType = DataStream
a1.channels.c1.type = file
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
pleaserun configuration (excerpt):
run "my_app" do
command "/path/to/my_app"
user "myapp"
environment "RAILS_ENV" => "production"
stdout "/var/log/my_app/stdout.log"
stderr "/var/log/my_app/stderr.log"
pid_file "/var/run/my_app.pid"
end
Apache NiFi
Pros of NiFi
- NiFi provides a comprehensive set of features for data ingestion, processing, and distribution, making it a powerful tool for building complex data pipelines.
- NiFi has a user-friendly web-based interface that allows for easy configuration and monitoring of data flows.
- NiFi is highly scalable and can handle large volumes of data, making it suitable for enterprise-level applications.
Cons of NiFi
- NiFi has a steeper learning curve compared to pleaserun, as it offers a more complex set of features and functionality.
- NiFi may require more resources (e.g., CPU, memory) to run, especially for large-scale deployments, compared to the lightweight pleaserun.
- NiFi's web-based interface may not be suitable for all users, who may prefer a more command-line-oriented approach.
Code Comparison
Here's a brief comparison of the code for a simple task in both projects:
pleaserun
from pleaserun.platform import detect
from pleaserun.service import Service
service = Service(
name="my-service",
description="My example service",
exec="/path/to/my/script.sh",
)
platform = detect()
platform.install(service)
NiFi
<processor>
<name>ExecuteScript</name>
<config>
<properties>
<property name="Script Engine">groovy</property>
<property name="Script Body">
println "Hello, NiFi!"
</property>
</properties>
</config>
</processor>
In the pleaserun example, the code sets up a service and installs it on the detected platform. In the NiFi example, the code configures an ExecuteScript processor to print "Hello, NiFi!" when the flow is executed.
Apache Spark - A unified analytics engine for large-scale data processing
Pros of Spark
- Spark is a powerful and widely-used open-source distributed computing framework for large-scale data processing and machine learning.
- Spark provides a rich set of APIs for various programming languages, including Scala, Java, Python, and R, making it accessible to a wide range of developers.
- Spark's performance is generally superior to that of Pleaserun, as it is designed to handle large-scale data processing tasks efficiently.
Cons of Spark
- Spark has a steeper learning curve compared to Pleaserun, as it requires a deeper understanding of distributed computing concepts and its programming APIs.
- Spark's deployment and configuration can be more complex, especially in large-scale, production-ready environments.
Code Comparison
Pleaserun (jordansissel/pleaserun):
require 'pleaserun'
p = PleaseRun.new
p.name = "my-service"
p.program = "/usr/bin/my-service"
p.user = "myuser"
p.environment = { "MY_ENV_VAR" => "value" }
p.install
Spark (apache/spark):
val spark = SparkSession.builder()
.appName("My Spark Application")
.getOrCreate()
val df = spark.read.csv("data.csv")
df.select("column1", "column2").write.parquet("output.parquet")
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Please, Run!
Pleaserun is a tool to generate startup scripts and service definitions. It targets service managers such as systemd, Upstart, launchd, sysv init, and runit.
Ideally, you should be able to specify a configuration of how to run a given service command (like apache, syslog-ng, whatever), and this tool should be able to spit out a script or config file for your target platform.
Project Principles
- Community: If a newbie has a bad time, it's a bug.
- Engineering: Make it work, then make it right, then make it fast.
- Capabilities: If it doesn't do a thing today, we can make it do it tomorrow.
What's going on here?
With pleaserun, you can generate the following launchers/scripts/whatever:
- launchd
- upstart
- systemd
- runit
- sysv init
Want more? I want it to be easy to add things and invite you to file an issue with your ideas.
Installation
gem install pleaserun
Your First Process
First, we need a program to run!
Example: redis
For no particular reason, this example will choose redis to run. The idea is to simulate the same workflow you would normally go through in production: acquire software, deploy it, run it. Pleaserun helps you with the 'run it' part, but first let's get redis and build it.
wget http://download.redis.io/releases/redis-2.8.6.tar.gz
tar -zxf redis-2.8.6.tar.gz
cd redis-2.8.6
make -j4
make install PREFIX=/tmp/redis
Assuming the above succeeds (it did for me!), we now have redis installed to /tmp/redis
:
% ls /tmp/redis/bin
redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server
You might be thinking - why /tmp? This is just a demo! That's why! :)
Generate a runner
What platform are you on? Do you know the best way to run a server process? I can never remember.
Luckily, pleaserun remembers.
# Run as root so pleaserun has permissions to write to
# any files required to install this as a service!
% sudo pleaserun --install /tmp/redis/bin/redis-server
No platform selected. Autodetecting... {:platform=>"upstart", :version=>"1.5", :level=>:warn}
No name given, setting reasonable default {:name=>"redis-server", :level=>:warn}
Writing file {:destination=>"/etc/init/redis-server.conf"}
Writing file {:destination=>"/etc/init.d/redis-server"}
Note: The --install
flag above tells pleaserun to install it on this current system. The
default behavior without this flag is to install it in a temp directory so you can copy
it elsewhere if desired.
Now what? You can see above it automatically detected that "Upstart 1.5" was the right process runner to target. Let's try using it!
% status redis-server
redis-server stop/waiting
% sudo start redis-server
redis-server start/running, process 395
% status redis-server
redis-server start/running, process 395
% ps -fwwp 395
UID PID PPID C STIME TTY TIME CMD
root 395 1 0 06:27 ? 00:00:00 /tmp/redis/bin/redis-server *:6379
# Is it running? Let's check with redis-cli
% redis-cli
127.0.0.1:6379> ping
PONG
% sudo stop redis-server
redis-server stop/waiting
Bam. Pretty easy, right? Let's recap!
Recap
- You ran
pleaserun --install /tmp/redis/bin/redis-server
- Pleaserun detected the platform as Upstart 1.5
- You didn't have to write an init script.
- You didn't have to know how to write an Upstart config.
Overview
See pleaserun --help
for a list of flags. Basics:
-p
lets you set the platform to target. If not specified, this is automatically detected based on your current system/environment.-v
lets you set the version of the platform to target. Useful in cases where things like Upstart 0.6.5 differ wildly in configuration from Upstart 1.5--name
the name of the process. This shows up as /etc/init.d/the-name-you-give for sysv, or the name you use to reference the service with upstart, systemd, or launchd, etc!--prestart
lets you run a command before starting the main program. This can be used to do config or validation checks before you start a program. If the prestart exits nonzero, the start of the process will be aborted.
A silly example:
# Generate a LSB 3.1-compliant SYSV-style init script
% pleaserun --install -p sysv -v lsb-3.1 --name sleeper /bin/sleep 60
Writing file {:destination=>"/etc/init.d/sleeper"}
Writing file {:destination=>"/etc/default/sleeper"}
# Try it!
% /etc/init.d/sleeper status
sleeper is not running
% sudo /etc/init.d/sleeper start
sleeper started.
% ps -fwp $(cat /var/run/sleeper.pid)
UID PID PPID C STIME TTY TIME CMD
root 50473 1 0 22:36 pts/7 00:00:00 /bin/sleep 60
Hacking
If you want to work on pleaserun, here's what you need to do:
- Get a decent version of Ruby. rvm is good for this.
- Install bundler:
gem install bundler
- Install dependencies:
bundle install
- Make your changes!
- Run tests:
bundle exec rspec
- Make a pull request!
One last thing!
Please enjoy running things! If you are not enjoying this program, then something is wrong, and we can fix it together :)
If you are having a bad time, it is a bug!
All contributions welcome (bug reports, feature requests, bug fixes, new features, etc!)
Code of Conduct
This project has a code of conduct and uses the Contributor Covenant.
Top Related Projects
Logstash - transport and process your logs, events, or other data
:tropical_fish: Beats - Lightweight shippers for Elasticsearch & Logstash
Mirror of Apache Kafka
Apache Flume is a distributed, reliable, and available service for efficiently collecting, aggregating, and moving large amounts of log-like data
Apache NiFi
Apache Spark - A unified analytics engine for large-scale data processing
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot