terra_boi 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/generators/extensions.rb +25 -20
- data/lib/generators/terra_boi/db_config_generator.rb +2 -2
- data/lib/generators/terra_boi/templates/db_config.erb +1 -1
- data/lib/generators/terra_boi/templates/env/data/main.tf.erb +2 -2
- data/lib/generators/terra_boi/templates/lib/scripts/push_to_ecr.sh.erb +5 -1
- data/lib/generators/terra_boi/templates/state_main.erb +3 -3
- data/lib/generators/terra_boi/tf_env_generator.rb +2 -2
- data/lib/generators/terra_boi/tf_state_generator.rb +2 -2
- data/lib/tasks/terra_boi_tasks.rake +1 -7
- data/lib/terra_boi/version.rb +1 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65ba7dec23cc3f546b037577d42846ac3fc436398e44c8852499b0fe5fbeef85
|
4
|
+
data.tar.gz: 744b3063050d363cd88e73219ee91a5e908ac4a3491190cba6368aa1dfb5f923
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41feb412ab37ca9e5bdffbe3df50fb465a8fa007d9f7eaf5867222f661c4a522d28b45911c5928268f966337606c95ae9adcd430d4a429787ecab6fac6f10558
|
7
|
+
data.tar.gz: 6ee2c8a756a9ad4c74657ea6694ea7b4f2a193a2213ed1a2c460e8e93cf95694afc8bd0a7a748423c4d969c6598fe9a5d478aa3de01fc672e43974aebe704ec5
|
data/README.md
CHANGED
@@ -2,7 +2,11 @@
|
|
2
2
|
|
3
3
|
## Introduction
|
4
4
|
|
5
|
-
|
5
|
+
Deploy your rails application to AWS with `rake deploy`.
|
6
|
+
|
7
|
+
This ruby / rails gem was created by [Charlie Reese](https://charliereese.ca/about) for [Clientelify](https://clientelify.com). It creates AWS infrastructure for your rails application and deploys it in 5 steps (3 installation steps and 2 rake tasks). Subsequent deployment is 1 step (`rake deploy`).
|
8
|
+
|
9
|
+
It is free to use.
|
6
10
|
|
7
11
|
Out of the box, terra_boi provides remote state locking, load-balancing, simple scaling, zero-downtime deployments, CloudWatch logging, DBs, and S3 buckets for multiple infrastructure environments: by default, terra_boi creates staging and prod environments for your web app.
|
8
12
|
|
@@ -1,29 +1,34 @@
|
|
1
1
|
module TerraBoi
|
2
2
|
module GeneratorHelpers
|
3
3
|
# https://api.rubyonrails.org/classes/Rails/Generators/NamedBase.html#method-i-application_name
|
4
|
-
def generate_application_name
|
4
|
+
def generate_application_name(separators: false)
|
5
5
|
if defined?(Rails) && Rails.application
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
6
|
+
app_name = Rails.application.class.name.split("::").first.underscore
|
7
|
+
unless separators
|
8
|
+
app_name = app_name.gsub('_', '')
|
9
|
+
end
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
11
|
+
app_name
|
12
|
+
else
|
13
|
+
"application"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def generate_terraform_files(args)
|
18
|
+
args[:env].each do |env|
|
19
|
+
template(args[:template],
|
20
|
+
"terraform_v2/#{env}/#{args[:file_path]}",
|
21
|
+
{
|
22
|
+
env: env,
|
23
|
+
domain_name: (class_options && class_options[:domain_name]) || generate_application_name + '.com'
|
24
|
+
}
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
24
29
|
end
|
25
30
|
|
26
31
|
class Rails::Generators::Base
|
27
|
-
|
32
|
+
include TerraBoi::GeneratorHelpers
|
28
33
|
end
|
29
|
-
|
34
|
+
|
@@ -15,11 +15,11 @@ module TerraBoi
|
|
15
15
|
|
16
16
|
def init
|
17
17
|
# defined in lib/generators/extensions
|
18
|
-
self.application_name = generate_application_name
|
18
|
+
self.application_name = generate_application_name separators: false
|
19
19
|
end
|
20
20
|
|
21
21
|
def create_db_config_file
|
22
22
|
template "db_config.erb", "config/database.yml"
|
23
23
|
end
|
24
24
|
end
|
25
|
-
end
|
25
|
+
end
|
@@ -20,7 +20,7 @@ variable "db_username" {}
|
|
20
20
|
variable "db_password" {}
|
21
21
|
|
22
22
|
module "db_and_s3" {
|
23
|
-
source = "github.com/charliereese/terraform_modules//data?ref=v0.0.
|
23
|
+
source = "github.com/charliereese/terraform_modules//data?ref=v0.0.28"
|
24
24
|
|
25
25
|
env = "<%= config[:env] %>"
|
26
26
|
app_name = "<%= application_name %>"
|
@@ -28,4 +28,4 @@ module "db_and_s3" {
|
|
28
28
|
db_encrypted = <%= config[:env] == 'prod' ? true : false %>
|
29
29
|
db_username = var.db_username
|
30
30
|
db_password = var.db_password
|
31
|
-
}
|
31
|
+
}
|
@@ -12,7 +12,11 @@ aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --
|
|
12
12
|
|
13
13
|
# Build your Docker image using the following command
|
14
14
|
DOCKERFILE_PATH="$SCRIPT_DIR/../../../."
|
15
|
-
docker build -t $AWS_ECR_REPO_NAME $DOCKERFILE_PATH
|
15
|
+
if ! docker build -t $AWS_ECR_REPO_NAME $DOCKERFILE_PATH; then
|
16
|
+
echo "TERRA_BOI | Command failed. Pruning Docker memory then retrying!"
|
17
|
+
echo "TERRA_BOI | Pruning may take a couple minutes..."
|
18
|
+
docker system prune -a && docker build -t $AWS_ECR_REPO_NAME $DOCKERFILE_PATH
|
19
|
+
fi
|
16
20
|
|
17
21
|
# After the build completes, tag your image so you can push the image to this repository:
|
18
22
|
docker tag $AWS_ECR_REPO_NAME:latest $AWS_ECR_REPO_URL:latest
|
@@ -3,8 +3,8 @@
|
|
3
3
|
# ---------------------------------------------------------------------------------------------------------------------
|
4
4
|
|
5
5
|
module "remote_state_locking" {
|
6
|
-
|
6
|
+
source = "github.com/charliereese/terraform_modules//state?ref=v0.0.28"
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
app_name = "<%= application_name %>"
|
9
|
+
region = "us-east-2"
|
10
10
|
}
|
@@ -35,7 +35,7 @@ module TerraBoi
|
|
35
35
|
|
36
36
|
def init
|
37
37
|
# defined in lib/generators/extensions
|
38
|
-
self.application_name = generate_application_name
|
38
|
+
self.application_name = generate_application_name separators: false
|
39
39
|
self.class_options = options
|
40
40
|
end
|
41
41
|
|
@@ -51,4 +51,4 @@ module TerraBoi
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
54
|
-
end
|
54
|
+
end
|
@@ -14,11 +14,11 @@ module TerraBoi
|
|
14
14
|
)
|
15
15
|
|
16
16
|
def init
|
17
|
-
self.application_name = generate_application_name
|
17
|
+
self.application_name = generate_application_name separators: false
|
18
18
|
end
|
19
19
|
|
20
20
|
def create_main_terraform_file
|
21
21
|
template "state_main.erb", "terraform/state/main.tf"
|
22
22
|
end
|
23
23
|
end
|
24
|
-
end
|
24
|
+
end
|
@@ -155,13 +155,7 @@ end
|
|
155
155
|
|
156
156
|
def push_container_to_ecr
|
157
157
|
puts "\nTERRA_BOI | Building application docker container then pushing to ECR...\n".cyan.bold
|
158
|
-
sh "./terraform/lib/scripts/push_to_ecr.sh"
|
159
|
-
if !ok
|
160
|
-
puts "\nTERRA_BOI | Docker container build and push failed (status = #{res.exitstatus})".cyan.bold
|
161
|
-
puts "\nTERRA_BOI | Pruning docker (to create more memory) and retrying...\n".cyan.bold
|
162
|
-
sh "docker system prune -a && ./terraform/lib/scripts/push_to_ecr.sh"
|
163
|
-
end
|
164
|
-
end
|
158
|
+
sh "./terraform/lib/scripts/push_to_ecr.sh"
|
165
159
|
end
|
166
160
|
|
167
161
|
def apply_web_app_and_worker
|
data/lib/terra_boi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terra_boi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charlie Reese
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -44,13 +44,12 @@ dependencies:
|
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
|
-
description:
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
as code to immediately deploy staging / prod infrastructure).'
|
47
|
+
description: |-
|
48
|
+
Deploy your rails application to AWS with `rake deploy`.
|
49
|
+
|
50
|
+
This ruby / rails gem was created by Charlie Reese (charliereese.ca/about) for Clientelify. It creates AWS infrastructure for your rails application and deploys it in 5 steps (3 installation steps and 2 rake tasks). It is free to use.
|
51
|
+
|
52
|
+
Out of the box, terra_boi provides remote state locking, load-balancing, simple scaling, zero-downtime deployments, CloudWatch logging, DBs, and S3 buckets for multiple infrastructure environments: by default, terra_boi creates staging and prod environments for your web app.
|
54
53
|
email:
|
55
54
|
- j.charles.reese@gmail.com
|
56
55
|
executables: []
|
@@ -125,9 +124,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
124
|
- !ruby/object:Gem::Version
|
126
125
|
version: '0'
|
127
126
|
requirements: []
|
128
|
-
rubygems_version: 3.1.
|
127
|
+
rubygems_version: 3.1.4
|
129
128
|
signing_key:
|
130
129
|
specification_version: 4
|
131
|
-
summary:
|
132
|
-
|
130
|
+
summary: Deploy your rails application to AWS with `rake deploy`. terra_boi generates
|
131
|
+
AWS infrastructure as code, provisions AWS infrastructure, and then deploys your
|
132
|
+
application to it using Terraform, rails generators, and rake tasks.
|
133
133
|
test_files: []
|