kite 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4676c9a2793922ae3134375354a14353523d773
4
- data.tar.gz: 26bbcfc505d24b57af425afdcbe287afad7bee74
3
+ metadata.gz: 90bb5e8944368e0fe0576c0c954ccc1a80c72e0d
4
+ data.tar.gz: 174dfc7e5123c6ee0eadef4ff11db6dfce68fd07
5
5
  SHA512:
6
- metadata.gz: c242dc22c331f1f18036b679afa2b033286d0bc7242d3f7af1cedb2488d9bef169a748d6bbafde57764a33915650300af678e08af6e7608ed4d7f1d5816536f1
7
- data.tar.gz: de50ab0014b70949fef89ad15396951b9edc241094fa2c847c1cce795ec1cc2e3291e28a99444a15ae4c8909b37f615e00282e4b307a94af499e8140f8bff3c6
6
+ metadata.gz: 70e301d6a0bcdbf445a29542e7c4142c0cada31588b8d1191dc15828a5c30d27064816c87066ca1046c725b36b14f9a698888569e28c44e9609087a5211bc08d
7
+ data.tar.gz: 81638c0f37000c26497ea98b8a8fe0e7f67f497b9b098b57f2e1d8536e0ae84638176f660b0e656d6bb5eb12dbc29160bb025d383dd39f1bd6727ef18b59d639
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Kite
2
2
 
