kite 0.2.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +130 -66
  3. data/LICENSE.md +202 -0
  4. data/README.md +35 -11
  5. data/bin/concourse/out +16 -20
  6. data/docs/kite-concourse-resource.md +45 -0
  7. data/kite.gemspec +1 -0
  8. data/lib/kite.rb +3 -1
  9. data/lib/kite/cloud.rb +1 -0
  10. data/lib/kite/core.rb +8 -2
  11. data/lib/kite/generate.rb +12 -46
  12. data/lib/kite/helpers.rb +0 -72
  13. data/lib/kite/helpers/concourse.rb +3 -2
  14. data/lib/kite/module.rb +76 -0
  15. data/lib/kite/terraform.rb +45 -0
  16. data/lib/kite/version.rb +1 -1
  17. data/tpl/aws/environment/main.tf.tt +5 -0
  18. data/tpl/aws/environment/s3.tf.tt +13 -0
  19. data/tpl/gcp/environment/gcs.tf.tt +18 -0
  20. data/tpl/gcp/environment/main.tf.tt +5 -0
  21. data/tpl/gcp/environment/outputs.tf.tt +5 -0
  22. data/tpl/service/%output_path%/pipelines/review.yml.tt +55 -37
  23. data/tpl/service/%output_path%/pipelines/tasks/create-pull-requests-tag.yml.tt +1 -1
  24. data/tpl/service/%output_path%/pipelines/tasks/create-repository-tag.yml.tt +1 -1
  25. data/tpl/service/%output_path%/pipelines/tasks/run-unit.yml.tt +7 -0
  26. data/tpl/service/Makefile.tt +11 -7
  27. data/tpl/service/docs/getting-started.md +73 -0
  28. data/tpl/service/docs/service.md +101 -0
  29. data/tpl/skel/Gemfile.tt +0 -9
  30. data/tpl/skel/config/cloud.yml +11 -66
  31. metadata +29 -88
  32. data/lib/kite/render.rb +0 -116
  33. data/tpl/aws/README.md +0 -52
  34. data/tpl/aws/bin/base/bootstrap.sh +0 -35
  35. data/tpl/aws/bin/base/cleanup.sh.tt +0 -19
  36. data/tpl/aws/bin/base/set-env.sh.tt +0 -7
  37. data/tpl/aws/bin/base/setup-tunnel.sh.tt +0 -4
  38. data/tpl/aws/bin/bosh-install.sh.tt +0 -23
  39. data/tpl/aws/bin/concourse-deploy.sh.tt +0 -14
  40. data/tpl/aws/bin/ingress-deploy.sh.tt +0 -7
  41. data/tpl/aws/bin/ingress-update.sh.tt +0 -7
  42. data/tpl/aws/bin/kops-delete.sh.erb +0 -5
  43. data/tpl/aws/bin/kops-deploy.sh.erb +0 -11
  44. data/tpl/aws/bin/oauth-deploy.sh.tt +0 -17
  45. data/tpl/aws/bin/prometheus-deploy.sh.tt +0 -23
  46. data/tpl/aws/bin/vault-deploy.sh.tt +0 -10
  47. data/tpl/aws/bosh-vars.yml.erb +0 -12
  48. data/tpl/aws/config/oauth.yml +0 -59
  49. data/tpl/aws/deployments/bosh/bosh.yml +0 -144
  50. data/tpl/aws/deployments/bosh/cloud-config.yml.tt +0 -86
  51. data/tpl/aws/deployments/bosh/cpi.yml +0 -98
  52. data/tpl/aws/deployments/bosh/jumpbox-user.yml +0 -27
  53. data/tpl/aws/deployments/concourse/concourse.yml.tt +0 -98
  54. data/tpl/aws/deployments/ingress/ingress.yml.erb +0 -78
  55. data/tpl/aws/deployments/oauth/oauth.yml.tt +0 -95
  56. data/tpl/aws/deployments/prometheus/monitor-bosh.yml +0 -518
  57. data/tpl/aws/deployments/prometheus/monitor-kubernetes.yml +0 -30
  58. data/tpl/aws/deployments/prometheus/prometheus.yml.tt +0 -184
  59. data/tpl/aws/deployments/vault/vault.yml.erb +0 -38
  60. data/tpl/aws/docs/bosh.md +0 -31
  61. data/tpl/aws/docs/concourse.md +0 -41
  62. data/tpl/aws/docs/ingress.md +0 -14
  63. data/tpl/aws/docs/kops.md +0 -35
  64. data/tpl/aws/docs/oauth.md +0 -24
  65. data/tpl/aws/docs/prometheus.md +0 -31
  66. data/tpl/aws/docs/vault.md +0 -35
  67. data/tpl/aws/terraform/kite_bucket.tf +0 -8
  68. data/tpl/aws/terraform/main.tf.tt +0 -36
  69. data/tpl/aws/terraform/network.tf.tt +0 -252
  70. data/tpl/aws/terraform/outputs.tf +0 -19
  71. data/tpl/aws/terraform/terraform.tfvars.tt +0 -21
  72. data/tpl/aws/terraform/variables.tf +0 -73
  73. data/tpl/gcp/README.md +0 -54
  74. data/tpl/gcp/bin/base/bootstrap.sh +0 -35
  75. data/tpl/gcp/bin/base/cleanup.sh.tt +0 -20
  76. data/tpl/gcp/bin/base/set-env.sh.tt +0 -10
  77. data/tpl/gcp/bin/base/setup-tunnel.sh.tt +0 -13
  78. data/tpl/gcp/bin/bosh-install.sh.tt +0 -22
  79. data/tpl/gcp/bin/concourse-deploy.sh.tt +0 -14
  80. data/tpl/gcp/bin/ingress-deploy.sh.tt +0 -7
  81. data/tpl/gcp/bin/ingress-update.sh.tt +0 -7
  82. data/tpl/gcp/bin/oauth-deploy.sh.tt +0 -19
  83. data/tpl/gcp/bin/prometheus-deploy.sh.tt +0 -23
  84. data/tpl/gcp/bin/vault-deploy.sh.tt +0 -10
  85. data/tpl/gcp/bosh-vars.yml.erb +0 -9
  86. data/tpl/gcp/config/oauth.yml +0 -59
  87. data/tpl/gcp/deployments/bosh/bosh.yml +0 -144
  88. data/tpl/gcp/deployments/bosh/cloud-config.yml.tt +0 -73
  89. data/tpl/gcp/deployments/bosh/cpi.yml +0 -69
  90. data/tpl/gcp/deployments/bosh/jumpbox-user.yml +0 -27
  91. data/tpl/gcp/deployments/concourse/concourse.yml.tt +0 -104
  92. data/tpl/gcp/deployments/concourse/test/test-credentials.yml +0 -3
  93. data/tpl/gcp/deployments/concourse/test/test-pipeline.yml +0 -24
  94. data/tpl/gcp/deployments/ingress/ingress.yml.erb +0 -111
  95. data/tpl/gcp/deployments/oauth/oauth.yml.tt +0 -95
  96. data/tpl/gcp/deployments/prometheus/monitor-bosh.yml +0 -518
  97. data/tpl/gcp/deployments/prometheus/monitor-kubernetes.yml +0 -30
  98. data/tpl/gcp/deployments/prometheus/prometheus.yml +0 -183
  99. data/tpl/gcp/deployments/vault/vault.yml.erb +0 -37
  100. data/tpl/gcp/docs/bosh.md +0 -36
  101. data/tpl/gcp/docs/concourse.md +0 -41
  102. data/tpl/gcp/docs/ingress.md +0 -12
  103. data/tpl/gcp/docs/oauth.md +0 -24
  104. data/tpl/gcp/docs/prometheus.md +0 -27
  105. data/tpl/gcp/docs/vault.md +0 -36
  106. data/tpl/gcp/terraform/gcs.tf.tt +0 -18
  107. data/tpl/gcp/terraform/main.tf +0 -70
  108. data/tpl/gcp/terraform/network.tf +0 -52
  109. data/tpl/gcp/terraform/outputs.tf +0 -7
  110. data/tpl/gcp/terraform/terraform.tfvars.tt +0 -15
  111. data/tpl/gcp/terraform/variables.tf +0 -37
  112. data/tpl/service/%output_path%/pipelines/tasks/helm-deploy.yml.tt +0 -22
  113. data/tpl/service/%output_path%/pipelines/tasks/run-master-tests.yml.tt +0 -12
  114. data/tpl/service/%output_path%/pipelines/tasks/run-pr-tests.yml.tt +0 -12
  115. data/tpl/skel/docs/index.md.tt +0 -0
  116. data/tpl/skel/docs/quickstart.md.tt +0 -0
