souls 0.35.0 → 0.35.4
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/souls/cli/create/index.rb +6 -0
- data/lib/souls/cli/gcloud/compute/index.rb +113 -0
- data/lib/souls/cli/gcloud/index.rb +3 -0
- data/lib/souls/cli/gcloud/run/index.rb +4 -0
- data/lib/souls/cli/index.rb +4 -0
- data/lib/souls/init.rb +2 -0
- data/lib/souls/version.rb +1 -1
- data/lib/souls/versions/.souls_api_version +1 -1
- data/lib/souls/versions/.souls_worker_version +1 -1
- data/lib/souls.rb +2 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e4ac0165aeb1a4ebd990de69d4d1479a3a5318c99cdf8ca481efd1ba761f35d
|
4
|
+
data.tar.gz: 101aba307c5c493716325d12259d50fce939f65f4c62f130a438369cf7fffa59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 768249fc180dc4442afc593e38eb737cd33dd0fded32e4586cb1e5ee9e5b4e6d5ac4fa4570647b5559f1616c31b9d25431006a43f97babd9f72c480b123661c2
|
7
|
+
data.tar.gz: 8456b9584df445078f51915698c11564460f6de4d2a7fddb532b36f37fda84ddae7f420409d9d8eca68433068f5e7fa59dcded3c5e468fbe82ea9ae9a28d30bd
|
@@ -0,0 +1,113 @@
|
|
1
|
+
module Souls
|
2
|
+
module Gcloud
|
3
|
+
module Compute
|
4
|
+
class << self
|
5
|
+
def setup_vpc_nat(app_name: "", region: "asia-northeast1", range: "10.124.0.0/28")
|
6
|
+
create_network(app_name: app_name)
|
7
|
+
create_firewall_tcp(app_name: app_name, range: range)
|
8
|
+
create_firewall_ssh(app_name: app_name)
|
9
|
+
create_subnet(app_name: app_name, region: region, range: range)
|
10
|
+
create_connector(app_name: app_name, region: region)
|
11
|
+
create_external_ip(app_name: app_name, region: region)
|
12
|
+
create_nat(app_name: app_name, region: region)
|
13
|
+
nat_credit(app_name: app_name)
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_network(app_name: "")
|
17
|
+
app_name = Souls.configuration.app if app_name.blank?
|
18
|
+
system("gcloud compute networks create #{app_name}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_firewall_tcp(app_name: "", range: "10.124.0.0/28")
|
22
|
+
app_name = Souls.configuration.app if app_name.blank?
|
23
|
+
system(
|
24
|
+
"gcloud compute firewall-rules create #{app_name} \
|
25
|
+
--network #{app_name} --allow tcp,udp,icmp --source-ranges #{range}"
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
def create_firewall_ssh(app_name: "")
|
30
|
+
app_name = Souls.configuration.app if app_name.blank?
|
31
|
+
system(
|
32
|
+
"gcloud compute firewall-rules create #{app_name}-ssh --network #{app_name} \
|
33
|
+
--allow tcp:22,tcp:3389,icmp"
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
def create_subnet(app_name: "", region: "asia-northeast1", range: "10.124.0.0/28")
|
38
|
+
app_name = Souls.configuration.app if app_name.blank?
|
39
|
+
system(
|
40
|
+
"gcloud compute networks subnets create #{app_name}-subnet \
|
41
|
+
--range=#{range} --network=#{app_name} --region=#{region}"
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
def create_connector(app_name: "", region: "asia-northeast1")
|
46
|
+
app_name = Souls.configuration.app if app_name.blank?
|
47
|
+
system(
|
48
|
+
"gcloud compute networks vpc-access connectors create #{app_name}-connector \
|
49
|
+
--region=#{region} \
|
50
|
+
--subnet-project=#{app_name} \
|
51
|
+
--subnet=#{app_name}-subnet"
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
def create_external_ip(app_name: "", region: "asia-northeast1")
|
56
|
+
app_name = Souls.configuration.app if app_name.blank?
|
57
|
+
system("gcloud compute addresses create #{app_name}-worker-ip --region=#{region}")
|
58
|
+
end
|
59
|
+
|
60
|
+
def create_nat(app_name: "", region: "asia-northeast1")
|
61
|
+
app_name = Souls.configuration.app if app_name.blank?
|
62
|
+
system(
|
63
|
+
"gcloud compute routers nats create #{app_name}-worker-nat \
|
64
|
+
--router=#{app_name}-router \
|
65
|
+
--region=#{region} \
|
66
|
+
--nat-custom-subnet-ip-ranges=#{app_name}-subnet \
|
67
|
+
--nat-external-ip-pool=#{app_name}-worker-ip"
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
def network_list
|
72
|
+
system("gcloud compute network list")
|
73
|
+
end
|
74
|
+
|
75
|
+
def nat_credit(app_name: "", worker_name: "mailer")
|
76
|
+
app_name = Souls.configuration.app if app_name.blank?
|
77
|
+
line = Paint["====================================", :yellow]
|
78
|
+
puts("\n")
|
79
|
+
puts(line)
|
80
|
+
txt2 = <<~TEXT
|
81
|
+
_____ ____ __ ____#{' '}
|
82
|
+
/ ___// __ \\/ / / / / %{red1}
|
83
|
+
\\__ \\/ / / / / / / / %{red2}
|
84
|
+
___/ / /_/ / /_/ / /___%{red3}#{' '}
|
85
|
+
/____/\\____/\\____/_____%{red4}#{' '}
|
86
|
+
TEXT
|
87
|
+
red1 = ["_____", :red]
|
88
|
+
red2 = ["/ ___/", :red]
|
89
|
+
red3 = ["(__ )", :red]
|
90
|
+
red4 = ["/____/", :red]
|
91
|
+
ms = Paint % [txt2, :cyan, { red1: red1, red2: red2, red3: red3, red4: red4 }]
|
92
|
+
puts(ms)
|
93
|
+
puts(line)
|
94
|
+
welcome = Paint["VPC Network is All Set!", :white]
|
95
|
+
puts(welcome)
|
96
|
+
puts(line)
|
97
|
+
endroll = <<~TEXT
|
98
|
+
|
99
|
+
Edit `.github/workflow/worker.yml`
|
100
|
+
|
101
|
+
Add these 2 options in `- name: Deploy to Cloud Run` step
|
102
|
+
--vpc-connector=#{app_name}-connector \
|
103
|
+
--vpc-egress=all \
|
104
|
+
|
105
|
+
TEXT
|
106
|
+
cd = Paint[endroll, :white]
|
107
|
+
puts(cd)
|
108
|
+
puts(line)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -2,6 +2,7 @@ require_relative "./iam/index"
|
|
2
2
|
require_relative "./pubsub/index"
|
3
3
|
require_relative "./run/index"
|
4
4
|
require_relative "./sql/index"
|
5
|
+
require_relative "./compute/index"
|
5
6
|
|
6
7
|
module Souls
|
7
8
|
module Gcloud
|
@@ -29,6 +30,8 @@ module Souls
|
|
29
30
|
puts("Operating permission to containerregistry.googleapis.com")
|
30
31
|
system("gcloud services enable run.googleapis.com")
|
31
32
|
puts("Operating permission to run.googleapis.com")
|
33
|
+
system("gcloud services enable vpcaccess.googleapis.com")
|
34
|
+
puts("Operating permission to vpcaccess.googleapis.com")
|
32
35
|
end
|
33
36
|
end
|
34
37
|
module Iam
|
@@ -14,6 +14,10 @@ module Souls
|
|
14
14
|
project_id = Souls.configuration.project_id if project_id.blank?
|
15
15
|
system("gcloud run services list --project #{project_id}")
|
16
16
|
end
|
17
|
+
|
18
|
+
def get_endpoint(worker_name: "")
|
19
|
+
system("gcloud run services list | grep #{worker_name} | awk '{print $4}'")
|
20
|
+
end
|
17
21
|
end
|
18
22
|
end
|
19
23
|
end
|
data/lib/souls/cli/index.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require_relative "./create/index"
|
1
2
|
require_relative "./docker/index"
|
2
3
|
require_relative "./gcloud/index"
|
3
4
|
require_relative "./release/index"
|
@@ -5,6 +6,9 @@ require_relative "./sync/index"
|
|
5
6
|
require_relative "./upgrade/index"
|
6
7
|
|
7
8
|
module Souls
|
9
|
+
module Create
|
10
|
+
end
|
11
|
+
|
8
12
|
module Docker
|
9
13
|
end
|
10
14
|
|
data/lib/souls/init.rb
CHANGED
@@ -44,6 +44,7 @@ module Souls
|
|
44
44
|
config.project_id = "#{app_name}-project"
|
45
45
|
config.strain = "api"
|
46
46
|
config.fixed_gems = ["excluded_gem"]
|
47
|
+
config.workers = []
|
47
48
|
end
|
48
49
|
TEXT
|
49
50
|
end
|
@@ -72,6 +73,7 @@ module Souls
|
|
72
73
|
config.project_id = "#{app_name}-project"
|
73
74
|
config.strain = "mother"
|
74
75
|
config.fixed_gems = ["excluded_gem"]
|
76
|
+
config.workers = []
|
75
77
|
end
|
76
78
|
TEXT
|
77
79
|
end
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.14.
|
1
|
+
0.14.4
|
@@ -1 +1 @@
|
|
1
|
-
0.14.
|
1
|
+
0.14.4
|
data/lib/souls.rb
CHANGED
@@ -246,7 +246,7 @@ module Souls
|
|
246
246
|
end
|
247
247
|
|
248
248
|
class Configuration
|
249
|
-
attr_accessor :app, :strain, :project_id, :github_repo, :worker_endpoint, :fixed_gems
|
249
|
+
attr_accessor :app, :strain, :project_id, :github_repo, :worker_endpoint, :fixed_gems, :workers
|
250
250
|
|
251
251
|
def initialize
|
252
252
|
@app = nil
|
@@ -255,6 +255,7 @@ module Souls
|
|
255
255
|
@github_repo = nil
|
256
256
|
@worker_endpoint = nil
|
257
257
|
@fixed_gems = nil
|
258
|
+
@workers = nil
|
258
259
|
end
|
259
260
|
end
|
260
261
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: souls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.35.
|
4
|
+
version: 0.35.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- POPPIN-FUMI
|
8
8
|
- KishiTheMechanic
|
9
9
|
- James Neve
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-08-
|
13
|
+
date: 2021-08-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -125,7 +125,9 @@ files:
|
|
125
125
|
- lib/souls/api/update/rspec_mutation.rb
|
126
126
|
- lib/souls/api/update/rspec_resolver.rb
|
127
127
|
- lib/souls/api/update/type.rb
|
128
|
+
- lib/souls/cli/create/index.rb
|
128
129
|
- lib/souls/cli/docker/index.rb
|
130
|
+
- lib/souls/cli/gcloud/compute/index.rb
|
129
131
|
- lib/souls/cli/gcloud/iam/index.rb
|
130
132
|
- lib/souls/cli/gcloud/index.rb
|
131
133
|
- lib/souls/cli/gcloud/pubsub/index.rb
|
@@ -156,7 +158,7 @@ metadata:
|
|
156
158
|
homepage_uri: https://souls.elsoul.nl
|
157
159
|
source_code_uri: https://github.com/elsoul/souls
|
158
160
|
changelog_uri: https://github.com/elsoul/souls
|
159
|
-
post_install_message:
|
161
|
+
post_install_message:
|
160
162
|
rdoc_options: []
|
161
163
|
require_paths:
|
162
164
|
- lib
|
@@ -172,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
174
|
version: '0'
|
173
175
|
requirements: []
|
174
176
|
rubygems_version: 3.2.22
|
175
|
-
signing_key:
|
177
|
+
signing_key:
|
176
178
|
specification_version: 4
|
177
179
|
summary: SOULs はサーバーレスフルスタックフレームワークです。柔軟な Ruby GraphQL API と Worker はルーティングの必要がありません。
|
178
180
|
クラウド環境への自動デプロイ、CI/CD ワークフローを標準装備。開発者がビジネスロジックに集中し、楽しくコードが書けるような環境を目指しています。
|