souls 1.3.2 → 1.3.6
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 +1 -0
- data/lib/souls/cli/create/index.rb +15 -16
- data/lib/souls/cli/gcloud/sql/index.rb +38 -6
- data/lib/souls/cli/github/index.rb +46 -2
- data/lib/souls/cli/init/index.rb +3 -3
- 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
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67562406559d88c75d9c4f6dd7364524b947a0b02cdefd241b03c0a606f03f32
|
4
|
+
data.tar.gz: f7dc79a83361b8fc49675953760f2552cefbd46b39aa83e06c5fc3282283f91c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 697e0be85783dc17f4e4a283ab8b3bd46b9cccc693bdb170f1e4b9d33f0f221a8ac125ff21319e895a2b7f1233848d74b124b9a361041d1b583bd2b3ee4b4556
|
7
|
+
data.tar.gz: c24ba7aaba182beed99d69dd1159897a5d2164457f24f75ce0a3f0c2f9c6eab14384e181d7049054bc345b847f31615a113f45a50c3cf36ef5503192e869dc48
|
data/README.md
CHANGED
@@ -68,6 +68,7 @@ It is a development environment where you can immediately notice the mistakes th
|
|
68
68
|
- [Docker](https://www.docker.com/)
|
69
69
|
- [Firebase CLI](https://firebase.google.com/docs/cli)
|
70
70
|
- [Ruby](https://www.ruby-lang.org)
|
71
|
+
- [Github CLI](https://cli.github.com/)
|
71
72
|
|
72
73
|
## Cloud Infrastructure
|
73
74
|
|
@@ -173,39 +173,38 @@ end
|
|
173
173
|
uses: google-github-actions/setup-gcloud@master
|
174
174
|
with:
|
175
175
|
version: "323.0.0"
|
176
|
-
project_id: ${{ secrets.
|
177
|
-
service_account_key: ${{ secrets.
|
176
|
+
project_id: ${{ secrets.SOULS_GCP_PROJECT_ID }}
|
177
|
+
service_account_key: ${{ secrets.SOULS_GCP_SA_KEY }}
|
178
178
|
export_default_credentials: true
|
179
179
|
|
180
180
|
- name: Configure Docker
|
181
181
|
run: gcloud auth configure-docker --quiet
|
182
182
|
|
183
183
|
- name: Build Docker container
|
184
|
-
run: docker build -f ./apps/#{worker_name}/Dockerfile ./apps/#{worker_name} -t gcr.io/${{ secrets.
|
184
|
+
run: docker build -f ./apps/#{worker_name}/Dockerfile ./apps/#{worker_name} -t gcr.io/${{ secrets.SOULS_GCP_PROJECT_ID }}/${{secrets.SOULS_APP_NAME}}-#{worker_name}
|
185
185
|
|
186
186
|
- name: Push to Container Resistory
|
187
|
-
run: docker push gcr.io/${{ secrets.
|
187
|
+
run: docker push gcr.io/${{ secrets.SOULS_GCP_PROJECT_ID }}/${{secrets.SOULS_APP_NAME}}-#{worker_name}
|
188
188
|
|
189
189
|
- name: Deploy to Cloud Run
|
190
190
|
run: |
|
191
|
-
gcloud run deploy souls-${{ secrets.
|
192
|
-
--service-account=${{ secrets.
|
193
|
-
--image=gcr.io/${{ secrets.
|
191
|
+
gcloud run deploy souls-${{ secrets.SOULS_APP_NAME }}-#{worker_name} \\
|
192
|
+
--service-account=${{ secrets.SOULS_APP_NAME }}@${{ secrets.SOULS_GCP_PROJECT_ID }}.iam.gserviceaccount.com \\
|
193
|
+
--image=gcr.io/${{ secrets.SOULS_GCP_PROJECT_ID }}/${{secrets.SOULS_APP_NAME}}-#{worker_name} \\
|
194
194
|
--memory=4Gi \\
|
195
|
-
--region
|
195
|
+
--region=${{ secrets.SOULS_GCP_REGION }} \\
|
196
196
|
--allow-unauthenticated \\
|
197
197
|
--platform=managed \\
|
198
198
|
--quiet \\
|
199
199
|
--concurrency=80 \\
|
200
200
|
--port=8080 \\
|
201
|
-
--set-cloudsql-instances=${{ secrets.
|
202
|
-
--set-env-vars="
|
203
|
-
--set-env-vars="
|
204
|
-
--set-env-vars="
|
205
|
-
--set-env-vars="
|
206
|
-
--set-env-vars="
|
207
|
-
--set-env-vars="
|
208
|
-
--set-env-vars="PROJECT_ID=${{ secrets.GCP_PROJECT_ID }}"
|
201
|
+
--set-cloudsql-instances=${{ secrets.SOULS_GCLOUDSQL_INSTANCE }} \\
|
202
|
+
--set-env-vars="SOULS_DB_USER=${{ secrets.SOULS_DB_USER }}" \\
|
203
|
+
--set-env-vars="SOULS_DB_PW=${{ secrets.SOULS_DB_PW }}" \\
|
204
|
+
--set-env-vars="SOULS_DB_HOST=${{ secrets.SOULS_DB_HOST }}" \\
|
205
|
+
--set-env-vars="SOULS_TZ=${{ secrets.SOULS_TZ }}" \\
|
206
|
+
--set-env-vars="SOULS_SECRET_KEY_BASE=${{ secrets.SOULS_SECRET_KEY_BASE }}" \\
|
207
|
+
--set-env-vars="SOULS_PROJECT_ID=${{ secrets.SOULS_GCP_PROJECT_ID }}"
|
209
208
|
TEXT
|
210
209
|
end
|
211
210
|
puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
@@ -5,6 +5,8 @@ module Souls
|
|
5
5
|
method_option :root_password, default: "", aliases: "--root-password", desc: "Set Cloud SQL Root Password"
|
6
6
|
method_option :mysql, type: :boolean, default: false, aliases: "--mysql", desc: "Set Cloud SQL Type to MySQL"
|
7
7
|
def create_instance
|
8
|
+
app_name = Souls.configuration.app
|
9
|
+
project_id = Souls.configuration.project_id
|
8
10
|
instance_name = Souls.configuration.instance_name if instance_name.blank?
|
9
11
|
region = Souls.configuration.region if options[:region].blank?
|
10
12
|
db_type = options[:mysql] ? "MYSQL_8_0" : "POSTGRES_13"
|
@@ -12,16 +14,36 @@ module Souls
|
|
12
14
|
zone = "#{region}-b"
|
13
15
|
system(
|
14
16
|
"gcloud sql instances create #{instance_name} \
|
15
|
-
--database-version=#{db_type} --cpu=
|
17
|
+
--database-version=#{db_type} --cpu=1 --memory=3750MB --zone=#{zone} \
|
16
18
|
--root-password='#{options[:root_password]}' --database-flags cloudsql.iam_authentication=on"
|
17
19
|
)
|
18
20
|
Dir.chdir(Souls.get_api_path.to_s) do
|
19
21
|
file_path = ".env"
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
File.open(file_path, "w") do |line|
|
23
|
+
line.write(<<~TEXT)
|
24
|
+
SOULS_DB_HOST=#{get_sql_ip.strip}
|
25
|
+
SOULS_DB_PW=#{options[:root_password]}
|
26
|
+
SOULS_DB_USER=postgres
|
27
|
+
SOULS_TZ="#{region_to_timezone(region: region)}"
|
28
|
+
SOULS_SECRET_KEY_BASE="#{SecureRandom.base64(64)}"
|
29
|
+
TEXT
|
30
|
+
end
|
31
|
+
end
|
32
|
+
Dir.chdir(Souls.get_mother_path.to_s) do
|
33
|
+
file_path = ".env.production"
|
34
|
+
File.open(file_path, "w") do |line|
|
35
|
+
line.write(<<~TEXT)
|
36
|
+
SOULS_DB_HOST="/cloudsql/#{project_id}:#{region}:#{instance_name}"
|
37
|
+
SOULS_DB_PW=#{options[:root_password]}
|
38
|
+
SOULS_DB_USER=postgres
|
39
|
+
SOULS_APP_NAME=#{app_name}
|
40
|
+
SOULS_GCP_PROJECT_ID=#{project_id}
|
41
|
+
SOULS_GCP_REGION=#{region}
|
42
|
+
SOULS_GCLOUDSQL_INSTANCE="#{project_id}:#{region}:#{instance_name}"
|
43
|
+
SOULS_TZ="#{region_to_timezone(region: region)}"
|
44
|
+
SOULS_SECRET_KEY_BASE="#{SecureRandom.base64(64)}"
|
45
|
+
TEXT
|
46
|
+
end
|
25
47
|
end
|
26
48
|
rescue Thor::Error => e
|
27
49
|
raise(Thor::Error, e)
|
@@ -111,5 +133,15 @@ module Souls
|
|
111
133
|
def get_sql_ip
|
112
134
|
`gcloud sql instances list | grep james | awk '{print $5}'`
|
113
135
|
end
|
136
|
+
|
137
|
+
def region_to_timezone(region: "asia-northeast1")
|
138
|
+
if region.include?("asia")
|
139
|
+
"Asia/Tokyo"
|
140
|
+
elsif region.include?("europe")
|
141
|
+
"Europe/Amsterdam"
|
142
|
+
else
|
143
|
+
"America/Los_Angeles"
|
144
|
+
end
|
145
|
+
end
|
114
146
|
end
|
115
147
|
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module Souls
|
2
2
|
class Github < Thor
|
3
|
-
desc "secret_set", "Github Secret Set
|
3
|
+
desc "secret_set", "Github Secret Set from .env.production"
|
4
4
|
def secret_set
|
5
|
-
require("#{Souls.get_api_path}/config/souls")
|
6
5
|
file_path = ".env.production"
|
7
6
|
File.open(file_path, "r") do |file|
|
8
7
|
file.each_line do |line|
|
@@ -11,5 +10,50 @@ module Souls
|
|
11
10
|
end
|
12
11
|
end
|
13
12
|
end
|
13
|
+
|
14
|
+
desc "add_env", "Add New env and Sync Github Secret"
|
15
|
+
method_option :key, aliases: "--key", required: true, desc: "Key Name"
|
16
|
+
method_option :value, aliases: "--value", required: true, desc: "Value Name"
|
17
|
+
method_option :dqm, type: :boolean, aliases: "--dqm", default: false, desc: "Enable Double Quotation Mark"
|
18
|
+
def add_env
|
19
|
+
update_env_production(key: options[:key], value: options[:value], dqm: options[:dqm])
|
20
|
+
update_api_env(key: options[:key], value: options[:value], dqm: options[:dqm])
|
21
|
+
update_github_actions(key: options[:key])
|
22
|
+
Souls::Github.new.invoke(:secret_set)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def update_env_production(key:, value:, dqm: false)
|
28
|
+
Dir.chdir(Souls.get_mother_path.to_s) do
|
29
|
+
file_path = ".env.production"
|
30
|
+
File.open(file_path, "a") do |line|
|
31
|
+
dqm ? line.write("\n#{key.upcase}=\"#{value}\"") : line.write("\n#{key.upcase}=#{value}")
|
32
|
+
end
|
33
|
+
puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def update_api_env(key:, value:, dqm: false)
|
38
|
+
Dir.chdir(Souls.get_api_path.to_s) do
|
39
|
+
file_path = ".env"
|
40
|
+
File.open(file_path, "a") do |line|
|
41
|
+
dqm ? line.write("\n#{key.upcase}=\"#{value}\"") : line.write("\n#{key.upcase}=#{value}")
|
42
|
+
end
|
43
|
+
puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def update_github_actions(key:)
|
48
|
+
Dir.chdir(Souls.get_mother_path.to_s) do
|
49
|
+
file_paths = Dir[".github/workflows/*.yml"]
|
50
|
+
file_paths.each do |file_path|
|
51
|
+
File.open(file_path, "a") do |line|
|
52
|
+
line.write(" \\ \n --set-env-vars=\"#{key.upcase}=${{ secrets.#{key.upcase} }}\"")
|
53
|
+
end
|
54
|
+
puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
14
58
|
end
|
15
59
|
end
|
data/lib/souls/cli/init/index.rb
CHANGED
@@ -119,15 +119,15 @@ module Souls
|
|
119
119
|
|
120
120
|
gem "activesupport", "6.1.4.1"
|
121
121
|
gem "foreman", "0.87.2"
|
122
|
-
gem "google-cloud-pubsub", "2.
|
122
|
+
gem "google-cloud-pubsub", "2.9.0"
|
123
123
|
gem "paint", "2.2.1"
|
124
124
|
gem "parser", "3.0.2.0"
|
125
125
|
gem "pg", "1.2.3"
|
126
126
|
gem "rake", "13.0.6"
|
127
127
|
gem "rspec", "3.10.0"
|
128
|
-
gem "rubocop", "1.
|
128
|
+
gem "rubocop", "1.22.3"
|
129
129
|
gem "sinatra-activerecord", "2.0.23"
|
130
|
-
gem "solargraph", "0.
|
130
|
+
gem "solargraph", "0.44.0"
|
131
131
|
gem "souls", "#{Souls::VERSION}"
|
132
132
|
gem "steep", "0.46.0"
|
133
133
|
gem "thor", "1.1.0"
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.6
|
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.6
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: souls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.6
|
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
13
|
date: 2021-11-01 00:00:00.000000000 Z
|
@@ -231,7 +231,7 @@ metadata:
|
|
231
231
|
homepage_uri: https://souls.elsoul.nl
|
232
232
|
source_code_uri: https://github.com/elsoul/souls
|
233
233
|
changelog_uri: https://github.com/elsoul/souls
|
234
|
-
post_install_message:
|
234
|
+
post_install_message:
|
235
235
|
rdoc_options: []
|
236
236
|
require_paths:
|
237
237
|
- lib
|
@@ -247,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
247
|
version: '0'
|
248
248
|
requirements: []
|
249
249
|
rubygems_version: 3.2.22
|
250
|
-
signing_key:
|
250
|
+
signing_key:
|
251
251
|
specification_version: 4
|
252
252
|
summary: Build Serverless Apps faster like Rails. Powered by Ruby GraphQL, RBS/Steep,
|
253
253
|
Active Record, RSpec, RuboCop, and Google Cloud.
|