wco_models 3.1.0.148 → 3.1.0.149

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: 4ee4313ebc6b594dd44a3b5393ccf9495fb2e475c42c5677e1bf285361b81f89
4
+ data.tar.gz: f6cf48e41de6a37250064ffff72f78db0e9d142651d54aefafbcff18dcd0bc53
5
5
  SHA512:
6
- metadata.gz: c5d4f74a454d00bda9c508502dcde00fcea82ab1ff2b07bf34176780127402e1d0788eec5fa4c9ec0df897d0fb6929edc15f8c0fda7c5cbfec33397efea190fb
7
- data.tar.gz: dd976a05848a79c8fdd07820ccec5a0244892309d79cf3b1c6911f42f859d29fe76d7366168600ae1b145919335db004d60c278c17a63ec2df2252737d71e19a
6
+ metadata.gz: c962c417116006e454cf1a3001027592af407c37f8368189db155678f2bdc3ef588eeb7fe4af9c140a760299d22a2080132b0db441a08446e6839a43aa749ceb
7
+ data.tar.gz: 5ae5fff70b299b0b8cee57b8c16997580a8a98989dba824a2129629ec18a10b59e3bd67c265bc6ad5174edccdc1811bde790068f3f2b015d8f44fb67b67fd6b7
@@ -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.149
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