@@ -1,8 +0,0 @@
1
- resource "aws_s3_bucket" "kite_bucket" {
2
- bucket = "${var.bucket_name}"
3
-
4
- tags {
5
- Name = "${var.bucket_name}"
6
- Component = "kite-platform"
7
- }
8
- }
@@ -1,36 +0,0 @@
1
- # Specify the provider and access details
2
- provider "aws" {
3
- region = "${var.region}"
4
- access_key = "${var.access_key}"
5
- secret_key = "${var.secret_key}"
6
- }
7
-
8
- resource "aws_key_pair" "platform_key" {
9
- key_name = "${var.keypair_name}"
10
- public_key = "${file("${var.public_key}")}"
11
- }
12
-
13
- resource "aws_instance" "bastion" {
14
- ami = "${lookup(var.aws_amis, var.region)}"
15
- instance_type = "t2.small"
16
- key_name = "${var.keypair_name}"
17
-
18
- vpc_security_group_ids = ["${aws_security_group.bastion_sg.id}"]
19
- subnet_id = <%= "\"#{conditional_subnet_id(@values)}\"" %>
20
- associate_public_ip_address = true
21
-
22
- tags {
23
- Name = "bastion"
24
- }
25
-
26
- connection {
27
- user = "ubuntu"
28
- private_key = "${file(var.private_key)}"
29
- }
30
-
31
- provisioner "remote-exec" {
32
- inline = [
33
- "curl -fsSL get.docker.com | sh"
34
- ]
35
- }
36
- }
@@ -1,252 +0,0 @@
1
- <% if @values['aws']['vpc_id'].empty? %>
2
- # Create a VPC to launch our instances into
3
- resource "aws_vpc" "platform" {
4
- cidr_block = "${var.vpc_cidr_block}"
5
-
6
- tags {
7
- Name = "${var.vpc_name}"
8
- Component = "kite-platform"
9
- }
10
- }
11
-
12
- # DMZ subnet
13
- resource "aws_subnet" "platform_dmz" {
14
- vpc_id = "${aws_vpc.platform.id}"
15
- availability_zone = "${var.availability_zone}"
16
- cidr_block = "${var.public_subnet_cidr}"
17
- map_public_ip_on_launch = false
18
- tags {
19
- Name = "${var.public_subnet_name}"
20
- Component = "kite-platform"
21
- }
22
- }
23
-
24
- # Create an internet gateway to give our subnet access to the outside world
25
- resource "aws_internet_gateway" "platform" {
26
- vpc_id = "${aws_vpc.platform.id}"
27
- tags {
28
- Name = "platform-gateway"
29
- Component = "kite-platform"
30
- }
31
- }
32
-
33
- # Grant the VPC internet access on its main route table
34
- resource "aws_route" "internet_access" {
35
- route_table_id = "${aws_vpc.platform.main_route_table_id}"
36
- destination_cidr_block = "0.0.0.0/0"
37
- gateway_id = "${aws_internet_gateway.platform.id}"
38
- }
39
-
40
- <% end %>
41
-
42
- <% if !@values['aws']['vpc_id'].empty? && @values['aws']['public_subnet']['id'].empty? %>
43
- # DMZ subnet
44
- resource "aws_subnet" "platform_dmz" {
45
- vpc_id = "${var.vpc_id}"
46
- availability_zone = "${var.availability_zone}"
47
- cidr_block = "${var.public_subnet_cidr}"
48
- map_public_ip_on_launch = false
49
- tags {
50
- Name = "${var.public_subnet_name}"
51
- Component = "kite-platform"
52
- }
53
- }
54
- <% end %>
55
-
56
- # Private subnet
57
- resource "aws_subnet" "platform_net" {
58
- vpc_id = <%= "\"#{conditional_vpc_id(@values)}\"" %>
59
- availability_zone = "${var.availability_zone}"
60
- cidr_block = "${var.private_subnet_cidr}"
61
- map_public_ip_on_launch = false
62
- tags {
63
- Name = "${var.private_subnet_name}"
64
- Component = "kite-platform"
65
- }
66
- }
67
-
68
- # Create a custom route table for the private subnet
69
- resource "aws_route_table" "private_route" {
70
- vpc_id = <%= "\"#{conditional_vpc_id(@values)}\"" %>
71
-
72
- route {
73
- cidr_block = "0.0.0.0/0"
74
- nat_gateway_id = "${aws_nat_gateway.nat_gateway.id}"
75
- }
76
-
77
- tags {
78
- Name = "platform-route"
79
- Component = "kite-platform"
80
- }
81
- }
82
-
83
- # Allocate an Elastic IP for NAT gateway
84
- resource "aws_eip" "nat_ip" {
85
- }
86
-
87
- # Create a NAT gateway to forward the traffic for BOSH
88
- resource "aws_nat_gateway" "nat_gateway" {
89
- allocation_id = "${aws_eip.nat_ip.id}"
90
- subnet_id = <%= "\"#{conditional_subnet_id(@values)}\"" %>
91
- }
92
-
93
- # Associate custom route table with private subnet
94
- resource "aws_route_table_association" "private_route" {
95
- subnet_id = "${aws_subnet.platform_net.id}"
96
- route_table_id = "${aws_route_table.private_route.id}"
97
- }
98
-
99
- # The default security group
100
- resource "aws_security_group" "bastion_sg" {
101
- name = "bastion_sg"
102
- description = "Bastion security group"
103
- vpc_id = <%= "\"#{conditional_vpc_id(@values)}\"" %>
104
- tags {
105
- Name = "bastion-sg"
106
- Component = "bosh-director"
107
- }
108
-
109
- ingress {
110
- from_port = 22
111
- to_port = 22
112
- protocol = "tcp"
113
- cidr_blocks = [
114
- "0.0.0.0/0"]
115
- }
116
-
117
- egress {
118
- from_port = 0
119
- to_port = 0
120
- protocol = "-1"
121
- cidr_blocks = [
122
- "0.0.0.0/0"]
123
- }
124
- }
125
-
126
- # The default security group
127
- resource "aws_security_group" "bosh_sg" {
128
- name = "bosh_sg"
129
- description = "Default BOSH security group"
130
- vpc_id = <%= "\"#{conditional_vpc_id(@values)}\"" %>
131
- tags {
132
- Name = "bosh-sg"
133
- Component = "bosh-director"
134
- }
135
-
136
- # inbound access rules
137
- ingress {
138
- from_port = 6868
139
- to_port = 6868
140
- protocol = "tcp"
141
- cidr_blocks = [
142
- "0.0.0.0/0"]
143
- }
144
-
145
- ingress {
146
- from_port = 25555
147
- to_port = 25555
148
- protocol = "tcp"
149
- cidr_blocks = [
150
- "0.0.0.0/0"]
151
- }
152
-
153
- ingress {
154
- from_port = 22
155
- to_port = 22
156
- protocol = "tcp"
157
- cidr_blocks = [
158
- "0.0.0.0/0"]
159
- }
160
-
161
- ingress {
162
- from_port = 0
163
- to_port = 65535
164
- protocol = "tcp"
165
- self = true
166
- }
167
-
168
- ingress {
169
- from_port = 0
170
- to_port = 65535
171
- protocol = "udp"
172
- self = true
173
- }
174
-
175
- # outbound internet access
176
- egress {
177
- from_port = 0
178
- to_port = 0
179
- protocol = "-1"
180
- cidr_blocks = [
181
- "0.0.0.0/0"]
182
- }
183
- }
184
-
185
- # Create an Ingress security group
186
- resource "aws_security_group" "ingress_sg" {
187
- name = "ingress-sg"
188
- description = "Ingress security group"
189
- vpc_id = <%= "\"#{conditional_vpc_id(@values)}\"" %>
190
- tags {
191
- Name = "ingress-sg"
192
- Component = "ingress"
193
- }
194
-
195
- # outbound internet access
196
- egress {
197
- from_port = 0
198
- to_port = 0
199
- protocol = "-1"
200
- cidr_blocks = ["0.0.0.0/0"]
201
- }
202
-
203
- # inbound HTTP access
204
- ingress {
205
- from_port = 80
206
- to_port = 80
207
- protocol = "tcp"
208
- cidr_blocks = ["0.0.0.0/0"]
209
- }
210
- }
211
-
212
- # Create a Concourse security group
213
- resource "aws_security_group" "concourse_sg" {
214
- name = "concourse-sg"
215
- description = "Concourse security group"
216
- vpc_id = <%= "\"#{conditional_vpc_id(@values)}\"" %>
217
- tags {
218
- Name = "concourse-sg"
219
- Component = "concourse"
220
- }
221
-
222
- # outbound internet access
223
- egress {
224
- from_port = 0
225
- to_port = 0
226
- protocol = "-1"
227
- cidr_blocks = ["0.0.0.0/0"]
228
- }
229
-
230
- # inbound connections from ELB
231
- ingress {
232
- from_port = 8080
233
- to_port = 8080
234
- protocol = "tcp"
235
- cidr_blocks = ["0.0.0.0/0"]
236
- }
237
-
238
- ingress {
239
- from_port = 8080
240
- to_port = 8080
241
- protocol = "tcp"
242
- cidr_blocks = [
243
- "0.0.0.0/0"]
244
- }
245
-
246
- ingress {
247
- from_port = 2222
248
- to_port = 2222
249
- protocol = "tcp"
250
- cidr_blocks = ["0.0.0.0/0"]
251
- }
252
- }
@@ -1,19 +0,0 @@
1
- output "security_group_id" {
2
- value = "${aws_security_group.bosh_sg.id}"
3
- }
4
-
5
- output "platform_subnet_id" {
6
- value = "${aws_subnet.platform_net.id}"
7
- }
8
-
9
- output "dmz_subnet_id" {
10
- value = "${aws_subnet.platform_dmz.id}"
11
- }
12
-
13
- output "bastion_ip" {
14
- value = "${aws_instance.bastion.public_ip}"
15
- }
16
-
17
- output "gateway_ip" {
18
- value = "${aws_nat_gateway.nat_gateway.private_ip}"
19
- }
@@ -1,21 +0,0 @@
1
- # Credentials
2
- access_key = "<%= @values['aws']['access_key'] %>"
3
- secret_key = "<%= @values['aws']['secret_key'] %>"
4
- region = "<%= @values['aws']['region'] %>"
5
- availability_zone = "<%= @values['aws']['zone'] %>"
6
-
7
- # Network Config
8
- vpc_cidr_block = "<%= @values['aws']['vpc_cidr_block'] %>"
9
- vpc_name = "<%= @values['aws']['vpc_name'] %>"
10
- vpc_id = "<%= @values['aws']['vpc_id'] %>"
11
- public_subnet_name = "<%= @values['aws']['public_subnet']['name'] %>"
12
- public_subnet_cidr = "<%= @values['aws']['public_subnet']['network'] %>"
13
- public_subnet_id = "<%= @values['aws']['public_subnet']['id'] %>"
14
- private_subnet_name = "<%= @values['aws']['private_subnet']['name'] %>"
15
- private_subnet_cidr = "<%= @values['aws']['private_subnet']['network'] %>"
16
-
17
- # Kite config
18
- keypair_name = "<%= @values['kite']['keypair_name'] %>"
19
- bucket_name = "<%= @values['kite']['bucket_name'] %>"
20
- public_key = "<%= @values['kite']['public_key_path'] %>"
21
- private_key = "<%= @values['kite']['private_key_path'] %>"
@@ -1,73 +0,0 @@
1
- variable "access_key" {
2
- type = "string"
3
- }
4
-
5
- variable "secret_key" {
6
- type = "string"
7
- }
8
-
9
- variable "public_key" {
10
- type = "string"
11
- }
12
-
13
- variable "private_key" {
14
- type = "string"
15
- }
16
-
17
- variable "keypair_name" {
18
- type = "string"
19
- }
20
-
21
- variable "bucket_name" {
22
- type = "string"
23
- }
24
-
25
- variable "region" {
26
- type = "string"
27
- default = "eu-central-1"
28
- }
29
-
30
- variable "availability_zone" {
31
- type = "string"
32
- default = "eu-central-1a"
33
- }
34
-
35
- variable "vpc_cidr_block" {
36
- type = "string"
37
- }
38
-
39
- variable "vpc_name" {
40
- type = "string"
41
- }
42
-
43
- variable "vpc_id" {
44
- type = "string"
45
- }
46
-
47
- variable "public_subnet_cidr" {
48
- type = "string"
49
- }
50
-
51
- variable "public_subnet_id" {
52
- type = "string"
53
- }
54
-
55
- variable "public_subnet_name" {
56
- type = "string"
57
- }
58
-
59
- variable "private_subnet_cidr" {
60
- type = "string"
61
- }
62
-
63
- variable "private_subnet_name" {
64
- type = "string"
65
- }
66
-
67
- variable "aws_amis" {
68
- default = {
69
- us-east-1 = "ami-1d4e7a66"
70
- eu-central-1 = "ami-958128fa"
71
- eu-west-1 = "ami-785db401"
72
- }
73
- }
data/tpl/gcp/README.md DELETED
@@ -1,54 +0,0 @@
1
- # GCP Cloud
2
-
3
- ## Setup
4
-
5
- ### Prerequisites
6
- Set path to your service account credentials:
7
- ```
8
- export GOOGLE_CREDENTIALS=*~/credentials/service-account.json*
9
- ```
10
-
11
- ### Setup the basic infrastructure and bastion
12
- Apply terraform code
13
- ```
14
- pushd terraform && terraform init && terraform apply && popd
15
- ```
16
-
17
- [Note]
18
- To destroy Bastion later, use `terraform destroy -target google_compute_instance.bastion`
19
-
20
- ### Setup BOSH
21
- Render BOSH manifest and related files
22
- ```
23
- kite render manifest bosh --cloud gcp
24
- ```
25
-
26
- Prepare BOSH environment using instructions from [docs/bosh.md](docs/bosh.md)
27
-
28
- ### Setup INGRESS
29
- Render Ingress manifest and related files
30
- ```
31
- kite render manifest ingress --cloud gcp
32
- ```
33
-
34
- Follow instructions from [docs/ingress.md](docs/ingress.md) to deploy Ingress
35
-
36
-
37
- ### Setup VAULT
38
- Render Vault deployment
39
- ```
40
- kite render manifest vault --cloud gcp
41
- ```
42
-
43
- Follow instructions from [docs/vault.md](docs/vault.md) to deploy Vault
44
-
45
- ### Setup CONCOURSE
46
- [Note]
47
- To expose concourse publicly, you must create first (manually) a virtual IP in GCP and create a DNS A entry for the hostname for this IP. Set the IP into config/cloud.yml (concourse.vip).
48
-
49
- Render Concourse manifest
50
- ```
51
- kite render manifest concourse --cloud gcp
52
- ```
53
-
54
- Follow instructions from [docs/concourse.md](docs/concourse.md) to deploy Concourse