souls 1.20.1 → 1.20.2
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/app/graphql/souls_mutation.rb +5 -0
- data/lib/souls/app/graphql/souls_query.rb +5 -0
- data/lib/souls/cli/create/functions.rb +12 -0
- data/lib/souls/cli/gcloud/functions/index.rb +2 -2
- data/lib/souls/cli/gcloud/scheduler/index.rb +7 -8
- data/lib/souls/cli/gcloud/sql/index.rb +30 -8
- data/lib/souls/cli/release/release.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
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd866432ec0f265187450b3387881c23c5bdff953f5055b6b457cee651e70623
|
4
|
+
data.tar.gz: deb328b90a62d79d2bfacff948de0f010bb98801df986dc02f0a1997821a5024
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e370826736549cda4f68b6cac11e253cdc7b10afb535c7e70e0084af29457b3e9519dfe68970e1e38a0f86dd734e24f3ce423475d15d5aa8536486d898eb625
|
7
|
+
data.tar.gz: 3aabbaa8a7873408bfb74c254a71b8ee3b7a4703ee87f4d349509d6ef276bb067a36b966dcd3f74cd618946a71dfe41597990caaf62f9c9b5252d49f413ab3ec
|
@@ -1,5 +1,10 @@
|
|
1
1
|
module SOULs
|
2
2
|
class SOULsMutation < GraphQL::Schema::RelayClassicMutation
|
3
|
+
def self.post(url:, payload: {}, content_type: "application/json")
|
4
|
+
response = Faraday.post(url, payload.to_json, "Content-Type": content_type)
|
5
|
+
response.body
|
6
|
+
end
|
7
|
+
|
3
8
|
def self.souls_check_user_permissions(user, obj, method)
|
4
9
|
raise(StandardError, "Invalid or Missing Token") unless user
|
5
10
|
|
@@ -5,6 +5,11 @@ module SOULs
|
|
5
5
|
attr_accessor :schedule
|
6
6
|
end
|
7
7
|
|
8
|
+
def self.post(url:, payload: {}, content_type: "application/json")
|
9
|
+
response = Faraday.post(url, payload.to_json, "Content-Type": content_type)
|
10
|
+
response.body
|
11
|
+
end
|
12
|
+
|
8
13
|
def self.check_user_permissions(user, obj, method)
|
9
14
|
raise(StandardError, "Invalid or Missing Token") unless user
|
10
15
|
|
@@ -47,6 +47,18 @@ module SOULs
|
|
47
47
|
SOULs::Painter.create_file(file_path)
|
48
48
|
end
|
49
49
|
create_env_yaml(file_dir: file_dir)
|
50
|
+
endroll = <<~TEXT
|
51
|
+
♤ Deploy Cloud Functions ♤
|
52
|
+
|
53
|
+
$ cd apps/cf-#{version_string}-#{function_name}
|
54
|
+
$ souls functions deploy
|
55
|
+
|
56
|
+
$ souls functions help
|
57
|
+
|
58
|
+
|
59
|
+
Doc: https://souls.elsoul.nl
|
60
|
+
TEXT
|
61
|
+
puts(Paint[endroll, :white])
|
50
62
|
end
|
51
63
|
|
52
64
|
private
|
@@ -11,7 +11,7 @@ module SOULs
|
|
11
11
|
end
|
12
12
|
|
13
13
|
runtime = current_dir.match(/cf-(\D+\d+)-/)[1]
|
14
|
-
runtime_lang = current_dir.match(/^cf-(\D+)\d+-/)
|
14
|
+
runtime_lang = current_dir.match(/^cf-(\D+)\d+-/)[1]
|
15
15
|
entry_point =
|
16
16
|
case runtime_lang
|
17
17
|
when "nodejs"
|
@@ -47,7 +47,7 @@ module SOULs
|
|
47
47
|
Dir.chdir(SOULs.get_mother_path.to_s) do
|
48
48
|
FileUtils.rm_rf("apps/#{name}")
|
49
49
|
end
|
50
|
-
SOULs::Painter.
|
50
|
+
SOULs::Painter.warning("Deleted #{name} functions!", "✨")
|
51
51
|
end
|
52
52
|
|
53
53
|
desc "url", "Get SOULs Functions URL"
|
@@ -1,12 +1,11 @@
|
|
1
1
|
module SOULs
|
2
2
|
class CloudScheduler < Thor
|
3
|
-
desc "awake", "Set Ping Every 15min by Google Cloud Scheduler"
|
4
|
-
|
5
|
-
def awake
|
3
|
+
desc "awake [url]", "Set Ping Every 15min by Google Cloud Scheduler"
|
4
|
+
def awake(url)
|
6
5
|
app_name = SOULs.configuration.app
|
7
6
|
system(
|
8
7
|
"gcloud scheduler jobs create http #{app_name}-awake
|
9
|
-
--schedule '0,10,20,30,40,50 * * * *' --uri #{
|
8
|
+
--schedule '0,10,20,30,40,50 * * * *' --uri #{url} --http-method GET"
|
10
9
|
)
|
11
10
|
end
|
12
11
|
|
@@ -18,11 +17,11 @@ module SOULs
|
|
18
17
|
project_id = SOULs.configuration.project_id
|
19
18
|
|
20
19
|
schedules_list = current_schedules
|
21
|
-
worker_name = FileUtils.pwd.split("/").last
|
20
|
+
worker_name = FileUtils.pwd.split("/").last.underscore
|
22
21
|
Queries::BaseQuery.all_schedules.each do |k, v|
|
23
22
|
worker_name = FileUtils.pwd.split("/").last
|
24
|
-
job_name = "
|
25
|
-
topic = "
|
23
|
+
job_name = "souls-#{worker_name}-#{k.to_s.underscore}".to_sym
|
24
|
+
topic = "souls-#{worker_name}-#{k.to_s.underscore}"
|
26
25
|
message_body = "query { #{k.to_s.camelize(:lower)} { response }}"
|
27
26
|
|
28
27
|
if schedules_list.include?(job_name)
|
@@ -43,7 +42,7 @@ module SOULs
|
|
43
42
|
end
|
44
43
|
|
45
44
|
schedules_list.each do |k, _|
|
46
|
-
next unless k.match?(/^
|
45
|
+
next unless k.match?(/^souls-#{worker_name}/)
|
47
46
|
|
48
47
|
system("gcloud scheduler jobs delete #{k} -q >/dev/null 2>&1")
|
49
48
|
end
|
@@ -13,19 +13,41 @@ module SOULs
|
|
13
13
|
|
14
14
|
zone = "#{region}-b"
|
15
15
|
system("gcloud config set project #{project_id} >/dev/null 2>&1")
|
16
|
-
|
17
|
-
|
18
|
-
"gcloud sql instances create #{instance_name} \
|
16
|
+
system(
|
17
|
+
"gcloud sql instances create #{instance_name} \
|
19
18
|
--database-version=#{db_type} --cpu=1 --memory=4096MB --zone=#{zone} \
|
20
19
|
--root-password='#{password}' --database-flags cloudsql.iam_authentication=on"
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
20
|
+
)
|
21
|
+
SOULs::Sql.new.env(password: password)
|
22
|
+
SOULs::Github.new.secret_set
|
23
|
+
SOULs::Painter.success("Cloud SQL #{instance_name} is successfully created! You can push to deploy!")
|
26
24
|
true
|
27
25
|
end
|
28
26
|
|
27
|
+
desc "stop", "Stop Cloud SQL Instance"
|
28
|
+
def stop
|
29
|
+
project_id = SOULs.configuration.project_id
|
30
|
+
instance_name = SOULs.configuration.instance_name
|
31
|
+
system("gcloud sql instances patch #{instance_name} --project=#{project_id} --activation-policy=NEVER")
|
32
|
+
SOULs::Painter.warning("Cloud SQL #{instance_name} is stopped!")
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "restart", "Restart Cloud SQL Instance"
|
36
|
+
def restart
|
37
|
+
project_id = SOULs.configuration.project_id
|
38
|
+
instance_name = SOULs.configuration.instance_name
|
39
|
+
system("gcloud sql instances restart #{instance_name} --project=#{project_id}")
|
40
|
+
SOULs::Painter.success("Cloud SQL #{instance_name} is restarted!")
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "delete", "Delete Cloud SQL Instance"
|
44
|
+
def delete
|
45
|
+
project_id = SOULs.configuration.project_id
|
46
|
+
instance_name = SOULs.configuration.instance_name
|
47
|
+
system("gcloud sql instances delete #{instance_name} --project=#{project_id}")
|
48
|
+
SOULs::Painter.warning("Cloud SQL #{instance_name} is deleted!", "✨")
|
49
|
+
end
|
50
|
+
|
29
51
|
desc "env", "Generate .env.production file to deploy"
|
30
52
|
def env(password: "Password")
|
31
53
|
require(SOULs.get_mother_path.to_s + "/config/souls")
|
@@ -5,6 +5,8 @@ module SOULs
|
|
5
5
|
desc "release", "Release Gem"
|
6
6
|
def release
|
7
7
|
SOULs::Painter.error("hey! It's Broken!") unless system("rspec")
|
8
|
+
FileUtils.rm("apps/api/Gemfile.lock") if File.exist?("apps/api/Gemfile.lock")
|
9
|
+
FileUtils.rm("apps/worker/Gemfile.lock") if File.exist?("apps/worker/Gemfile.lock")
|
8
10
|
|
9
11
|
system("gem install souls")
|
10
12
|
sleep(3)
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.20.
|
1
|
+
1.20.2
|
@@ -1 +1 @@
|
|
1
|
-
1.20.
|
1
|
+
1.20.2
|