{"id":18524455,"url":"https://github.com/stelligent/stelligent_commons","last_synced_at":"2025-04-09T11:32:07.182Z","repository":{"id":24985524,"uuid":"28404041","full_name":"stelligent/stelligent_commons","owner":"stelligent","description":"Scripts and other utilities we commonly use","archived":false,"fork":false,"pushed_at":"2020-01-07T20:17:37.000Z","size":4809,"stargazers_count":48,"open_issues_count":1,"forks_count":55,"subscribers_count":89,"default_branch":"master","last_synced_at":"2025-03-24T05:25:04.424Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stelligent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-23T15:07:34.000Z","updated_at":"2022-10-13T11:40:36.000Z","dependencies_parsed_at":"2022-08-20T18:40:52.172Z","dependency_job_id":null,"html_url":"https://github.com/stelligent/stelligent_commons","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stelligent%2Fstelligent_commons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stelligent%2Fstelligent_commons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stelligent%2Fstelligent_commons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stelligent%2Fstelligent_commons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stelligent","download_url":"https://codeload.github.com/stelligent/stelligent_commons/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248031653,"owners_count":21036447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T17:41:49.999Z","updated_at":"2025-04-09T11:32:03.604Z","avatar_url":"https://github.com/stelligent.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"stelligent_commons\n==================\n\nScripts and other utilities we commonly use at Stelligent\n\n\n# Development Environment\nCheck out the [wiki](https://github.com/stelligent/stelligent_commons/wiki/Development-Environment-Setup) for some development environment options.\n\n# VPC Networking\n\n## Basic Usage to create a VPC\n\nPrerequisites: Ruby 2.1 with Bundler should be installed.\n\n1. From the stelligent_commons root directory, run:\n\n        bundle install\n\n2. Run one of the example scripts under the bin directory to generate a CloudFormation template.  The name of the script\n   roughly reflects the type of VPC it is going to create.\n\n        bin/generate_private_vpc \u003e private_vpc_cfn_template.json\n        bin/generate_3az_vpc --ip-to-allow-to-bastion xx.xx.xx.xx --nat-keypair-name key-name --bastion-keypair-name key-name \u003e 3az_vpc_cfn_template.json\n        bin/generate_typical_2az_vpc --ip-to-allow-to-bastion xx.xx.xx.xx --nat-keypair-name key-name --bastion-keypair-name key-name \u003e 2az_vpc_cfn_template.json\nNOTE: --nat-keypair-name and --bastion-keypair-name are optional and will default to 'nat_keypair' and 'bastion_keypair', respectively. \n\n3. Feed the template to CloudFormation through the method of choice: AWS CLI, console, or use the CfnExecutor object.\n\n## Customizing the created VPC\n\nThe VpcCfnGenerator is meant to be flexible enough (at the cost of a fair amount of complexity and over-engineering!?!??) to create a variety of different\nVPC configurations.  The typical customization will be to set the cidr blocks and to decide how many subnets of each type to\ncreate (public, natt-ed, private).\n\nThe basic tool is meant more for a developer to use instead of an \"end user\", but calls to VpcCfnGenerator\nshould be wrapped up in a one-click script that can be incorporated into a deployment pipeline or just used by an arbitrary person\nwithout programming experience.\n\nIt would also be possible to make an elaborate CLI interface to exercise the API if desired.\n\nTo create a new script, one can use the examples in the bin directory as a starting point.  From here you can either add\ncommand line arguments or customize the VPC created as desired.  The basic flow of the script is:\n\n0. Elicit any command line arguments such as IP addresses of hosts that should be allowed ingress on port 22 to the bastion\n1. Construct a VpcDescription object\n\n      This is where all the customizations will happen.  More subnets, less subnets, different masks, etc. Include\n      a bastion, don't include one, etc.\n\n2. Construct a VpcCfnGenerator object\n3. Execute emit against VpcCfnGenerator\n\n## Extending the VpcCfnGenerator and further work\n\n* would be good to add support for an OpenVPN server\n* setup HA NAT\n* setup HA OpenVPN\n* the implementation for VpcCfnGenerator is \"brute force\" at this point.  Perhaps interesting to decompose into a better dsl that encapsulates some of the horrific hash building\n\n## Testing the created VPC\n\nIn order to test that the created VPC matches expectations, serverspec + stelligent/serverspec-aws-resources can be\nused to specify the expectations.  For the three stock scripts, there are matching serverspec specifications\nunder serverspec/default.\n\nTo execute them, you must pass in the VPC_ID for all tests, and then BASTION_INGRESS except for the private VPC which has no bastion.\nThe SPEC_OPTS setting will use tags to determine which test to run - so pick the tag according to which script you have run previously.\nIf you have yet to actually construct a VPC to test, these tests should fail pretty much across the board depending on\nwhat VPC_ID is specified.\n\n    bundle install\n    VPC_ID=vpc-xxxxx BASTION_INGRESS=xx.xx.xx.xx SPEC_OPTS=\"-t basic_two_az\" bundle exec rake serverspec\n    VPC_ID=vpc-xxxxx BASTION_INGRESS=xx.xx.xx.xx SPEC_OPTS=\"-t three_az\" bundle exec rake serverspec\n    VPC_ID=vpc-xxxxx SPEC_OPTS=\"-t private\" bundle exec rake serverspec\n\n## Running unit tests against VpcCfnGenerator\n    bundle exec rspec\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstelligent%2Fstelligent_commons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstelligent%2Fstelligent_commons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstelligent%2Fstelligent_commons/lists"}