Skip to content

Commit

Permalink
(#1) create a minimal gem
Browse files Browse the repository at this point in the history
  • Loading branch information
ripienaar committed Nov 3, 2018
1 parent ce4b7db commit 4207796
Show file tree
Hide file tree
Showing 375 changed files with 192 additions and 35,827 deletions.
15 changes: 15 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
jobs:
rspec_and_rubocop:
docker:
- image: circleci/ruby:2.4-node
steps:
- checkout
- run: bundle install
- run: bundle exec rake test

workflows:
version: 2
test:
jobs:
- rspec_and_rubocop
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
doc
build
etc/*cfg
etc/*yaml
Expand All @@ -7,9 +6,6 @@ etc/ssl/clients/*pem
plugins/mcollective/security/none.rb
tags
pkg
.localeapp
Gemfile.lock
.bundle
ext/packaging
.idea
Gemfile.local
.ruby-version
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

74 changes: 74 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
48 changes: 42 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,45 @@
# How to contribute

Third-party patches are essential for keeping Puppet open-source projects
great. We want to keep it as easy as possible to contribute changes that
allow you to get the most out of our projects. There are a few guidelines
that we need contributors to follow so that we can have a chance of keeping on
top of things. For more info, see our canonical guide to contributing:
This project relies on your contributions for it's continued success. We want to make the process as easy as possible but a few guidelines are needed.

[https://github.com/puppetlabs/puppet/blob/master/CONTRIBUTING.md](https://github.com/puppetlabs/puppet/blob/master/CONTRIBUTING.md)
First please note that participation is bound by our [Code Of Conduct](CODE_OF_CONDUCT.md).

# Issues

We do not have strong guidelines on what you put in an issue, we'll gladly work with you to gather the information we require. We do ask that you try to put as much detail as possible to help everyone use their time in a meaningful way.

# PRs

Almost every PR will need an issue first. You do not need issues for trivial updates like typos, most documentation updates etc. But if you're doing a PR that adjusts behavior we will need a issue to go with it.

Once you have an issue note the number and once you are ready to send your PR please squash your commits then make a single commit with something like the following format:

```
(#123) Add a super awesome feature
This adds a new super awesome feature that everyone would love,
it can be used for such and such.
To deliver this feature we had to extend, this that and the other
with new behaviours
Backwards compatibility is kept
```

Please see [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/) for excellent coverage of the topic of commit messages. We don't require things to be as detailed or strict as that but it's a great resource to keep in mind.

Short updates obviously do not need all this, very often I am happy with just a 1 line commit message that matches the first line above.

For trivial updates without issues and where context is not needed:

```
(misc) Fix typo in README.md
```

# Finding others in the community

Usually we like to keep discussions on issues where they relate but of course we are very happy to chat in a more real time manner, especially useful if you want to find out our thoughts on your proposed changes ahead of spending your valuable time on them:

* [Mailing List](https://groups.google.com/forum/#!forum/choria-users)
* [#choria on the Puppet Slack](http://slack.puppet.com/)
* #mcollective on Freenode
47 changes: 10 additions & 37 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,10 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

gem 'stomp', '>= 1.4.4'

if RUBY_VERSION =~ /^1\.8/
gem 'systemu', '2.6.4'
gem 'json', '~> 1.8.3'
else
gem 'systemu'
end

if RUBY_VERSION =~ /^2\.4/
gem 'json', '~> 2.1.0'
end

group :dev do
gem 'rake', '~> 10.4'
if RUBY_VERSION =~ /^2\.[0-9]\.[0-9]/
gem 'rubocop', '~> 0.48.1', :platforms => [:ruby]
end
end

group :test do
if RUBY_VERSION =~ /^1\.8/
gem 'rdoc', '~> 4.2.2'
else
gem 'rdoc'
end
gem 'yarjuf', "~> 1.0"
gem 'rspec', '~> 2.11.0'
gem 'mocha', '~> 0.10.0'
gem 'mcollective-test'
end

if File.exists? "#{__FILE__}.local"
eval(File.read("#{__FILE__}.local"), binding)
end
source ENV["GEM_SOURCE"] || "https://rubygems.org"

gem "json", "~> 2.1.0"
gem "systemu", "~> 2.6.4"
gem "rdoc"
gem "yarjuf", "~> 1.0"
gem "rspec", "~> 2.11.0"
gem "mocha", "~> 0.10.0"
gem "mcollective-test"
gem "rake", "< 11.0"
2 changes: 1 addition & 1 deletion COPYING → LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2010, 2011 Puppet Labs
Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
27 changes: 0 additions & 27 deletions MAINTAINERS

This file was deleted.

6 changes: 6 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Choria Orchestrator

Copyright 2018 R.I.Pienaar <[email protected]>

This product includes software developed at
The Choria Project (https://choria.io).
110 changes: 8 additions & 102 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,105 +1,11 @@
# The Marionette Collective
# Choria MCollective RPC Ruby Support Libraries

The Marionette Collective aka. mcollective is a framework to build server orchestration or parallel job execution systems.
These are stripped down versions of the legacy MCollective libraries that
are used to facilitate hosting Ruby based MCollective Agents within the
Golang daemon as well as interact with a Choria network from the Ruby API
and `mco` CLI

For documentation please see https://docs.puppet.com/mcollective
It's not possible to run the old MCollective daemon using this code or the
resulting gem.

## Developing

The documentation above details how MCollective works and many of its extension points.

### Spec Tests

To run spec tests
```
bundle install
bundle exec rake test
```

### Acceptance Tests

To run acceptance tests, see [this][acceptance].

### Development Environment (MacOS)

Setup ActiveMQ using acceptance config:
```
brew install activemq
cp acceptance/files/activemq.* /usr/local/opt/activemq/libexec/conf
activemq start
```

ActiveMQ can later by stopped with `activemq stop`. ActiveMQ logs are located at
`/usr/local/opt/activemq/libexec/data/activemq.log`.

Setup MCollective with acceptance config:
```
mkdir -p ~/.puppetlabs/etc/mcollective/ssl-clients
cp acceptance/files/client.* ~/.puppetlabs/etc/mcollective
cp acceptance/files/server.* ~/.puppetlabs/etc/mcollective
cp acceptance/files/ca_crt.pem ~/.puppetlabs/etc/mcollective
cp acceptance/files/client.crt ~/.puppetlabs/etc/mcollective/ssl-clients/client.pem
ln -s ~/.puppetlabs/etc/mcollective/client.cfg ~/.mcollective
```

Modify `client.cfg` to work on the local machine:
* Change the `ssl_server_public`, `ssl_client_private`, `ssl_client_public`
paths to point to `~/.puppetlabs/etc/mcollective/{server.crt,client.key,client.pem}`.
* Change the `activemq.pool.1.ssl.{ca,cert,key}` paths to
`~/.puppetlabs/etc/mcollective/{ca_crt.pem,client.crt,client.key}`.
Note that `~` needs to be expanded to the full path. Also, that `client.pem` doesn't
point to an actual file is intentional (I don't fully understand why).

Create `server.cfg`, updating `<user>`:
```
main_collective = mcollective
collectives = mcollective
logger_type = console
loglevel = info
daemonize = 0
securityprovider = ssl
plugin.ssl_server_private = /Users/<user>/.puppetlabs/etc/mcollective/server.key
plugin.ssl_server_public = /Users/<user>/.puppetlabs/etc/mcollective/server.crt
plugin.ssl_client_cert_dir = /Users/<user>/.puppetlabs/etc/mcollective/ssl-clients
connector = activemq
plugin.activemq.pool.size = 1
plugin.activemq.pool.1.host = activemq
plugin.activemq.pool.1.port = 61613
plugin.activemq.pool.1.user = mcollective
plugin.activemq.pool.1.password = marionette
plugin.activemq.pool.1.ssl = true
plugin.activemq.pool.1.ssl.ca = /Users/<user>/.puppetlabs/etc/mcollective/ca_crt.pem
plugin.activemq.pool.1.ssl.cert = /Users/<user>/.puppetlabs/etc/mcollective/server.crt
plugin.activemq.pool.1.ssl.key = /Users/<user>/.puppetlabs/etc/mcollective/server.key
```

The configuration above uses `activemq` as the name of the ActiveMQ broker. MCollective
will enforce that the SSL certificate presented by the server matches the name it's trying
to connect to. To use the configuration above, traffic to `activemq` must be redirected to
the local host. On most machines, that can be accomplished with
```
sudo echo "127.0.0.1   activemq" >> /etc/hosts
```

From the root of this repository, test the setup by running a server
```
RUBYLIB=lib bundle exec bin/mcollectived --config ~/.puppetlabs/etc/mcollective/server.cfg
```
and client
```
RUBYLIB=lib bundle exec bin/mco ping
```

Note that it may be useful to change the `loglevel` in `client.cfg` to debug issues with
`mco ping`.

To enable specific plugins, you may need to set `libdir` in `server.cfg` and add plugin-specific configuration.

## Contributing

Please refer to [this][contributing] document.

[contributing]: CONTRIBUTING.md
[acceptance]: acceptance/README.md
For further information please see [https://choria.io](https://choria.io/)
Loading

0 comments on commit 4207796

Please sign in to comment.