wco_models 3.1.0.148 → 3.1.0.150

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d659451d072adbf696dd6a317cb383990bd0d8da8460b984c38f4adc7c867ff
4
- data.tar.gz: 80b994dce92435205be381c9fb1b83f8fe889f9e7b455766cf133576a910de7e
3
+ metadata.gz: e4caf3551289f4e93e12b347077fe099d408423f006c898c6f0a52de21ba83b9
4
+ data.tar.gz: 6c791312ee20c155590aab0f4979df3f00494cc5b67e3569bdfae0d041547ff1
5
5
  SHA512:
6
- metadata.gz: c5d4f74a454d00bda9c508502dcde00fcea82ab1ff2b07bf34176780127402e1d0788eec5fa4c9ec0df897d0fb6929edc15f8c0fda7c5cbfec33397efea190fb
7
- data.tar.gz: dd976a05848a79c8fdd07820ccec5a0244892309d79cf3b1c6911f42f859d29fe76d7366168600ae1b145919335db004d60c278c17a63ec2df2252737d71e19a
6
+ metadata.gz: 88fefaaff4c84e73dce70b323bd1700d44c0bf247f0fc302e81b26029a366dfa57a79cd349d0bcce2f46dc7f85457ad900939e61dd0859f48bc09aad8e3f97ce
7
+ data.tar.gz: 3cbd9b1eff2acc6511c74f383b6f35c8c4f30725ebe0fc79e0db3263ed532e92430975a63f71715a32a8ece1fbd81203684d85b8e7bde877a5277816a660d65f
@@ -17,6 +17,9 @@ class WcoEmail::EmailFilter
17
17
  field :body_regex
18
18
  field :body_exact
19
19
 
20
+ field :skip_from_regex
21
+ field :skip_to_exact
22
+
20
23
  belongs_to :tag, class_name: 'Wco::Tag', inverse_of: :email_filters, optional: true
21
24
 
22
25
  KIND_AUTORESPOND_TMPL = 'autorespond-template'
@@ -194,7 +194,22 @@ class WcoEmail::MessageStub
194
194
 
195
195
  if reason
196
196
  puts! "Applying filter #{filter} to conv #{@message.conversation} for matching #{reason}" if DEBUG
197
- @message.apply_filter( filter )
197
+
198
+ ## skip
199
+ skip_reason = nil
200
+ if filter.skip_to_exact.present? && @message.to&.downcase.include?( filter.skip_to_exact.downcase )
201
+ skip_reason = 'skip_to_exact'
202
+ end
203
+ if filter.skip_from_regex.present? && @message.from.downcase.match( filter.skip_from_regex )
204
+ skip_reason = 'skip_from_regex'
205
+ end
206
+
207
+ if skip_reason
208
+ puts! "NOT Applying filter #{filter} to conv #{@message.conversation} for matching #{skip_reason}" if DEBUG
209
+ else
210
+ @message.apply_filter( filter )
211
+ end
212
+
198
213
  end
199
214
  end
200
215
 
@@ -16,7 +16,11 @@ class WcoHosting::Appliance
16
16
  self[:service_name] = host.gsub(".", "_")
17
17
  end
18
18
 
19
+
19
20
  belongs_to :environment, class_name: 'WcoHosting::Environment', inverse_of: :appliances, optional: true
21
+ def environment_name
22
+ environment&.name
23
+ end
20
24
 
21
25
  field :subdomain
22
26
  field :domain
@@ -34,13 +38,13 @@ class WcoHosting::Appliance
34
38
  tmpl.kind
35
39
  end
36
40
 
37
- belongs_to :serverhost, class_name: 'WcoHosting::Serverhost'
41
+ belongs_to :serverhost, class_name: 'WcoHosting::Serverhost', optional: true
38
42
 
39
43
  field :port
40
44
 
41
- STATE_PENDING = 'state-pending'
42
- STATE_LIVE = 'state-live'
43
- STATE_TERM = 'state-term'
45
+ STATE_PENDING = 'pending'
46
+ STATE_LIVE = 'live'
47
+ STATE_TERMINATED = 'terminated'
44
48
  field :state, default: STATE_PENDING
45
49
 
46
50
  def to_s
@@ -18,11 +18,31 @@ class WcoHosting::ApplianceTmpl
18
18
  end
19
19
  field :descr, type: :string
20
20
 
