This is the puppet side of https://github.com/RyanJarv/randrust. Same as that this was just an interview related project that I spent far too much time on, at best it might serve as a decent example of how to operationalize a simple service.
- Description
- Setup - The basics of getting started with randrust
- Usage - Configuration options and additional functionality
- Reference
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
- Contributor's/Reference's
Puppet module for installing and configuring randrust a rust web app that returns a random base64 encoded string of a given length.
After the app is setup it will respond to requests at the endpoint /key/(int) where int is the plaintext length.
Only ubuntu 16.04, 18.04 and debian 9 are tested and supported currently.
- Setups up an additional apt repository for https://packagecloud.io/jarv/test.
- Installs the randrust package from the above repo.
This module will work with the default settings so all that is needed is to include the randrust class.
include randrust
If you just want to test this repo out you can use this module as is to configure a local node with vagrant. See Developing section for more info.
See REFERENCE
- Ubuntu 18.04
- Ubuntu 16.04
- Debian 9
The following parameters or are not usefull in practice currently. This will change if/when the randrust package adds support for them.
- service_provider
- service_name
This module uses kitchen terraform for testing. To set this up the following things need to be installed.
- VirtualBox
- Vagrant
- Ruby (Preferably a somewhat recent version)
- Bundler
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew cask install virtualbox
brew cask install vagrant
brew cask install ruby
gem install bundler
# Setup ruby path each time you need it
export PATH="/usr/local/opt/ruby/bin:$PATH
# Or add it to your profile and open a new terminal window
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
git clone https://github.com/RyanJarv/puppet-randrust.git
cd puppet-randrust
bundle install --path vendor/bundle
Runs on your local machine, faster then Test Kitchen or acceptance tests.
./scripts/unit_tests.sh
This converges and runs serverspec tests against a local VirtualBox VM.
Initial setup is slower then unit tests but subsequent runs are about the same.
Before any kitchen commands run make sure to run the following at least once.
bundle exec librarian-puppet install
bundle exec kitchen list
Instance Driver Provisioner Verifier Transport Last Action Last Error
base-ubuntu18-randrust Vagrant PuppetApply Busser Sftp <Not Created> <None>
base-ubuntu16-randrust Vagrant PuppetApply Busser Sftp <Not Created> <None>
base-debian-randrust Vagrant PuppetApply Busser Sftp <Not Created> <None>
This can be rerun as you make changes untill it succeeds.
bundle exec librarian-puppet install
bundle exec kitchen verify base-ubuntu18-randrust
-----> Starting Kitchen (v2.3.3)
-----> Creating <base-ubuntu18-randrust>...
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/bionic64'...
==> default: Matching MAC address for NAT networking...
...
Once your done use bundle exec kitchen destroy
to shutdown the VM's.
Will run the destroy/create/test/destroy process for all machines. Run this at least once before you make a PR.
bundle exec librarian-puppet install
bundle exec kitchen test
Afterwards if all nodes show as not created in bundle exec kitchen list
then the run succeeded.
This uses (puppet-strings)[https://puppet.com/docs/puppet/5.5/puppet_strings.html#reference-4095] to create the reference file.
./scripts/generate_references.sh
Files: 4
Modules: 0 ( 0 undocumented)
Classes: 0 ( 0 undocumented)
Constants: 0 ( 0 undocumented)
Attributes: 0 ( 0 undocumented)
Methods: 0 ( 0 undocumented)
Puppet Defined Types: 0 ( 0 undocumented)
Puppet Functions: 0 ( 0 undocumented)
Puppet Data Types: 0 ( 0 undocumented)
Puppet Data Type Aliases: 0 ( 0 undocumented)
Puppet Tasks: 0 ( 0 undocumented)
Puppet Types: 0 ( 0 undocumented)
Puppet Providers: 0 ( 0 undocumented)
Puppet Plans: 0 ( 0 undocumented)
Puppet Classes: 4 ( 0 undocumented)
100.00% documented
Code used as reference for this module is listed here along with the license of the project.
- scoopex/puppet-kitchen_template
- Reference for implementing Test Kitchen in a puppet module (typically this is used with chef).
- BSD-2
- puppetlabs/puppetlabs-ntp
- Reference for implementing a typical service in puppet.
- Apache-2.0
- Puppet Development Kit
- Scaffolding for module, manifests and unit tests.
- Apache-2.0