renuo-cli 4.17.2 → 4.17.3
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/lib/renuo/cli/commands/create_deploio_app.rb +37 -14
- data/lib/renuo/cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4e5e4edeb2c97766d224c621442512a677b7d6c0f65578698bd70bcfe46df3df
|
|
4
|
+
data.tar.gz: c95e67243cf5cd444f3601c545c207786cf59bd67833406d6120bac816473205
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 70a03383d91f799fd4bcae9acce5425f550af8da2f86424ee77960da92ad976ec6c7ff09ee755d5f1490d651e7be4978539ac5b6308471efbb212b219c7034e7
|
|
7
|
+
data.tar.gz: 452fca47194f507a0e6651b116c45ab97db03cb5aa9dcfba2c0ae24b10dc3f254984def3dcb17f2bd1ea735422c2b17540d2939b7a6037be4cea7b1cabc1ac3d
|
|
@@ -9,7 +9,7 @@ class Renuo::Cli::Commands::CreateDeploioApp # rubocop:disable Metrics/ClassLeng
|
|
|
9
9
|
PROJECT_NAME_PREFIX = "renuo-"
|
|
10
10
|
|
|
11
11
|
command "create-deploio-app" do |c|
|
|
12
|
-
c.syntax = "renuo create-deploio-app"
|
|
12
|
+
c.syntax = "renuo create-deploio-app [project-name] [git-url]"
|
|
13
13
|
c.summary = "Generates the script necessary to setup an application on Deploio."
|
|
14
14
|
c.description = <<~DESC
|
|
15
15
|
Generates the script necessary to setup an application on Deploio.
|
|
@@ -20,14 +20,16 @@ class Renuo::Cli::Commands::CreateDeploioApp # rubocop:disable Metrics/ClassLeng
|
|
|
20
20
|
- Configure repository access by generating SSH keys and adding them to 1Password.
|
|
21
21
|
- Create the application and database for each specified environment.
|
|
22
22
|
DESC
|
|
23
|
+
c.option "--org <organization>", String, "The organization name"
|
|
23
24
|
c.example "renuo create-deploio-app my-app git@github.com:renuo/my-app.git",
|
|
24
25
|
"Prompts the user for the necessary information and generates the commands " \
|
|
25
26
|
"to create the project, databases, and apps on Deploio."
|
|
26
|
-
c.action { |args| new.run(args) }
|
|
27
|
+
c.action { |args, options| new.run(args, options) }
|
|
27
28
|
end
|
|
28
29
|
|
|
29
|
-
def run(args)
|
|
30
|
+
def run(args, options = {})
|
|
30
31
|
@project_name, @git_url = args
|
|
32
|
+
@options = options
|
|
31
33
|
parse_arguments
|
|
32
34
|
setup_commands
|
|
33
35
|
setup_environments
|
|
@@ -51,7 +53,12 @@ class Renuo::Cli::Commands::CreateDeploioApp # rubocop:disable Metrics/ClassLeng
|
|
|
51
53
|
|
|
52
54
|
private
|
|
53
55
|
|
|
56
|
+
def valid_name?(name)
|
|
57
|
+
name&.length&.between?(3, 63) && name.match?(/^[a-z0-9-]+$/)
|
|
58
|
+
end
|
|
59
|
+
|
|
54
60
|
def parse_arguments
|
|
61
|
+
set_organization
|
|
55
62
|
set_project_name
|
|
56
63
|
set_git_url
|
|
57
64
|
set_postgres_version
|
|
@@ -60,7 +67,7 @@ class Renuo::Cli::Commands::CreateDeploioApp # rubocop:disable Metrics/ClassLeng
|
|
|
60
67
|
|
|
61
68
|
def set_project_name
|
|
62
69
|
loop do
|
|
63
|
-
break if
|
|
70
|
+
break if valid_name?(@project_name)
|
|
64
71
|
|
|
65
72
|
say ">> Project name must be between 3 and 63 characters and can only contain lowercase letters, " \
|
|
66
73
|
"numbers, and hyphens. Please try again.".colorize(:red)
|
|
@@ -69,7 +76,7 @@ class Renuo::Cli::Commands::CreateDeploioApp # rubocop:disable Metrics/ClassLeng
|
|
|
69
76
|
end
|
|
70
77
|
|
|
71
78
|
@project_display_name = @project_name
|
|
72
|
-
@
|
|
79
|
+
@project_name_with_org_prefix = "#{@organization}-#{@project_name}"
|
|
73
80
|
end
|
|
74
81
|
|
|
75
82
|
def set_git_url
|
|
@@ -98,7 +105,23 @@ class Renuo::Cli::Commands::CreateDeploioApp # rubocop:disable Metrics/ClassLeng
|
|
|
98
105
|
end
|
|
99
106
|
|
|
100
107
|
def set_vault_name
|
|
101
|
-
@vault_name = ask("
|
|
108
|
+
@vault_name = ask("SSH Credentials for deploio to access the git repo will be stored on 1Password. " \
|
|
109
|
+
"Enter the 1Password vault name: ") do |q|
|
|
110
|
+
q.default = "Deploio"
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def set_organization
|
|
115
|
+
@organization = @options.org if @options.org
|
|
116
|
+
|
|
117
|
+
loop do
|
|
118
|
+
break if valid_name?(@organization)
|
|
119
|
+
|
|
120
|
+
say ">> Organization name must be between 3 and 63 characters and can only contain lowercase letters, " \
|
|
121
|
+
"numbers, and hyphens. Please try again.".colorize(:red)
|
|
122
|
+
|
|
123
|
+
@organization = ask("Enter the organization name (default: renuo): ") { |q| q.default = "renuo" }
|
|
124
|
+
end
|
|
102
125
|
end
|
|
103
126
|
|
|
104
127
|
def setup_commands
|
|
@@ -127,7 +150,7 @@ class Renuo::Cli::Commands::CreateDeploioApp # rubocop:disable Metrics/ClassLeng
|
|
|
127
150
|
|
|
128
151
|
def say_project_creation
|
|
129
152
|
say <<~OUTPUT
|
|
130
|
-
nctl create project #{@
|
|
153
|
+
nctl create project #{@project_name_with_org_prefix} --display-name='#{@project_display_name}' --organization=#{@organization}
|
|
131
154
|
OUTPUT
|
|
132
155
|
end
|
|
133
156
|
|
|
@@ -135,14 +158,14 @@ class Renuo::Cli::Commands::CreateDeploioApp # rubocop:disable Metrics/ClassLeng
|
|
|
135
158
|
if environment == "main"
|
|
136
159
|
say <<~OUTPUT
|
|
137
160
|
nctl create postgres #{environment} \\
|
|
138
|
-
--project=#{@
|
|
161
|
+
--project=#{@project_name_with_org_prefix} \\
|
|
139
162
|
--postgres-version=#{@postgres_version} \\
|
|
140
163
|
--machine-type=nine-db-xs
|
|
141
164
|
OUTPUT
|
|
142
165
|
else
|
|
143
166
|
say <<~OUTPUT
|
|
144
167
|
nctl create postgresdatabase #{environment} \\
|
|
145
|
-
--project=#{@
|
|
168
|
+
--project=#{@project_name_with_org_prefix} \\
|
|
146
169
|
--postgres-database-version=#{@postgres_version}
|
|
147
170
|
OUTPUT
|
|
148
171
|
end
|
|
@@ -151,7 +174,7 @@ class Renuo::Cli::Commands::CreateDeploioApp # rubocop:disable Metrics/ClassLeng
|
|
|
151
174
|
def say_app_creation(environment)
|
|
152
175
|
say <<~OUTPUT
|
|
153
176
|
nctl create app #{environment} \\
|
|
154
|
-
--project #{@
|
|
177
|
+
--project #{@project_name_with_org_prefix} \\
|
|
155
178
|
--git-ssh-private-key-from-file=#{GITHUB_SSH_KEY_FILE_NAME} \\
|
|
156
179
|
--git-url=#{@git_url} \\
|
|
157
180
|
--git-revision="#{environment}" \\
|
|
@@ -169,15 +192,15 @@ class Renuo::Cli::Commands::CreateDeploioApp # rubocop:disable Metrics/ClassLeng
|
|
|
169
192
|
--account renuo.1password.com \\
|
|
170
193
|
--category ssh \\
|
|
171
194
|
--ssh-generate-key #{SSH_ALGORITHM.downcase} \\
|
|
172
|
-
--title "#{@
|
|
195
|
+
--title "#{@project_name_with_org_prefix}-deploy-key" \\
|
|
173
196
|
--vault #{@vault_name} \\
|
|
174
|
-
--tags #{@
|
|
197
|
+
--tags #{@project_name_with_org_prefix}
|
|
175
198
|
|
|
176
199
|
# Extract keys to temp files for deploio usage
|
|
177
|
-
op item get "#{@
|
|
200
|
+
op item get "#{@project_name_with_org_prefix}-deploy-key" --vault #{@vault_name} \\
|
|
178
201
|
--account renuo.1password.com \\
|
|
179
202
|
--reveal --fields "public key" > #{file_name}.pub
|
|
180
|
-
op item get "#{@
|
|
203
|
+
op item get "#{@project_name_with_org_prefix}-deploy-key" --vault #{@vault_name} --reveal \\
|
|
181
204
|
--account renuo.1password.com \\
|
|
182
205
|
--fields "private key" --format json | jq -r '.ssh_formats.openssh.value' > #{file_name}
|
|
183
206
|
OUTPUT
|
data/lib/renuo/cli/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: renuo-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.17.
|
|
4
|
+
version: 4.17.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Renuo AG
|
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
136
136
|
- !ruby/object:Gem::Version
|
|
137
137
|
version: '0'
|
|
138
138
|
requirements: []
|
|
139
|
-
rubygems_version:
|
|
139
|
+
rubygems_version: 3.6.9
|
|
140
140
|
specification_version: 4
|
|
141
141
|
summary: The Renuo CLI automates some common workflows.
|
|
142
142
|
test_files: []
|