21
- field :image
22
- validates :image, presence: true
21
+ field :ecs_task_definition_erb, type: :string
22
+ # def ecs_task_definition
23
+ # ac = ActionController::Base.new
24
+ # ac.instance_variable_set( :@tmpl, self )
25
+ # rendered_str = ac.render_to_string("wco_hosting/scripts/nginx_site.conf")
26
+ # Wco::Log.puts! rendered_str, 'add_nginx_site rendered_str', obj: @obj
27
+
28
+ # file = Tempfile.new('prefix')
29
+ # file.write rendered_str
30
+ # file.close
31
+ # end
32
+
23
33
 
24
- field :volume_zip
25
- validates :volume_zip, presence: true
34
+ field :image
35
+ # validates :image, presence: true
36
+
37
+ field :volume_zip_url
38
+ field :volume_zip_exe
39
+ def volume_zip
40
+ if volume_zip_exe
41
+ eval( volume_zip_exe )
42
+ else
43
+ volume_zip_url
44
+ end
45
+ end
26
46
 
27
47
  ## 2023-12-08 :: These names are impossible to change already.
28
48
  KIND_CRM = 'crm'
@@ -13,6 +13,9 @@ class WcoHosting::Environment
13
13
 
14
14
  has_many :appliances, class_name: 'WcoHosting::Appliance', inverse_of: :environments
15
15
 
16
+ ## variable @env in execution environments
17
+ field :env_json, type: Object, default: '{}'
18
+
16
19
  def to_s
17
20
  name
18
21
  end
