SPAM (Smart Proxy Alb Manager)
CLI Tool to manage AWS ALB Target Groups and Rules for a Single Listner to setup Foreman Smart Proxies in bulk
- SPAM (Smart Proxy Alb Manager)
- Prerequisites
- Info
- Is It For Me?
- What Does it Do?
- Usage
- Install
- Global Install
- Local Install
- Config
- SPAM
- Install
- Optional Settings
- AWS
- Commands
- Chef
- Commands
- Flags/Options
- Use Cases
- Complete Setup
- Existing Docker Swarm
- Development
- How to Contribute
- External Contributors
- Internal Contributors
- Use Cases
Prerequisites
- Ruby 2.3 or later
- Docker 1.12 or later
- Bundler
Info
Is It For Me?
SPAM is a CLI Tool to support The Foreman Smart Proxies and Plugins for the following type of situations
- Using AWS?
- Already Have a ALB and Endpoint Created (or using Cloudformation)?
- Chef Users
- Multi-Chef Orgs that need a smart proxy each?
- Mutli-Chef Orgs that match Foreman Organizations and need Smart Proxies for each Chef Org, under each Foreman Org?
What Does it Do?
SPAM Wraps the Docker API, AWS API, and Foreman API so it can act as the glue or coordinator between these services to create smart proxies in bulk.
- Docker Swarm
- Create a Swarm (Optional, can just Provide Swarm Manager IP for existing Swarm)
- Join a Swarm (Optional, can use docker cli instead)
- Creates Docker Service using (Optional, can just provide port for org container) Dockerized Foreman Chef Smart Proxy for a specified org
- Creates Target Group for Chef Org to Route traffic to created Smart Proxy
- Creates Rule to forward based on proxy_url + org path (e.g.
https://proxy.domain.com/org
) - Registers Target(s) (aka Instances) for ALB to round robin to
- Can be single or mutliple. Recommended to just add each instance you run SPAM on
- Create Smart Proxy in Foreman with all data from above
- Write out all relevent data to YAML file for org creations (Swarm, ALB, and Foreman) so you can query or delete SPAM managed items
- Sync org data files (YAMLs) to S3 (Optional, only syncs if --bucket-name flag is used or in
~/.spam/config./yml
)- Done after every create
- Done before every list and delete
Usage
Install
Global Install
Run the following
gem install bundler
bundle install
Local Install
gem install bundler
bundle install --path vendor/bundle
Config
SPAM
Any flag/option can be configured via YAML for options that won't change
NOTE: Only recommended settings are show below, things like org, port, priority, tagets should be dynamic
~/.spam/config.yml
---
vpc: VPC
listener_arn: ARN
foreman_user: USER
foreman_password: PASSWORD
proxy_url: https://proxy.domain.com
# Optional Settings
aws_region: REGION
protocol: HTTP
swarm_ip: IP
swarm_as: worker/manager
swarm_join: true/False
chef_url: https://chef.domain.com
AWS
Default credentials are loaded automatically from the following locations:
-
ENV['AWS_ACCESS_KEY_ID']
andENV['AWS_SECRET_ACCESS_KEY']
Aws.config[:credentials]
- The shared credentials ini file at
~/.aws/credentials
- From an instance profile when running on EC2
Commands
Commands to interact with Docker, AWS ALB, and The Foreman
NOTE: Chef is the only support Smart Proxy setup currently, as we expand our integrations and services we will add more to the tool. Pull Request always welcome!
Chef
Commands
Command | Description |
---|---|
Create | Creates the Chef Org Proxy on Dockerhost, ALB Rules/Paths, and adds Smart Proxy to Foreman |
Delete | Deletes all items generated by Create Command |
Add | Command to add targets to specific Org Configuration |
List | List current SPAM Configs/Orgs |
Flags/Options
Arg | Description |
---|---|
Use Cases
Complete Setup
Existing Docker Swarm
Projects Using SPAM
Development
How to Contribute
External Contributors
- Fork the repo on Github
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- Submit a Pull Request so that we can review your changes
NOTE: Be sure to merge the latest from "upstream" before making a pull request!
Internal Contributors
- Clone the project to your own machine
- Create a new branch from master
- Commit changes to your own branch
- Push your work back up to your branch
- Submit a Pull Request so the changes can be reviewed
NOTE: Be sure to merge the latest from "upstream" before making a pull request!