3
+ [![Build Status](https://travis-ci.org/helios-technologies/kite.svg?branch=master)](https://travis-ci.org/helios-technologies/kite)
4
+
3
5
  Kite is a CLI for scaffolding and managing devops modules
4
6
  The main purpose is templating of various tools for devops around terraform, bosh, ansible
5
7
 
data/bin/kite ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ require "thor"
3
+
4
+ $: << File.join(File.dirname(__FILE__), "../lib")
5
+ require 'kite'
6
+
7
+ Kite::Commands.start
File without changes
File without changes
data/kite.gemspec CHANGED
@@ -16,8 +16,8 @@ Gem::Specification.new do |spec|
16
16
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
17
  f.match(%r{^(test|spec|features)/})
18
18
  end
19
- spec.bindir = "exe"
20
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.bindir = "bin"
20
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
23
  spec.add_dependency "thor"
data/lib/kite.rb CHANGED
@@ -1,5 +1,7 @@
1
- require "kite/version"
1
+ require "erb"
2
+ require "yaml"
3
+ require "thor"
2
4
 
3
- module Kite
4
- # Your code goes here...
5
- end
5
+ require "kite/version"
6
+ require "kite/helpers"
7
+ require "kite/commands"
@@ -0,0 +1,46 @@
1
+ class Kite::Commands < Thor
2
+ include Thor::Actions
3
+ include Kite::Helpers
4
+
5
+ def self.source_root
6
+ File.expand_path(File.join(File.dirname(__FILE__), "../.."))
7
+ end
8
+
9
+ method_option :values, type: :string, default: "defaults.yml", required: true
10
+ method_option :cloud, type: :string, desc: "Cloud supplier", enum: %w{aws gcp}, required: true
11
+ desc "new CLOUDNAME", "Generate Cloud IaC from configuration"
12
+ def new(cloud_name)
13
+ say "Generating Cloud #{ cloud_name } IaC", :green
14
+ @values = YAML.load(File.read(options[:values]))
15
+
16
+ case options[:cloud]
17
+ when "aws"
18
+ copy_file("tpl/aws/bin/make_cloud_config.sh", "#{cloud_name}/bin/make_cloud_config.sh")
19
+ copy_file("tpl/aws/bin/make_manifest_bosh-init.sh", "#{cloud_name}/bin/make_manifest_bosh-init.sh")
20
+ copy_file("tpl/aws/bin/make_manifest_concourse-cluster.sh", "#{cloud_name}/bin/make_manifest_concourse-cluster.sh")
21
+
22
+ copy_file("tpl/aws/terraform/aws-concourse.tf", "#{cloud_name}/terraform/aws-concourse.tf")
23
+ copy_file("tpl/aws/terraform/aws-vault.tf", "#{cloud_name}/terraform/aws-vault.tf")
24
+ copy_file("tpl/aws/terraform/bosh-aws-base.tf", "#{cloud_name}/terraform/bosh-aws-base.tf")
25
+ copy_file("tpl/aws/terraform/outputs.tf", "#{cloud_name}/terraform/outputs.tf")
26
+ template("tpl/aws/terraform/terraform.tfvars.erb", "#{cloud_name}/terraform/terraform.tfvars")
27
+ copy_file("tpl/aws/terraform/variables.tf", "#{cloud_name}/terraform/variables.tf")
28
+ copy_file("tpl/aws/terraform/variables.tf", "#{cloud_name}/terraform/variables.tf")
29
+
30
+ template("tpl/aws/env.example.erb", "#{cloud_name}/.env")
31
+ copy_file("tpl/aws/README.md", "#{cloud_name}/README.md")
32
+ copy_file("tpl/aws/bootstrap.sh", "#{cloud_name}/bootstrap.sh")
33
+
34
+ when "gcp"
35
+ template("tpl/gcp/manifest.yml.erb", "#{cloud_name}/manifest.yml")
36
+ template("tpl/gcp/cloud-config.yml.erb", "#{cloud_name}/cloud-config.yml")
37
+ copy_file("tpl/gcp/concourse.yml.erb", "#{cloud_name}/concourse.yml")
38
+ copy_file("tpl/gcp/README.md", "#{cloud_name}/README.md")
39
+ directory("tpl/gcp/scripts", "#{cloud_name}/scripts")
40
+ copy_file("tpl/gcp/INSTALL.md", "#{cloud_name}/INSTALL.md")
41
+ template("tpl/gcp/env.example.erb", "#{cloud_name}/.env")
42
+ copy_file("tpl/gcp/main.tf", "#{cloud_name}/main.tf")
43
+ copy_file("tpl/gcp/concourse.tf", "#{cloud_name}/concourse.tf")
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,2 @@
1
+ module Kite::Helpers
2
+ end
data/lib/kite/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kite
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/tpl/aws/README.md ADDED
@@ -0,0 +1,103 @@
1
+ BOSH Director & Concourse Bootstrap
2
+ ===================================
3
+
4
+ This project achieves the following:
5
+
6
+ - Preparation of an AWS environment for BOSH & Concourse
7
+ - Deployment of a new BOSH Director using bosh-init
8
+ - Deployment of a new Concourse cluster, or standalone server
9
+
10
+ Terraform is used to setup the base network and security infrastructure, including an ELB for Concourse.
11
+
12
+ Requirements
13
+ -----
14
+
15
+ - Install [terraform](https://www.terraform.io/intro/getting-started/install.html)
16
+ - Install [bosh-init](https://bosh.io/docs/install-bosh-init.html)
17
+ - Install the [bosh_cli](https://bosh.io/docs/bosh-cli.html)
18
+
19
+ Ensure you have created a `terraform/terraform.tfvars` file with your variables, or set suitable [environment variables](https://www.terraform.io/docs/configuration/variables.html). An example tfvars file can be found in `terraform/terraform.tfvars.example`
20
+
21
+ Assumptions
22
+ -----
23
+
24
+ You already have:
25
+
26
+ - A Route53 Zone in AWS.
27
+ - An EC2 SSH keypair
28
+ - An SSL certificate in AWS for your Concourse ELB
29
+
30
+ Usage
31
+ -----
32
+
33
+ Set your desired AWS region in `terrform/variables.tf`. Ensure terraform is in your path, then apply the configuration to prepare the IaaS for BOSH and Concourse:
34
+
35
+ ```
36
+ cd terraform/
37
+ terraform apply
38
+ ```
39
+ Set the following environment variables:
40
+
41
+ ```
42
+ $AWS_ACCESS_KEY_ID
43
+ $AWS_SECRET_ACCESS_KEY
44
+ $AWS_REGION
45
+ $AWS_AZ
46
+ $BOSH_PASSWORD
47
+ $AWS_KEYPAIR_KEY_NAME
48
+ $PRIVATE_KEY_PATH
49
+ ```
50
+
51
+ Then create the `bosh-director.yml` manifest:
52
+ ```
53
+ ./bin/make_manifest_bosh-init.sh
54
+ ```
55
+
56
+ You are ready to deploy the BOSH Director
57
+ ```
58
+ bosh-init deploy bosh-director.yml
59
+ ```
60
+
61
+ Go and make a cup of tea.
62
+
63
+ Once the director is deployed, target it and apply your cloud-config for AWS.
64
+ Remember to set your chosen AZ and the subnet-id output by terraform in `aws-cloud.yml`.
65
+
66
+ ```
67
+ bosh target <your EIP address>
68
+ bosh update cloud-config aws-cloud.yml
69
+ ```
70
+
71
+ Set a database password and external URL for your deployment in these environment variables:
72
+
73
+ ```
74
+ $DB_PASSWORD
75
+ $CONCOURSE_URL
76
+ ```
77
+ Create a new OAuth application in GitHub as described [here](http://concourse.ci/authentication.html). The manifest assumes the existance of a 'CI' team that contains your authorised users, so create that too. Then set the following environment variables:
78
+
79
+ ```
80
+ $GITHUB_ORG
81
+ $GITHUB_CLIENT_ID
82
+ $GITHUB_CLIENT_SECRET
83
+ ```
84
+
85
+ Then create a concourse manifest for a single server deployment:
86
+ ```
87
+ ./bin/make_manifest_concourse.sh
88
+ ```
89
+ Or, create a concourse manifest for small cluster:
90
+ ```
91
+ ./bin/make_manifest_concourse-cluster.sh
92
+ ```
93
+
94
+ Upload the necessary stemcell & releases, then deploy concourse:
95
+ ```
96
+ bosh upload stemcell https://bosh.io/d/stemcells/bosh-aws-xen-hvm-ubuntu-trusty-go_agent
97
+ bosh upload release https://bosh.io/d/github.com/concourse/concourse
98
+ bosh upload release https://bosh.io/d/github.com/cloudfoundry-incubator/garden-runc-release
99
+ bosh deployment concourse.yml
100
+ bosh deploy
101
+ ```
102
+
103
+ Congratulations, you should now be able to see your new CI server at https://your-concourse-url.
@@ -0,0 +1,104 @@
1
+ #!/bin/bash
2
+ #
3
+ # Please set the following environment variables:
4
+ # $AWS_AZ
5
+
6
+
7
+ function getvars() {
8
+ cd terraform/
9
+ DEFAULT_SUBNET=$(terraform output default_subnet_id)
10
+ OPS_SUBNET=$(terraform output ops_services_subnet_id)
11
+ cd ../
12
+ }
13
+
14
+ getvars
15
+
16
+ echo "Default Subnet = $DEFAULT_SUBNET"
17
+ echo "Ops Services Subnet = $OPS_SUBNET"
18
+ echo "AWS AZ" = $AWS_AZ
19
+
20
+
21
+ cat >aws-cloud.yml <<YAML
22
+ ---
23
+ azs:
24
+ - name: z1
25
+ cloud_properties: {availability_zone: $AWS_AZ}
26
+
27
+ vm_types:
28
+ - name: concourse_standalone
29
+ cloud_properties:
30
+ instance_type: m3.large
31
+ ephemeral_disk: {size: 5000, type: gp2}
32
+ elbs: [concourse-elb]
33
+ security_groups: [concourse-sg, boshdefault]
34
+ - name: concourse_web
35
+ cloud_properties:
36
+ instance_type: m3.medium
37
+ ephemeral_disk: {size: 3000, type: gp2}
38
+ elbs: [concourse-elb]
39
+ security_groups: [concourse-sg, boshdefault]
40
+ - name: concourse_db
41
+ cloud_properties:
42
+ instance_type: m3.medium
43
+ ephemeral_disk: {size: 3000, type: gp2}
44
+ security_groups: [boshdefault]
45
+ - name: concourse_worker
46
+ cloud_properties:
47
+ instance_type: m3.large
48
+ ephemeral_disk: {size: 30000, type: gp2}
49
+ security_groups: [boshdefault]
50
+ - name: default
51
+ cloud_properties:
52
+ instance_type: t2.micro
53
+ ephemeral_disk: {size: 3000, type: gp2}
54
+ security_groups: [boshdefault]
55
+ - name: large
56
+ cloud_properties:
57
+ instance_type: m3.large
58
+ ephemeral_disk: {size: 5000, type: gp2}
59
+ security_groups: [boshdefault]
60
+ - name: vault-default
61
+ cloud_properties:
62
+ instance_type: t2.micro
63
+ ephemeral_disk: {size: 3000, type: gp2}
64
+ security_groups: [vault-sg, boshdefault]
65
+
66
+ disk_types:
67
+ - name: default
68
+ disk_size: 3000
69
+ cloud_properties: {type: gp2}
70
+ - name: large
71
+ disk_size: 50_000
72
+ cloud_properties: {type: gp2}
73
+
74
+ networks:
75
+ - name: default
76
+ type: manual
77
+ subnets:
78
+ - range: 10.0.0.0/24
79
+ gateway: 10.0.0.1
80
+ az: z1
81
+ static: [10.0.0.6]
82
+ reserved: [10.0.0.1-10.0.0.5]
83
+ dns: [10.0.0.2]
84
+ cloud_properties: {subnet: $DEFAULT_SUBNET}
85
+ - name: ops_services
86
+ type: manual
87
+ subnets:
88
+ - range: 10.0.10.0/24
89
+ gateway: 10.0.10.1
90
+ az: z1
91
+ reserved: [10.0.10.1-10.0.10.5]
92
+ dns: [10.0.0.2]
93
+ cloud_properties: {subnet: $OPS_SUBNET}
94
+ - name: vip
95
+ type: vip
96
+
97
+ compilation:
98
+ workers: 5
99
+ reuse_compilation_vms: true
100
+ az: z1
101
+ vm_type: large
102
+ network: default
103
+
104
+ YAML
@@ -0,0 +1,164 @@
1
+ #!/bin/bash
2
+ #
3
+ # Please set the following environment variables:
4
+ # $AWS_ACCESS_KEY_ID
5
+ # $AWS_SECRET_ACCESS_KEY
6
+ # $AWS_REGION
7
+ # $AWS_AZ
8
+ # $BOSH_PASSWORD
9
+ # $AWS_KEYPAIR_KEY_NAME
10
+ # $PRIVATE_KEY_PATH
11
+
12
+ function getvars() {
13
+ cd terraform/
14
+ EIP=$(terraform output eip)
15
+ SUBNET=$(terraform output default_subnet_id)
16
+ SECURITY_GROUP=$(terraform output security_group_id)
17
+ cd ../
18
+ }
19
+
20
+ getvars
21
+
22
+ echo "Subnet = $SUBNET"
23
+ echo "Security Group = $SECURITY_GROUP"
24
+ echo "EIP = $EIP"
25
+ echo "AWS REGION = $AWS_REGION"
26
+ echo "AWS AZ = $AWS_AZ"
27
+
28
+ cat >bosh-director.yml <<YAML
29
+ ---
30
+ name: bosh
31
+
32
+ releases:
33
+ - name: bosh
34
+ url: https://bosh.io/d/github.com/cloudfoundry/bosh?v=256.2
35
+ sha1: ff2f4e16e02f66b31c595196052a809100cfd5a8
36
+ - name: bosh-aws-cpi
37
+ url: https://bosh.io/d/github.com/cloudfoundry-incubator/bosh-aws-cpi-release?v=52
38
+ sha1: dc4a0cca3b33dce291e4fbeb9e9948b6a7be3324
39
+
40
+ resource_pools:
41
+ - name: vms
42
+ network: private
43
+ stemcell:
44
+ url: https://bosh.io/d/stemcells/bosh-aws-xen-hvm-ubuntu-trusty-go_agent?v=3232.3
45
+ sha1: 1fe87c0146ad1f3b55eeed5a80ce35c01b4eb6d9
46
+ cloud_properties:
47
+ instance_type: m3.large
48
+ ephemeral_disk: {size: 25_000, type: gp2}
49
+ availability_zone: $AWS_AZ
50
+
51
+ disk_pools:
52
+ - name: disks
53
+ disk_size: 20_000
54
+ cloud_properties: {type: gp2}
55
+
56
+ networks:
57
+ - name: private
58
+ type: manual
59
+ subnets:
60
+ - range: 10.0.0.0/24
61
+ gateway: 10.0.0.1
62
+ dns: [10.0.0.2]
63
+ cloud_properties: {subnet: $SUBNET}
64
+ - name: public
65
+ type: vip
66
+
67
+ jobs:
68
+ - name: bosh
69
+ instances: 1
70
+
71
+ templates:
72
+ - {name: nats, release: bosh}
73
+ - {name: postgres, release: bosh}
74
+ - {name: blobstore, release: bosh}
75
+ - {name: director, release: bosh}
76
+ - {name: health_monitor, release: bosh}
77
+ - {name: registry, release: bosh}
78
+ - {name: aws_cpi, release: bosh-aws-cpi}
79
+
80
+ resource_pool: vms
81
+ persistent_disk_pool: disks
82
+
83
+ networks:
84
+ - name: private
85
+ static_ips: [10.0.0.6]
86
+ default: [dns, gateway]
87
+ - name: public
88
+ static_ips: [$EIP]
89
+
90
+ properties:
91
+ nats:
92
+ address: 127.0.0.1
93
+ user: nats
94
+ password: $BOSH_PASSWORD
95
+
96
+ postgres: &db
97
+ listen_address: 127.0.0.1
98
+ host: 127.0.0.1
99
+ user: postgres
100
+ password: $BOSH_PASSWORD
101
+ database: bosh
102
+ adapter: postgres
103
+
104
+ registry:
105
+ address: 10.0.0.6
106
+ host: 10.0.0.6
107
+ db: *db
108
+ http: {user: admin, password: $BOSH_PASSWORD, port: 25777}
109
+ username: admin
110
+ password: $BOSH_PASSWORD
111
+ port: 25777
112
+
113
+ blobstore:
114
+ address: 10.0.0.6
115
+ port: 25250
116
+ provider: dav
117
+ director: {user: director, password: $BOSH_PASSWORD}
118
+ agent: {user: agent, password: $BOSH_PASSWORD}
119
+
120
+ director:
121
+ address: 127.0.0.1
122
+ name: eb-bosh
123
+ db: *db
124
+ cpi_job: aws_cpi
125
+ max_threads: 10
126
+ user_management:
127
+ provider: local
128
+ local:
129
+ users:
130
+ - {name: admin, password: $BOSH_PASSWORD}
131
+ - {name: hm, password: $BOSH_PASSWORD}
132
+
133
+ hm:
134
+ director_account: {user: hm, password: $BOSH_PASSWORD}
135
+ resurrector_enabled: true
136
+
137
+ aws: &aws
138
+ access_key_id: $AWS_ACCESS_KEY_ID
139
+ secret_access_key: $AWS_SECRET_ACCESS_KEY
140
+ default_key_name: $AWS_KEYPAIR_KEY_NAME
141
+ default_security_groups: [$SECURITY_GROUP]
142
+ region: $AWS_REGION
143
+
144
+ agent: {mbus: "nats://nats:$BOSH_PASSWORD@10.0.0.6:4222"}
145
+
146
+ ntp: &ntp [0.pool.ntp.org, 1.pool.ntp.org]
147
+
148
+ cloud_provider:
149
+ template: {name: aws_cpi, release: bosh-aws-cpi}
150
+
151
+ ssh_tunnel:
152
+ host: $EIP # <--- Replace with your Elastic IP address
153
+ port: 22
154
+ user: vcap
155
+ private_key: $PRIVATE_KEY_PATH # Path relative to this manifest file
156
+
157
+ mbus: "https://mbus:$BOSH_PASSWORD@$EIP:6868" # <--- Replace with Elastic IP
158
+
159
+ properties:
160
+ aws: *aws
161
+ agent: {mbus: "https://mbus:$BOSH_PASSWORD@0.0.0.0:6868"}
162
+ blobstore: {provider: local, path: /var/vcap/micro_bosh/data/cache}
163
+ ntp: *ntp
164
+ YAML