@@ -0,0 +1,26 @@
1
+
2
+ require 'net/scp'
3
+ require 'open3'
4
+ require 'droplet_kit'
5
+
6
+ class WcoHosting::Runner
7
+
8
+ def self.create_ecs_task
9
+ end
10
+
11
+ TASK_REDEPLOY_ECS_TASK_DEFINITION = 'redeploy-ecs-task-definition'
12
+ TASK_REDEPLOY_ECS_TASK = 'redeploy-ecs-task'
13
+ TASKS = []
14
+
15
+ def self.do_exec cmd
16
+ Wco::Log.puts! cmd, '#do_exec', obj: @obj
17
+
18
+ stdout, stderr, status = Open3.capture3(cmd)
19
+ status = status.to_s.split.last.to_i
20
+ Wco::Log.puts! stdout, 'stdout', obj: @obj
21
+ Wco::Log.puts! stderr, 'stderr', obj: @obj
22
+ Wco::Log.puts! status, 'status', obj: @obj
23
+ return { stdout: stdout, stderr: stderr, status: status }
24
+ end
25
+
26
+ end
@@ -0,0 +1,8 @@
1
+
2
+ class WcoHosting::Task
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+ include Mongoid::Paranoia
6
+ store_in collection: 'wco_tasks'
7
+
8
+ end
@@ -0,0 +1,11 @@
1
+
2
+ class WcoHosting::TaskTmpl
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+ include Mongoid::Paranoia
6
+ store_in collection: 'wco_task_tmpls'
7
+
8
+ field :slug
9
+ validates :slug, presence: true
10
+
11
+ end
@@ -0,0 +1,40 @@
1
+
2
+ {
3
+ "family": "demmitv_drupal",
4
+ "networkMode": "awsvpc",
5
+ "taskRoleArn": "arn:aws:iam::831556125887:role/ecs_role_1",
6
+ "executionRoleArn": "arn:aws:iam::831556125887:role/ecs_role_1",
7
+ "containerDefinitions": [
8
+ {
9
+ "name": "demmitv_drupal_ecs1",
10
+ "image": "piousbox/php81:0.0.2",
11
+ "portMappings": [
12
+ {
13
+ "containerPort": 80,
14
+ "hostPort": 80,
15
+ "protocol": "tcp"
16
+ }
17
+ ],
18
+ "logConfiguration": {
19
+ "logDriver": "awslogs",
20
+ "options": {
21
+ "awslogs-create-group": "true",
22
+ "awslogs-group": "drupal-1",
23
+ "awslogs-region": "us-east-2",
24
+ "awslogs-stream-prefix": "wco-"
25
+ }
26
+ },
27
+ "essential": true,
28
+ "entryPoint": [
29
+ "sh",
30
+ "-c"
31
+ ],
32
+ "command": [
33
+ "/bin/sh -c \"cd /var/www/html && curl -u abba:simplerpassword https://secrets.wasya.co/demmitv_drupal_ecs1.zip --output demmitv_drupal_ecs1-0.0.0.zip && unzip -o demmitv_drupal_ecs1-0.0.0.zip && cd web && apachectl -D FOREGROUND \" "
34
+ ]
35
+ }
36
+ ],
37
+ "requiresCompatibilities": [ "FARGATE" ],
38
+ "cpu": "256",
39
+ "memory": "512"
40
+ }
@@ -0,0 +1,40 @@
1
+
2
+ {
3
+ "family": "drupal",
4
+ "networkMode": "awsvpc",
5
+ "taskRoleArn": "arn:aws:iam::831556125887:role/ecs_role_1",
6
+ "executionRoleArn": "arn:aws:iam::831556125887:role/ecs_role_1",
7
+ "containerDefinitions": [
8
+ {
9
+ "name": "<%= @app.kind %>_drupal_<%= @app.environment_name %>",
10
+ "image": "piousbox/php81:0.0.2",
11
+ "portMappings": [
12
+ {
13
+ "containerPort": 80,
14
+ "hostPort": 80,
15
+ "protocol": "tcp"
16
+ }
17
+ ],
18
+ "logConfiguration": {
19
+ "logDriver": "awslogs",
20
+ "options": {
21
+ "awslogs-create-group": "true",
22
+ "awslogs-group": "drupal-1",
23
+ "awslogs-region": "us-east-2",
24
+ "awslogs-stream-prefix": "wco-"
25
+ }
26
+ },
27
+ "essential": true,
28
+ "entryPoint": [
29
+ "sh",
30
+ "-c"
31
+ ],
32
+ "command": [
33
+ "/bin/sh -c \"cd /var/www/html && curl -u abba:simplerpassword https://secrets.wasya.co/<%= @app.kind %>_drupal_<%= @app.environment_name %>-<%= @app.version %>.zip && unzip <%= @app.kind %>_drupal_<%= @app.environment_name %>-<%= @app.version %>.zip && composer install && apachectl -D FOREGROUND \" "
34
+ ]
35
+ }
36
+ ],
37
+ "requiresCompatibilities": [ "FARGATE" ],
38
+ "cpu": "256",
39
+ "memory": "512"
40
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "family": "example",
3
+ "networkMode": "awsvpc",
4
+ "taskRoleArn": "arn:aws:iam::831556125887:role/ecs_role_1",
5
+ "executionRoleArn": "arn:aws:iam::831556125887:role/ecs_role_1",
6
+ "containerDefinitions": [
7
+ {
8
+ "name": "example",
9
+ "image": "public.ecr.aws/docker/library/httpd:latest",
10
+ "portMappings": [
11
+ {
12
+ "containerPort": 80,
13
+ "hostPort": 80,
14
+ "protocol": "tcp"
15
+ }
16
+ ],
17
+ "logConfiguration": {
18
+ "logDriver": "awslogs",
19
+ "options": {
20
+ "awslogs-create-group": "true",
21
+ "awslogs-group": "awslogs-group-1",
22
+ "awslogs-region": "us-east-1",
23
+ "awslogs-stream-prefix": "wco1-"
24
+ }
25
+ },
26
+ "essential": true,
27
+ "entryPoint": [
28
+ "sh",
29
+ "-c"
30
+ ],
31
+ "command": [
32
+ "/bin/sh -c \"echo '<html> <head> <title>Amazon ECS Sample App</title> <style>body {margin-top: 40px; background-color: #333;} </style> </head><body> <div style=color:white;text-align:center> <h1>Amazon ECS Sample App</h1> <h2>Congratulations!</h2> <p>Your application is now running on a container in Amazon ECS.</p> </div></body></html>' > /usr/local/apache2/htdocs/index.html && httpd-foreground\""
33
+ ]
34
+ }
35
+ ],
36
+ "requiresCompatibilities": [
37
+ "FARGATE"
38
+ ],
39
+ "cpu": "256",
40
+ "memory": "512"
41
+ }
@@ -0,0 +1,54 @@
1
+ {
2
+ "containerDefinitions": [
3
+ {
4
+ "name": "wordpress",
5
+ "links": [
6
+ "mysql"
7
+ ],
8
+ "image": "wordpress",
9
+ "essential": true,
10
+ "portMappings": [
11
+ {
12
+ "containerPort": 80,
13
+ "hostPort": 80
14
+ }
15
+ ],
16
+ "logConfiguration": {
17
+ "logDriver": "awslogs",
18
+ "options": {
19
+ "awslogs-create-group": "true",
20
+ "awslogs-group": "awslogs-wordpress",
21
+ "awslogs-region": "us-west-2",
22
+ "awslogs-stream-prefix": "awslogs-example"
23
+ }
24
+ },
25
+ "memory": 500,
26
+ "cpu": 10
27
+ },
28
+ {
29
+ "environment": [
30
+ {
31
+ "name": "MYSQL_ROOT_PASSWORD",
32
+ "value": "password"
33
+ }
34
+ ],
35
+ "name": "mysql",
36
+ "image": "mysql",
37
+ "cpu": 10,
38
+ "memory": 500,
39
+ "essential": true,
40
+ "logConfiguration": {
41
+ "logDriver": "awslogs",
42
+ "options": {
43
+ "awslogs-create-group": "true",
44
+ "awslogs-group": "awslogs-mysql",
45
+ "awslogs-region": "us-west-2",
46
+ "awslogs-stream-prefix": "awslogs-example",
47
+ "mode": "non-blocking",
48
+ "max-buffer-size": "25m"
49
+ }
50
+ }
51
+ }
52
+ ],
53
+ "family": "awslogs-example"
54
+ }
@@ -0,0 +1,40 @@
1
+
2
+ {
3
+ "family": "helloworld",
4
+ "networkMode": "awsvpc",
5
+ "taskRoleArn": "arn:aws:iam::831556125887:role/ecs_role_1",
6
+ "executionRoleArn": "arn:aws:iam::831556125887:role/ecs_role_1",
7
+ "containerDefinitions": [
8
+ {
9
+ "name": "helloworld",
10
+ "image": "piousbox/php82:0.0.2",
11
+ "portMappings": [
12
+ {
13
+ "containerPort": 80,
14
+ "hostPort": 80,
15
+ "protocol": "tcp"
16
+ }
17
+ ],
18
+ "logConfiguration": {
19
+ "logDriver": "awslogs",
20
+ "options": {
21
+ "awslogs-create-group": "true",
22
+ "awslogs-group": "awslogs-group-1",
23
+ "awslogs-region": "us-east-1",
24
+ "awslogs-stream-prefix": "wco1-"
25
+ }
26
+ },
27
+ "essential": true,
28
+ "entryPoint": [
29
+ "sh",
30
+ "-c"
31
+ ],
32
+ "command": [
33
+ "/bin/sh -c \"cd /var/www/html && wget https://d15g8hc4183yn4.cloudfront.net/wp-content/uploads/2024/03/28014630/helloworld-0.0.1.zip && unzip helloworld-0.0.1.zip && apachectl -D FOREGROUND \" "
34
+ ]
35
+ }
36
+ ],
37
+ "requiresCompatibilities": [ "FARGATE" ],
38
+ "cpu": "256",
39
+ "memory": "512"
40
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.148
4
+ version: 3.1.0.150
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-26 00:00:00.000000000 Z
11
+ date: 2024-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -475,8 +475,11 @@ files:
475
475
  - app/models/wco_hosting/appliance_tmpl.rb
476
476
  - app/models/wco_hosting/domain.rb
477
477
  - app/models/wco_hosting/environment.rb
478
+ - app/models/wco_hosting/runner.rb
478
479
  - app/models/wco_hosting/serverhost.rb
479
480
  - app/models/wco_hosting/subdomain.rb
481
+ - app/models/wco_hosting/task.rb
482
+ - app/models/wco_hosting/task_tmpl.rb
480
483
  - app/views/layouts/wco/application.haml
481
484
  - app/views/wco/_alerts_notices.haml
482
485
  - app/views/wco/_analytics.erb
@@ -642,9 +645,15 @@ files:
642
645
  - app/views/wco_email/email_layouts/_test_tracking_footer.haml
643
646
  - app/views/wco_email/email_layouts/_wasyaco_roundborders.html.erb
644
647
  - app/views/wco_hosting/docker-compose/dc-any.erb
645
- - app/views/wco_hosting/docker-compose/dc-helloworld.erb
646
- - app/views/wco_hosting/docker-compose/dc-react.erb
647
- - app/views/wco_hosting/docker-compose/dc-wordpress.erb
648
+ - app/views/wco_hosting/docker-compose/trash/dc-helloworld.erb
649
+ - app/views/wco_hosting/docker-compose/trash/dc-react.erb
650
+ - app/views/wco_hosting/docker-compose/trash/dc-wordpress.erb
651
+ - app/views/wco_hosting/ecs_task_definitions/demmitv.json
652
+ - app/views/wco_hosting/ecs_task_definitions/demmitv_drupal_ecs1-0.0.0.zip
653
+ - app/views/wco_hosting/ecs_task_definitions/drupal.json-template
654
+ - app/views/wco_hosting/ecs_task_definitions/example1.json
655
+ - app/views/wco_hosting/ecs_task_definitions/example2.txt-trash
656
+ - app/views/wco_hosting/ecs_task_definitions/hw1.json
648
657
  - app/views/wco_hosting/scripts/create_volume.erb
649
658
  - app/views/wco_hosting/scripts/nginx_site.conf.erb
650
659
  - config/initializers/assets.rb