uffizzi_core 0.1.12 → 0.1.13
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 +0 -6
- data/app/controllers/uffizzi_core/api/cli/v1/account/credentials_controller.rb +3 -3
- data/app/controllers/uffizzi_core/api/cli/v1/projects_controller.rb +2 -68
- data/app/forms/uffizzi_core/api/cli/v1/deployment/create_form.rb +0 -1
- data/app/lib/uffizzi_core/rbac/user_access_service.rb +0 -24
- data/app/models/uffizzi_core/project.rb +2 -9
- data/app/policies/uffizzi_core/api/cli/v1/projects_policy.rb +0 -12
- data/app/serializers/uffizzi_core/api/cli/v1/project_serializer.rb +1 -24
- data/app/serializers/uffizzi_core/api/cli/v1/projects/deployment_serializer/container_serializer.rb +1 -2
- data/app/serializers/uffizzi_core/api/cli/v1/projects/deployments/container_serializer.rb +1 -1
- data/app/serializers/uffizzi_core/controller/deploy_containers/container_serializer.rb +1 -16
- data/app/services/uffizzi_core/compose_file/builders/container_builder_service.rb +7 -11
- data/app/services/uffizzi_core/compose_file/services_options_service.rb +0 -2
- data/app/services/uffizzi_core/compose_file/template_service.rb +4 -4
- data/app/services/uffizzi_core/deployment_service.rb +2 -3
- data/app/services/uffizzi_core/manage_activity_items_service.rb +1 -1
- data/app/services/uffizzi_core/project_service.rb +0 -10
- data/app/services/uffizzi_core/user_generator_service.rb +5 -11
- data/config/locales/en.yml +0 -1
- data/config/routes.rb +1 -11
- data/lib/tasks/uffizzi_core_tasks.rake +1 -1
- data/lib/uffizzi_core/version.rb +1 -1
- data/swagger/v1/swagger.json +2 -174
- metadata +1 -8
- data/app/forms/uffizzi_core/api/cli/v1/project/create_form.rb +0 -7
- data/app/serializers/uffizzi_core/api/cli/v1/project_serializer/compose_file_serializer.rb +0 -7
- data/app/serializers/uffizzi_core/api/cli/v1/project_serializer/deployment_serializer.rb +0 -13
- data/app/serializers/uffizzi_core/api/cli/v1/short_project_serializer.rb +0 -7
- data/app/services/uffizzi_core/compose_file/parsers/services/healthcheck_parser_service.rb +0 -73
- data/app/services/uffizzi_core/starter_template_service.rb +0 -200
- data/db/migrate/20220419074956_add_health_check_to_containers.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d892c859a5a90f309d59a2fd110e3e99719d62f566cda4f7cb1f0815c700f4e
|
4
|
+
data.tar.gz: df8bed87726cc99d3401b129245a8bc0467d087550d3258f66f08c482f897f7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc59d9a62a34892c5c50eb0b622e7a5e46ecd0e0cdbd826ea72fd0b27c88dc35ddd7c686b3b46b1aa16c2544374f5f96ca4588d41afb39433b8759fabba8484e
|
7
|
+
data.tar.gz: 070f387c4d12a5d662c392dfa715dd536d8100aa06978c072dbaee04bec52dd9aa126b396903610dbfc187dbac5542d7c7332d1b5a7df784210b21c1a31cea20
|
data/README.md
CHANGED
@@ -15,6 +15,7 @@ class UffizziCore::Api::Cli::V1::Account::CredentialsController < UffizziCore::A
|
|
15
15
|
render json: { credentials: credentials }, status: :ok
|
16
16
|
end
|
17
17
|
|
18
|
+
# rubocop:disable Layout/LineLength
|
18
19
|
# Create account credential
|
19
20
|
#
|
20
21
|
# @path [POST] /api/cli/v1/account/credentials
|
@@ -24,9 +25,8 @@ class UffizziCore::Api::Cli::V1::Account::CredentialsController < UffizziCore::A
|
|
24
25
|
# @response [object<errors>] 422 Unprocessable entity
|
25
26
|
#
|
26
27
|
# @example
|
27
|
-
# type can be one of UffizziCore::Credential::Amazon, UffizziCore::Credential::Azure,
|
28
|
-
#
|
29
|
-
|
28
|
+
# type can be one of UffizziCore::Credential::Amazon, UffizziCore::Credential::Azure, UffizziCore::Credential::DockerHub, UffizziCore::Credential::Google, UffizziCore::Credential::GithubContainerRegistry
|
29
|
+
# rubocop:enable Layout/LineLength
|
30
30
|
def create
|
31
31
|
credential_form = UffizziCore::Api::Cli::V1::Account::Credential::CreateForm.new
|
32
32
|
credential_form.assign_attributes(credential_params)
|
@@ -9,77 +9,11 @@ class UffizziCore::Api::Cli::V1::ProjectsController < UffizziCore::Api::Cli::V1:
|
|
9
9
|
#
|
10
10
|
# @path [GET] /api/cli/v1/projects
|
11
11
|
#
|
12
|
-
# @response [object<projects: Array<object<slug: string
|
12
|
+
# @response [object<projects: Array<object<slug: string>> >] 200 OK
|
13
13
|
# @response 401 Not authorized
|
14
14
|
def index
|
15
15
|
projects = current_user.projects.active.order(updated_at: :desc)
|
16
16
|
|
17
|
-
respond_with projects
|
18
|
-
end
|
19
|
-
|
20
|
-
# Get a project by slug
|
21
|
-
#
|
22
|
-
# @path [GET] /api/cli/v1/projects/{slug}
|
23
|
-
#
|
24
|
-
# @response <object< project: Project>> 200 OK
|
25
|
-
# @response 404 Not Found
|
26
|
-
# @response 401 Not authorized
|
27
|
-
def show
|
28
|
-
project = current_user.projects.find_by!(slug: params[:slug])
|
29
|
-
|
30
|
-
respond_with project
|
31
|
-
end
|
32
|
-
|
33
|
-
# Create a project
|
34
|
-
#
|
35
|
-
# @path [POST] /api/cli/v1/projects
|
36
|
-
# @parameter params(required,body) [object<name: string, slug: string, description: string>]
|
37
|
-
#
|
38
|
-
# @response <object< project: Project>> 200 OK
|
39
|
-
# @response 404 Not Found
|
40
|
-
# @response 401 Not authorized
|
41
|
-
# @response [object<errors: object<password: string >>] 422 Unprocessable entity
|
42
|
-
|
43
|
-
def create
|
44
|
-
project_form = UffizziCore::Api::Cli::V1::Project::CreateForm.new(project_params)
|
45
|
-
project_form.account = current_user.organizational_account
|
46
|
-
|
47
|
-
if project_form.save
|
48
|
-
current_membership = current_user.memberships.find_by(account: current_user.organizational_account)
|
49
|
-
user_projects = []
|
50
|
-
|
51
|
-
if current_membership.developer?
|
52
|
-
user_projects << { project: project_form, user: current_user, role: UffizziCore::UserProject.role.developer }
|
53
|
-
end
|
54
|
-
|
55
|
-
current_user.organizational_account.memberships.where(role: UffizziCore::Membership.role.admin).map do |membership|
|
56
|
-
user_projects << { project: project_form, user: membership.user, role: UffizziCore::UserProject.role.admin }
|
57
|
-
end
|
58
|
-
|
59
|
-
UffizziCore::UserProject.create!(user_projects)
|
60
|
-
end
|
61
|
-
|
62
|
-
respond_with project_form
|
63
|
-
end
|
64
|
-
|
65
|
-
# Delete a project
|
66
|
-
#
|
67
|
-
# @path [DELETE] /api/cli/v1/projects/{slug}
|
68
|
-
#
|
69
|
-
# @response 204 No content
|
70
|
-
# @response 404 Not Found
|
71
|
-
# @response 401 Not authorized
|
72
|
-
|
73
|
-
def destroy
|
74
|
-
project = current_user.organizational_account.active_projects.find_by!(slug: params[:slug])
|
75
|
-
project.disable!
|
76
|
-
|
77
|
-
head :no_content
|
78
|
-
end
|
79
|
-
|
80
|
-
private
|
81
|
-
|
82
|
-
def project_params
|
83
|
-
params.require(:project)
|
17
|
+
respond_with projects
|
84
18
|
end
|
85
19
|
end
|
@@ -16,7 +16,6 @@ class UffizziCore::Api::Cli::V1::Deployment::CreateForm < UffizziCore::Deploymen
|
|
16
16
|
:command,
|
17
17
|
:receive_incoming_requests,
|
18
18
|
:continuously_deploy,
|
19
|
-
{ healthcheck: {} },
|
20
19
|
{ variables: [:name, :value],
|
21
20
|
secret_variables: [:name, :value],
|
22
21
|
repo_attributes: [
|
@@ -6,34 +6,10 @@ module UffizziCore::Rbac::UserAccessService
|
|
6
6
|
true
|
7
7
|
end
|
8
8
|
|
9
|
-
def developer_access_to_account?(_user, _account)
|
10
|
-
true
|
11
|
-
end
|
12
|
-
|
13
|
-
def viewer_access_to_account?(_user, _account)
|
14
|
-
true
|
15
|
-
end
|
16
|
-
|
17
|
-
def admin_or_developer_access_to_account?(_user, _account)
|
18
|
-
true
|
19
|
-
end
|
20
|
-
|
21
9
|
def any_access_to_account?(_user, _account)
|
22
10
|
true
|
23
11
|
end
|
24
12
|
|
25
|
-
def admin_access_to_project?(_user, _project)
|
26
|
-
true
|
27
|
-
end
|
28
|
-
|
29
|
-
def developer_access_to_project?(_user, _project)
|
30
|
-
true
|
31
|
-
end
|
32
|
-
|
33
|
-
def viewer_access_to_project?(_user, _project)
|
34
|
-
true
|
35
|
-
end
|
36
|
-
|
37
13
|
def admin_or_developer_access_to_project?(_user, _project)
|
38
14
|
true
|
39
15
|
end
|
@@ -1,13 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# @model
|
3
|
+
# @model
|
4
4
|
# @property slug [string]
|
5
|
-
# @property name [string]
|
6
|
-
# @property description [string]
|
7
|
-
# @property created_at [date-time]
|
8
|
-
# @property secrets [string]
|
9
|
-
# @property default_compose [object<source: string>]
|
10
|
-
# @property deployments [object<id: integer, domain: string>]
|
11
5
|
|
12
6
|
class UffizziCore::Project < UffizziCore::ApplicationRecord
|
13
7
|
include AASM
|
@@ -29,8 +23,7 @@ class UffizziCore::Project < UffizziCore::ApplicationRecord
|
|
29
23
|
has_many :compose_files, dependent: :destroy
|
30
24
|
has_many :secrets, dependent: :destroy, as: :resource
|
31
25
|
|
32
|
-
validates :name, presence: true, uniqueness: { scope: :account
|
33
|
-
validates :slug, presence: true, uniqueness: { message: 'Project slug already taken' }
|
26
|
+
validates :name, presence: true, uniqueness: { scope: :account }
|
34
27
|
|
35
28
|
aasm(:state) do
|
36
29
|
state :active, initial: true
|
@@ -4,16 +4,4 @@ class UffizziCore::Api::Cli::V1::ProjectsPolicy < UffizziCore::ApplicationPolicy
|
|
4
4
|
def index?
|
5
5
|
context.user_access_module.any_access_to_account?(context.user, context.account)
|
6
6
|
end
|
7
|
-
|
8
|
-
def show?
|
9
|
-
context.user_access_module.any_access_to_account?(context.user, context.account)
|
10
|
-
end
|
11
|
-
|
12
|
-
def create?
|
13
|
-
context.user_access_module.admin_or_developer_access_to_account?(context.user, context.account)
|
14
|
-
end
|
15
|
-
|
16
|
-
def destroy?
|
17
|
-
context.user_access_module.admin_or_developer_access_to_account?(context.user, context.account)
|
18
|
-
end
|
19
7
|
end
|
@@ -2,29 +2,6 @@
|
|
2
2
|
|
3
3
|
class UffizziCore::Api::Cli::V1::ProjectSerializer < UffizziCore::BaseSerializer
|
4
4
|
type :project
|
5
|
-
has_many :deployments
|
6
|
-
has_many :secrets
|
7
|
-
has_one :default_compose
|
8
5
|
|
9
|
-
attributes :
|
10
|
-
:slug,
|
11
|
-
:description,
|
12
|
-
:created_at
|
13
|
-
|
14
|
-
def default_compose
|
15
|
-
object.compose_files.main.first
|
16
|
-
end
|
17
|
-
|
18
|
-
def deployments
|
19
|
-
object.deployments.active.map do |deployment|
|
20
|
-
deployment.state = UffizziCore::DeploymentService.failed?(deployment) ? 'failed' : 'active'
|
21
|
-
deployment
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def secrets
|
26
|
-
return [] unless object.secrets
|
27
|
-
|
28
|
-
object.secrets.map(&:name)
|
29
|
-
end
|
6
|
+
attributes :slug
|
30
7
|
end
|
data/app/serializers/uffizzi_core/api/cli/v1/projects/deployment_serializer/container_serializer.rb
CHANGED
@@ -19,8 +19,7 @@ class UffizziCore::Api::Cli::V1::Projects::DeploymentSerializer::ContainerSerial
|
|
19
19
|
:public,
|
20
20
|
:repo_id,
|
21
21
|
:continuously_deploy,
|
22
|
-
:receive_incoming_requests
|
23
|
-
:healthcheck
|
22
|
+
:receive_incoming_requests
|
24
23
|
|
25
24
|
def secret_variables
|
26
25
|
return unless object.secret_variables.present?
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class UffizziCore::Api::Cli::V1::Projects::Deployments::ContainerSerializer < UffizziCore::BaseSerializer
|
4
|
-
attributes :id, :name, :memory_limit, :memory_request, :continuously_deploy, :variables, :secret_variables
|
4
|
+
attributes :id, :name, :memory_limit, :memory_request, :continuously_deploy, :variables, :secret_variables
|
5
5
|
|
6
6
|
has_many :container_config_files
|
7
7
|
|
@@ -15,8 +15,7 @@ class UffizziCore::Controller::DeployContainers::ContainerSerializer < UffizziCo
|
|
15
15
|
:target_port,
|
16
16
|
:public,
|
17
17
|
:controller_name,
|
18
|
-
:receive_incoming_requests
|
19
|
-
:healthcheck
|
18
|
+
:receive_incoming_requests
|
20
19
|
|
21
20
|
has_many :container_config_files
|
22
21
|
|
@@ -53,18 +52,4 @@ class UffizziCore::Controller::DeployContainers::ContainerSerializer < UffizziCo
|
|
53
52
|
def command
|
54
53
|
object.command.blank? ? nil : JSON.parse(object.command)
|
55
54
|
end
|
56
|
-
|
57
|
-
def healthcheck
|
58
|
-
return {} if object.healthcheck.nil?
|
59
|
-
|
60
|
-
command = object.healthcheck['test']
|
61
|
-
new_command = if command.is_a?(Array)
|
62
|
-
items_to_remove = ['CMD', 'CMD-SHELL']
|
63
|
-
command.select { |item| items_to_remove.exclude?(item) }
|
64
|
-
elsif object.healthcheck['test'].is_a?(String)
|
65
|
-
command.split
|
66
|
-
end
|
67
|
-
|
68
|
-
object.healthcheck.merge(test: new_command)
|
69
|
-
end
|
70
55
|
end
|
@@ -17,14 +17,18 @@ class UffizziCore::ComposeFile::Builders::ContainerBuilderService
|
|
17
17
|
configs_data = container_data[:configs] || []
|
18
18
|
secrets = container_data[:secrets] || []
|
19
19
|
container_name = container_data[:container_name]
|
20
|
-
|
20
|
+
continuous_preview_container_data = container_data[:'x-uffizzi-continuous-preview'] || container_data[:'x-uffizzi-continuous-previews']
|
21
21
|
|
22
22
|
env_file_dependencies = UffizziCore::ComposeFile::GithubDependenciesService.env_file_dependencies_for_container(compose_dependencies,
|
23
23
|
container_name)
|
24
24
|
configs_dependencies = UffizziCore::ComposeFile::GithubDependenciesService.configs_dependencies_for_container(compose_dependencies,
|
25
25
|
container_name)
|
26
|
+
|
26
27
|
is_ingress = ingress_container?(container_name, ingress_data)
|
27
|
-
repo_attributes =
|
28
|
+
repo_attributes = build_repo_attributes(container_data, image_data, build_data, credentials)
|
29
|
+
|
30
|
+
repo_attributes = set_continuous_preview_attributes_to_repo(repo_attributes, continuous_preview_global_data.to_h,
|
31
|
+
continuous_preview_container_data.to_h)
|
28
32
|
|
29
33
|
{
|
30
34
|
tag: tag(image_data, repo_attributes),
|
@@ -47,13 +51,6 @@ class UffizziCore::ComposeFile::Builders::ContainerBuilderService
|
|
47
51
|
|
48
52
|
private
|
49
53
|
|
50
|
-
def repo_attributes(container_data, continuous_preview_global_data)
|
51
|
-
repo_attributes = build_repo_attributes(container_data)
|
52
|
-
continuous_preview_container_data = container_data[:'x-uffizzi-continuous-preview'] || container_data[:'x-uffizzi-continuous-previews']
|
53
|
-
|
54
|
-
set_continuous_preview_attributes_to_repo(repo_attributes, continuous_preview_global_data.to_h, continuous_preview_container_data.to_h)
|
55
|
-
end
|
56
|
-
|
57
54
|
def set_continuous_preview_attributes_to_repo(repo_attributes, global_data, container_data)
|
58
55
|
condition_attributes = [
|
59
56
|
:deploy_preview_when_pull_request_is_opened,
|
@@ -151,9 +148,8 @@ class UffizziCore::ComposeFile::Builders::ContainerBuilderService
|
|
151
148
|
memory_value
|
152
149
|
end
|
153
150
|
|
154
|
-
def build_repo_attributes(container_data)
|
151
|
+
def build_repo_attributes(container_data, image_data, _build_data, credentials)
|
155
152
|
repo_type = repo_type(container_data)
|
156
|
-
image_data = container_data[:image]
|
157
153
|
|
158
154
|
case repo_type
|
159
155
|
when UffizziCore::Repo::DockerHub.name
|
@@ -42,8 +42,6 @@ class UffizziCore::ComposeFile::ServicesOptionsService
|
|
42
42
|
UffizziCore::ComposeFile::ServicesOptions::EntrypointService.parse(value)
|
43
43
|
when :command
|
44
44
|
UffizziCore::ComposeFile::ServicesOptions::CommandService.parse(value)
|
45
|
-
when :healthcheck
|
46
|
-
UffizziCore::ComposeFile::Parsers::Services::HealthcheckParserService.parse(value)
|
47
45
|
when :'x-uffizzi-continuous-preview', :'x-uffizzi-continuous-previews'
|
48
46
|
UffizziCore::ComposeFile::ContinuousPreviewOptionsService.parse(value)
|
49
47
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class UffizziCore::ComposeFile::TemplateService
|
4
|
-
def initialize(
|
4
|
+
def initialize(github_form, project, user)
|
5
5
|
@project = project
|
6
6
|
@user = user
|
7
|
-
@compose_dependencies =
|
8
|
-
@compose_data =
|
9
|
-
@compose_repositories =
|
7
|
+
@compose_dependencies = github_form.compose_dependencies
|
8
|
+
@compose_data = github_form.compose_data
|
9
|
+
@compose_repositories = github_form.compose_repositories
|
10
10
|
end
|
11
11
|
|
12
12
|
def create_template(compose_file_form)
|
@@ -8,12 +8,12 @@ module UffizziCore::DeploymentService
|
|
8
8
|
building: :building,
|
9
9
|
deploying: :deploying,
|
10
10
|
failed: :failed,
|
11
|
-
queued: :queued,
|
12
11
|
}.freeze
|
13
12
|
|
14
13
|
class << self
|
15
14
|
def create_from_compose(compose_file, project, user)
|
16
15
|
deployment_attributes = ActionController::Parameters.new(compose_file.template.payload)
|
16
|
+
|
17
17
|
deployment_form = UffizziCore::Api::Cli::V1::Deployment::CreateForm.new(deployment_attributes)
|
18
18
|
deployment_form.assign_dependences!(project, user)
|
19
19
|
deployment_form.compose_file = compose_file
|
@@ -242,11 +242,10 @@ module UffizziCore::DeploymentService
|
|
242
242
|
|
243
243
|
def deployment_process_status(deployment)
|
244
244
|
containers = deployment.active_containers
|
245
|
-
activity_items = containers.map { |container| container.activity_items.order_by_id.last }
|
245
|
+
activity_items = containers.map { |container| container.activity_items.order_by_id.last }
|
246
246
|
events = activity_items.map { |activity_item| activity_item.events.order_by_id.last&.state }
|
247
247
|
events = events.flatten.uniq
|
248
248
|
|
249
|
-
return DEPLOYMENT_PROCESS_STATUSES[:queued] if containers.present? && events.empty?
|
250
249
|
return DEPLOYMENT_PROCESS_STATUSES[:failed] if events.include?(UffizziCore::Event.state.failed)
|
251
250
|
return DEPLOYMENT_PROCESS_STATUSES[:building] if events.include?(UffizziCore::Event.state.building)
|
252
251
|
|
@@ -118,7 +118,7 @@ class UffizziCore::ManageActivityItemsService
|
|
118
118
|
|
119
119
|
Rails.logger.info("manage_activity_items get_status dep_id=#{container.deployment.id} pod_container_status: #{pod_container_status}")
|
120
120
|
Rails.logger.info("manage_activity_items get_status dep_id=#{container.deployment.id} state: #{state}")
|
121
|
-
ap
|
121
|
+
ap pod_container[:state]
|
122
122
|
|
123
123
|
case pod_container_status.to_sym
|
124
124
|
when :running
|
@@ -34,15 +34,5 @@ module UffizziCore::ProjectService
|
|
34
34
|
|
35
35
|
UffizziCore::ComposeFile::ErrorsService.update_compose_errors!(compose_file, new_errors, compose_file.content)
|
36
36
|
end
|
37
|
-
|
38
|
-
def add_users_to_project!(project, current_user)
|
39
|
-
user_projects = []
|
40
|
-
|
41
|
-
current_user.organizational_account.memberships.where(role: UffizziCore::Membership.role.admin).map do |membership|
|
42
|
-
user_projects << { project: project, user: membership.user, role: UffizziCore::UserProject.role.admin }
|
43
|
-
end
|
44
|
-
|
45
|
-
UffizziCore::UserProject.create!(user_projects)
|
46
|
-
end
|
47
37
|
end
|
48
38
|
end
|
@@ -6,12 +6,6 @@ class UffizziCore::UserGeneratorService
|
|
6
6
|
DEFAULT_ACCOUNT_NAME = 'default'
|
7
7
|
|
8
8
|
class << self
|
9
|
-
def safe_generate(email, password, project_name)
|
10
|
-
generate(email, password, project_name)
|
11
|
-
rescue StandardError => e
|
12
|
-
puts e.message
|
13
|
-
end
|
14
|
-
|
15
9
|
def generate(email, password, project_name)
|
16
10
|
user_attributes = build_user_attributes(email, password)
|
17
11
|
project_attributes = build_project_attributes(project_name)
|
@@ -37,17 +31,19 @@ class UffizziCore::UserGeneratorService
|
|
37
31
|
|
38
32
|
if email.present?
|
39
33
|
user_attributes[:email] = email
|
40
|
-
|
34
|
+
else
|
41
35
|
IO::console.write("Enter User Email (default: #{DEFAULT_USER_EMAIL}): ")
|
42
36
|
user_attributes[:email] = IO::console.gets.strip.presence || DEFAULT_USER_EMAIL
|
43
37
|
end
|
44
38
|
|
45
39
|
user_attributes[:password] = if password.present?
|
46
40
|
password
|
47
|
-
|
41
|
+
else
|
48
42
|
IO::console.getpass('Enter Password: ')
|
49
43
|
end
|
50
44
|
|
45
|
+
abort('password can\'t be blank') if user_attributes[:password].blank?
|
46
|
+
|
51
47
|
user_attributes
|
52
48
|
end
|
53
49
|
|
@@ -57,11 +53,9 @@ class UffizziCore::UserGeneratorService
|
|
57
53
|
}
|
58
54
|
if project_name.present?
|
59
55
|
project_attributes[:name] = project_name
|
60
|
-
|
56
|
+
else
|
61
57
|
IO::console.write("Enter Project Name (default: #{DEFAULT_PROJECT_NAME}): ")
|
62
58
|
project_attributes[:name] = IO::console.gets.strip.presence || DEFAULT_PROJECT_NAME
|
63
|
-
else
|
64
|
-
project_attributes[:name] = DEFAULT_PROJECT_NAME
|
65
59
|
end
|
66
60
|
|
67
61
|
project_attributes[:slug] = prepare_project_slug(project_attributes[:name])
|
data/config/locales/en.yml
CHANGED
@@ -57,7 +57,6 @@ en:
|
|
57
57
|
continuous_preview_in_service_level: The option '%{option}' is not supported for service-level. Use 'x-uffizzi-continuous-preview' instead
|
58
58
|
file_already_exists: A compose file already exists for this project. Run 'uffizzi compose update' to update this file or 'uffizzi compose rm' to remove it. For more options, see 'uffizzi compose --help'
|
59
59
|
invalid_healthcheck_command: "Service '%{name}' defines an invalid healthcheck: when 'test' is a list the first item must be either NONE, CMD or CMD-SHELL"
|
60
|
-
invalid_time_interval: The time interval should be in the following format '{hours}h{minutes}m{seconds}s'. At least one value must be present.
|
61
60
|
string_or_array_error: "'%{option}' contains an invalid type, it should be a string, or an array"
|
62
61
|
not_implemented: "'%{option}' option is not implemented"
|
63
62
|
infinite_recursion: "Found infinite recursion for key '%{key}'"
|
data/config/routes.rb
CHANGED
@@ -15,23 +15,13 @@ UffizziCore::Engine.routes.draw do
|
|
15
15
|
post :google
|
16
16
|
end
|
17
17
|
|
18
|
-
resources :projects, only: ['index'
|
18
|
+
resources :projects, only: ['index'], param: :slug do
|
19
19
|
scope module: :projects do
|
20
20
|
resource :compose_file, only: ['show', 'create', 'destroy']
|
21
21
|
resources :deployments, only: ['index', 'show', 'create', 'destroy', 'update'] do
|
22
22
|
post :deploy_containers, on: :member
|
23
23
|
scope module: :deployments do
|
24
24
|
resources :activity_items, only: ['index']
|
25
|
-
resources :containers, only: ['index'], param: :name do
|
26
|
-
scope module: :containers do
|
27
|
-
resources :logs, only: ['index']
|
28
|
-
resources :builds, only: [] do
|
29
|
-
collection do
|
30
|
-
get :logs
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
25
|
resources :events, only: ['index']
|
36
26
|
resources :containers, only: ['index'], param: :name do
|
37
27
|
scope module: :containers do
|
@@ -14,6 +14,6 @@ namespace :uffizzi_core do
|
|
14
14
|
|
15
15
|
desc 'Create a new user'
|
16
16
|
task create_user: :environment do
|
17
|
-
UffizziCore::UserGeneratorService.
|
17
|
+
UffizziCore::UserGeneratorService.generate(ENV['UFFIZZI_USER_EMAIL'], ENV['UFFIZZI_USER_PASSWORD'], ENV['UFFIZZI_PROJECT_NAME'])
|
18
18
|
end
|
19
19
|
end
|
data/lib/uffizzi_core/version.rb
CHANGED
data/swagger/v1/swagger.json
CHANGED
@@ -80,7 +80,7 @@
|
|
80
80
|
"default": {
|
81
81
|
"description": "Create account credential",
|
82
82
|
"examples": {
|
83
|
-
"application/json": "type can be one of UffizziCore::Credential::Amazon, UffizziCore::Credential::Azure
|
83
|
+
"application/json": "type can be one of UffizziCore::Credential::Amazon, UffizziCore::Credential::Azure, UffizziCore::Credential::DockerHub, UffizziCore::Credential::Google, UffizziCore::Credential::GithubContainerRegistry"
|
84
84
|
}
|
85
85
|
},
|
86
86
|
"201": {
|
@@ -1134,9 +1134,6 @@
|
|
1134
1134
|
"properties": {
|
1135
1135
|
"slug": {
|
1136
1136
|
"type": "string"
|
1137
|
-
},
|
1138
|
-
"name": {
|
1139
|
-
"type": "string"
|
1140
1137
|
}
|
1141
1138
|
}
|
1142
1139
|
}
|
@@ -1152,143 +1149,6 @@
|
|
1152
1149
|
"summary": "Get projects of current user",
|
1153
1150
|
"x-controller": "uffizzi_core/api/cli/v1/projects",
|
1154
1151
|
"x-action": "index"
|
1155
|
-
},
|
1156
|
-
"post": {
|
1157
|
-
"tags": [
|
1158
|
-
"Project"
|
1159
|
-
],
|
1160
|
-
"operationId": "Project-create",
|
1161
|
-
"parameters": [
|
1162
|
-
{
|
1163
|
-
"name": "params",
|
1164
|
-
"description": "params",
|
1165
|
-
"required": true,
|
1166
|
-
"in": "body",
|
1167
|
-
"schema": {
|
1168
|
-
"type": "object",
|
1169
|
-
"properties": {
|
1170
|
-
"name": {
|
1171
|
-
"type": "string"
|
1172
|
-
},
|
1173
|
-
"slug": {
|
1174
|
-
"type": "string"
|
1175
|
-
},
|
1176
|
-
"description": {
|
1177
|
-
"type": "string"
|
1178
|
-
}
|
1179
|
-
}
|
1180
|
-
}
|
1181
|
-
}
|
1182
|
-
],
|
1183
|
-
"responses": {
|
1184
|
-
"200": {
|
1185
|
-
"description": "OK",
|
1186
|
-
"schema": {
|
1187
|
-
"type": "object",
|
1188
|
-
"properties": {
|
1189
|
-
"project": {
|
1190
|
-
"$ref": "#/definitions/Project"
|
1191
|
-
}
|
1192
|
-
}
|
1193
|
-
}
|
1194
|
-
},
|
1195
|
-
"404": {
|
1196
|
-
"description": "Not Found"
|
1197
|
-
},
|
1198
|
-
"401": {
|
1199
|
-
"description": "Not authorized"
|
1200
|
-
},
|
1201
|
-
"422": {
|
1202
|
-
"description": "Unprocessable entity",
|
1203
|
-
"schema": {
|
1204
|
-
"type": "object",
|
1205
|
-
"properties": {
|
1206
|
-
"errors": {
|
1207
|
-
"type": "object",
|
1208
|
-
"properties": {
|
1209
|
-
"password": {
|
1210
|
-
"type": "string"
|
1211
|
-
}
|
1212
|
-
}
|
1213
|
-
}
|
1214
|
-
}
|
1215
|
-
}
|
1216
|
-
}
|
1217
|
-
},
|
1218
|
-
"description": "Create a project",
|
1219
|
-
"summary": "Create a project",
|
1220
|
-
"x-controller": "uffizzi_core/api/cli/v1/projects",
|
1221
|
-
"x-action": "create"
|
1222
|
-
}
|
1223
|
-
},
|
1224
|
-
"/api/cli/v1/projects/{slug}": {
|
1225
|
-
"get": {
|
1226
|
-
"tags": [
|
1227
|
-
"Project"
|
1228
|
-
],
|
1229
|
-
"operationId": "Project-show",
|
1230
|
-
"parameters": [
|
1231
|
-
{
|
1232
|
-
"name": "slug",
|
1233
|
-
"description": "Scope response to slug",
|
1234
|
-
"required": true,
|
1235
|
-
"in": "path",
|
1236
|
-
"type": "string"
|
1237
|
-
}
|
1238
|
-
],
|
1239
|
-
"responses": {
|
1240
|
-
"200": {
|
1241
|
-
"description": "OK",
|
1242
|
-
"schema": {
|
1243
|
-
"type": "object",
|
1244
|
-
"properties": {
|
1245
|
-
"project": {
|
1246
|
-
"$ref": "#/definitions/Project"
|
1247
|
-
}
|
1248
|
-
}
|
1249
|
-
}
|
1250
|
-
},
|
1251
|
-
"404": {
|
1252
|
-
"description": "Not Found"
|
1253
|
-
},
|
1254
|
-
"401": {
|
1255
|
-
"description": "Not authorized"
|
1256
|
-
}
|
1257
|
-
},
|
1258
|
-
"description": "Get a project by slug",
|
1259
|
-
"summary": "Get a project by slug",
|
1260
|
-
"x-controller": "uffizzi_core/api/cli/v1/projects",
|
1261
|
-
"x-action": "show"
|
1262
|
-
},
|
1263
|
-
"delete": {
|
1264
|
-
"tags": [
|
1265
|
-
"Project"
|
1266
|
-
],
|
1267
|
-
"operationId": "Project-destroy",
|
1268
|
-
"parameters": [
|
1269
|
-
{
|
1270
|
-
"name": "slug",
|
1271
|
-
"description": "Scope response to slug",
|
1272
|
-
"required": true,
|
1273
|
-
"in": "path",
|
1274
|
-
"type": "string"
|
1275
|
-
}
|
1276
|
-
],
|
1277
|
-
"responses": {
|
1278
|
-
"204": {
|
1279
|
-
"description": "No content"
|
1280
|
-
},
|
1281
|
-
"404": {
|
1282
|
-
"description": "Not Found"
|
1283
|
-
},
|
1284
|
-
"401": {
|
1285
|
-
"description": "Not authorized"
|
1286
|
-
}
|
1287
|
-
},
|
1288
|
-
"description": "Delete a project",
|
1289
|
-
"summary": "Delete a project",
|
1290
|
-
"x-controller": "uffizzi_core/api/cli/v1/projects",
|
1291
|
-
"x-action": "destroy"
|
1292
1152
|
}
|
1293
1153
|
},
|
1294
1154
|
"/api/cli/v1/session": {
|
@@ -1615,43 +1475,11 @@
|
|
1615
1475
|
}
|
1616
1476
|
}
|
1617
1477
|
},
|
1618
|
-
"
|
1478
|
+
"UffizziCore_Project": {
|
1619
1479
|
"type": "object",
|
1620
1480
|
"properties": {
|
1621
1481
|
"slug": {
|
1622
1482
|
"type": "string"
|
1623
|
-
},
|
1624
|
-
"name": {
|
1625
|
-
"type": "string"
|
1626
|
-
},
|
1627
|
-
"description": {
|
1628
|
-
"type": "string"
|
1629
|
-
},
|
1630
|
-
"created_at": {
|
1631
|
-
"type": "string",
|
1632
|
-
"format": "date-time"
|
1633
|
-
},
|
1634
|
-
"secrets": {
|
1635
|
-
"type": "string"
|
1636
|
-
},
|
1637
|
-
"default_compose": {
|
1638
|
-
"type": "object",
|
1639
|
-
"properties": {
|
1640
|
-
"source": {
|
1641
|
-
"type": "string"
|
1642
|
-
}
|
1643
|
-
}
|
1644
|
-
},
|
1645
|
-
"deployments": {
|
1646
|
-
"type": "object",
|
1647
|
-
"properties": {
|
1648
|
-
"id": {
|
1649
|
-
"type": "integer"
|
1650
|
-
},
|
1651
|
-
"domain": {
|
1652
|
-
"type": "string"
|
1653
|
-
}
|
1654
|
-
}
|
1655
1483
|
}
|
1656
1484
|
}
|
1657
1485
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uffizzi_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Thurman
|
@@ -736,7 +736,6 @@ files:
|
|
736
736
|
- app/forms/uffizzi_core/api/cli/v1/config_file/create_form.rb
|
737
737
|
- app/forms/uffizzi_core/api/cli/v1/deployment/create_form.rb
|
738
738
|
- app/forms/uffizzi_core/api/cli/v1/deployment/update_form.rb
|
739
|
-
- app/forms/uffizzi_core/api/cli/v1/project/create_form.rb
|
740
739
|
- app/forms/uffizzi_core/api/cli/v1/project/update_form.rb
|
741
740
|
- app/forms/uffizzi_core/api/cli/v1/secret/bulk_assign_form.rb
|
742
741
|
- app/forms/uffizzi_core/api/cli/v1/session_create_form.rb
|
@@ -839,8 +838,6 @@ files:
|
|
839
838
|
- app/responders/uffizzi_core/json_responder.rb
|
840
839
|
- app/serializers/uffizzi_core/api/cli/v1/account/credential_serializer.rb
|
841
840
|
- app/serializers/uffizzi_core/api/cli/v1/project_serializer.rb
|
842
|
-
- app/serializers/uffizzi_core/api/cli/v1/project_serializer/compose_file_serializer.rb
|
843
|
-
- app/serializers/uffizzi_core/api/cli/v1/project_serializer/deployment_serializer.rb
|
844
841
|
- app/serializers/uffizzi_core/api/cli/v1/projects/compose_file_serializer.rb
|
845
842
|
- app/serializers/uffizzi_core/api/cli/v1/projects/deployment_serializer.rb
|
846
843
|
- app/serializers/uffizzi_core/api/cli/v1/projects/deployment_serializer/container_serializer.rb
|
@@ -850,7 +847,6 @@ files:
|
|
850
847
|
- app/serializers/uffizzi_core/api/cli/v1/projects/deployments/container_serializer/container_config_file_serializer.rb
|
851
848
|
- app/serializers/uffizzi_core/api/cli/v1/projects/deployments/container_serializer/container_config_file_serializer/config_file_serializer.rb
|
852
849
|
- app/serializers/uffizzi_core/api/cli/v1/projects/secret_serializer.rb
|
853
|
-
- app/serializers/uffizzi_core/api/cli/v1/short_project_serializer.rb
|
854
850
|
- app/serializers/uffizzi_core/api/cli/v1/user_serializer.rb
|
855
851
|
- app/serializers/uffizzi_core/api/cli/v1/user_serializer/account_serializer.rb
|
856
852
|
- app/serializers/uffizzi_core/base_serializer.rb
|
@@ -880,7 +876,6 @@ files:
|
|
880
876
|
- app/services/uffizzi_core/compose_file/errors_service.rb
|
881
877
|
- app/services/uffizzi_core/compose_file/github_dependencies_service.rb
|
882
878
|
- app/services/uffizzi_core/compose_file/ingress_options_service.rb
|
883
|
-
- app/services/uffizzi_core/compose_file/parsers/services/healthcheck_parser_service.rb
|
884
879
|
- app/services/uffizzi_core/compose_file/secrets_options_service.rb
|
885
880
|
- app/services/uffizzi_core/compose_file/services_options/command_service.rb
|
886
881
|
- app/services/uffizzi_core/compose_file/services_options/configs_service.rb
|
@@ -907,7 +902,6 @@ files:
|
|
907
902
|
- app/services/uffizzi_core/project_service.rb
|
908
903
|
- app/services/uffizzi_core/repo_service.rb
|
909
904
|
- app/services/uffizzi_core/response_service.rb
|
910
|
-
- app/services/uffizzi_core/starter_template_service.rb
|
911
905
|
- app/services/uffizzi_core/template_service.rb
|
912
906
|
- app/services/uffizzi_core/token_service.rb
|
913
907
|
- app/services/uffizzi_core/user_access_service.rb
|
@@ -929,7 +923,6 @@ files:
|
|
929
923
|
- db/migrate/20220329123323_rename_project_secrets_to_secrets.rb
|
930
924
|
- db/migrate/20220329124542_add_resource_to_secrets.rb
|
931
925
|
- db/migrate/20220329143241_remove_project_ref_from_secrets.rb
|
932
|
-
- db/migrate/20220419074956_add_health_check_to_containers.rb
|
933
926
|
- db/migrate/20220525113412_rename_name_to_uffizzi_containers.rb
|
934
927
|
- db/seeds.rb
|
935
928
|
- lib/tasks/uffizzi_core_tasks.rake
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class UffizziCore::Api::Cli::V1::ProjectSerializer::DeploymentSerializer < UffizziCore::BaseSerializer
|
4
|
-
type :deployment
|
5
|
-
|
6
|
-
attributes :id,
|
7
|
-
:preview_url,
|
8
|
-
:state
|
9
|
-
|
10
|
-
def preview_url
|
11
|
-
UffizziCore::DeploymentService.build_preview_url(object)
|
12
|
-
end
|
13
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class UffizziCore::ComposeFile::Parsers::Services::HealthcheckParserService
|
4
|
-
REQUIRED_START_COMMANDS = ['NONE', 'CMD', 'CMD-SHELL'].freeze
|
5
|
-
|
6
|
-
class << self
|
7
|
-
def parse(healthcheck_data)
|
8
|
-
return {} if healthcheck_data.blank?
|
9
|
-
|
10
|
-
command = parse_command(healthcheck_data)
|
11
|
-
|
12
|
-
{
|
13
|
-
test: command,
|
14
|
-
interval: parse_time(healthcheck_data['interval']),
|
15
|
-
timeout: parse_time(healthcheck_data['timeout']),
|
16
|
-
retries: parse_retries(healthcheck_data['retries']),
|
17
|
-
start_period: parse_time(healthcheck_data['start_period']),
|
18
|
-
disable: parse_disable_option(healthcheck_data['disable'], command),
|
19
|
-
}
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def parse_command(healthcheck_data)
|
25
|
-
command = healthcheck_data['test']
|
26
|
-
raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.string_or_array_error', option: :test) if command.nil?
|
27
|
-
|
28
|
-
case command
|
29
|
-
when Array
|
30
|
-
start_command = command.first
|
31
|
-
raise UffizziCore::ComposeFile::ParseError unless REQUIRED_START_COMMANDS.include?(start_command)
|
32
|
-
|
33
|
-
command
|
34
|
-
when String
|
35
|
-
command
|
36
|
-
else
|
37
|
-
raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_type', option: :test)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def parse_retries(value)
|
42
|
-
raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_integer', option: :retries) unless value.is_a?(Integer)
|
43
|
-
end
|
44
|
-
|
45
|
-
def parse_time(value)
|
46
|
-
tokens = {
|
47
|
-
's' => 1,
|
48
|
-
'm' => 60,
|
49
|
-
'h' => (60 * 60),
|
50
|
-
'd' => (60 * 60 * 24),
|
51
|
-
}
|
52
|
-
|
53
|
-
time_parts = value.scan(/(\d+)(\w)/).compact
|
54
|
-
|
55
|
-
time_parts.reduce(0) do |acc, part|
|
56
|
-
amount, measure = part
|
57
|
-
acc += amount.to_i * tokens[measure]
|
58
|
-
|
59
|
-
acc
|
60
|
-
rescue StandardError
|
61
|
-
raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_time_interval')
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def parse_disable_option(value, command)
|
66
|
-
return true if command.is_a?(Array) && command.first == 'NONE'
|
67
|
-
return false if value.nil?
|
68
|
-
return value if value.in?([true, false])
|
69
|
-
|
70
|
-
raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_bool_value', field: 'disable', value: value)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
@@ -1,200 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class UffizziCore::StarterTemplateService
|
4
|
-
class << self
|
5
|
-
def create(project, user)
|
6
|
-
voting_app_config_file = create_config_file(project, user)
|
7
|
-
create_containers(project, user, voting_app_config_file)
|
8
|
-
end
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
def create_config_file(project, user)
|
13
|
-
starter_template_config_file = config_file_attributes
|
14
|
-
|
15
|
-
starter_template_config_file_params = ActionController::Parameters.new(starter_template_config_file)
|
16
|
-
|
17
|
-
starter_template_config_file_form = UffizziCore::Api::Cli::V1::ConfigFile::CreateForm.new(starter_template_config_file_params)
|
18
|
-
starter_template_config_file_form.project = project
|
19
|
-
starter_template_config_file_form.added_by = user
|
20
|
-
starter_template_config_file_form.creation_source = UffizziCore::ConfigFile.creation_source.system
|
21
|
-
starter_template_config_file_form.save
|
22
|
-
|
23
|
-
starter_template_config_file_form
|
24
|
-
end
|
25
|
-
|
26
|
-
def create_containers(project, user, voting_app_config_file)
|
27
|
-
starter_template_containers = {
|
28
|
-
name: 'Voting App (from base images)',
|
29
|
-
payload: {
|
30
|
-
containers_attributes: containers_attributes(voting_app_config_file),
|
31
|
-
},
|
32
|
-
}
|
33
|
-
|
34
|
-
starter_template = ActionController::Parameters.new(starter_template_containers)
|
35
|
-
|
36
|
-
starter_template_form = UffizziCore::Api::Cli::V1::Template::CreateForm.new(starter_template)
|
37
|
-
starter_template_form.creation_source = UffizziCore::Template.creation_source.system
|
38
|
-
starter_template_form.added_by = user
|
39
|
-
starter_template_form.project = project
|
40
|
-
starter_template_form.save
|
41
|
-
end
|
42
|
-
|
43
|
-
def containers_attributes(voting_app_config_file)
|
44
|
-
[
|
45
|
-
postgres_container_attributes,
|
46
|
-
nginx_container_attributes(voting_app_config_file),
|
47
|
-
redis_container_attributes,
|
48
|
-
example_worker_container_attributes,
|
49
|
-
example_result_container_attributes,
|
50
|
-
example_vote_container_attributes,
|
51
|
-
]
|
52
|
-
end
|
53
|
-
|
54
|
-
def postgres_container_attributes
|
55
|
-
{
|
56
|
-
image: 'library/postgres',
|
57
|
-
tag: '9.6',
|
58
|
-
port: nil,
|
59
|
-
public: false,
|
60
|
-
memory_limit: 250,
|
61
|
-
memory_request: 250,
|
62
|
-
receive_incoming_requests: false,
|
63
|
-
continuously_deploy: 'disabled',
|
64
|
-
secret_variables: nil,
|
65
|
-
variables: [
|
66
|
-
{
|
67
|
-
name: 'POSTGRES_USER',
|
68
|
-
value: 'postgres',
|
69
|
-
},
|
70
|
-
{
|
71
|
-
name: 'POSTGRES_PASSWORD',
|
72
|
-
value: 'postgres',
|
73
|
-
},
|
74
|
-
],
|
75
|
-
repo_attributes: repo_attributes('library/postgres'),
|
76
|
-
container_config_files_attributes: [],
|
77
|
-
}
|
78
|
-
end
|
79
|
-
|
80
|
-
def nginx_container_attributes(voting_app_config_file)
|
81
|
-
{
|
82
|
-
image: 'library/nginx',
|
83
|
-
tag: 'latest',
|
84
|
-
port: 8080,
|
85
|
-
public: true,
|
86
|
-
memory_limit: 125,
|
87
|
-
memory_request: 125,
|
88
|
-
receive_incoming_requests: true,
|
89
|
-
continuously_deploy: 'disabled',
|
90
|
-
secret_variables: nil,
|
91
|
-
variables: nil,
|
92
|
-
repo_attributes: repo_attributes('library/nginx'),
|
93
|
-
container_config_files_attributes: [{
|
94
|
-
config_file_id: voting_app_config_file.id,
|
95
|
-
mount_path: '/etc/nginx/conf.d/',
|
96
|
-
}],
|
97
|
-
}
|
98
|
-
end
|
99
|
-
|
100
|
-
def redis_container_attributes
|
101
|
-
{
|
102
|
-
image: 'library/redis',
|
103
|
-
tag: 'latest',
|
104
|
-
port: nil,
|
105
|
-
public: false,
|
106
|
-
memory_limit: 125,
|
107
|
-
memory_request: 125,
|
108
|
-
receive_incoming_requests: false,
|
109
|
-
continuously_deploy: 'disabled',
|
110
|
-
secret_variables: nil,
|
111
|
-
variables: nil,
|
112
|
-
repo_attributes: repo_attributes('library/redis'),
|
113
|
-
container_config_files_attributes: [],
|
114
|
-
}
|
115
|
-
end
|
116
|
-
|
117
|
-
def example_worker_container_attributes
|
118
|
-
{
|
119
|
-
image: 'uffizzicloud/example-worker',
|
120
|
-
tag: 'latest',
|
121
|
-
port: nil,
|
122
|
-
public: false,
|
123
|
-
memory_limit: 250,
|
124
|
-
memory_request: 250,
|
125
|
-
receive_incoming_requests: false,
|
126
|
-
continuously_deploy: 'disabled',
|
127
|
-
secret_variables: nil,
|
128
|
-
variables: nil,
|
129
|
-
repo_attributes: repo_attributes('uffizzicloud/example-worker'),
|
130
|
-
container_config_files_attributes: [],
|
131
|
-
}
|
132
|
-
end
|
133
|
-
|
134
|
-
def example_result_container_attributes
|
135
|
-
{
|
136
|
-
image: 'uffizzicloud/example-result',
|
137
|
-
tag: 'latest',
|
138
|
-
port: nil,
|
139
|
-
public: false,
|
140
|
-
memory_limit: 125,
|
141
|
-
memory_request: 125,
|
142
|
-
receive_incoming_requests: false,
|
143
|
-
continuously_deploy: 'disabled',
|
144
|
-
secret_variables: nil,
|
145
|
-
variables: nil,
|
146
|
-
repo_attributes: repo_attributes('uffizzicloud/example-result'),
|
147
|
-
container_config_files_attributes: [],
|
148
|
-
}
|
149
|
-
end
|
150
|
-
|
151
|
-
def example_vote_container_attributes
|
152
|
-
{
|
153
|
-
image: 'uffizzicloud/example-vote',
|
154
|
-
tag: 'latest',
|
155
|
-
port: nil,
|
156
|
-
public: false,
|
157
|
-
memory_limit: 250,
|
158
|
-
memory_request: 250,
|
159
|
-
receive_incoming_requests: false,
|
160
|
-
continuously_deploy: 'disabled',
|
161
|
-
secret_variables: nil,
|
162
|
-
variables: nil,
|
163
|
-
repo_attributes: repo_attributes('uffizzicloud/example-vote'),
|
164
|
-
container_config_files_attributes: [],
|
165
|
-
}
|
166
|
-
end
|
167
|
-
|
168
|
-
def config_file_attributes
|
169
|
-
{
|
170
|
-
filename: 'vote.conf',
|
171
|
-
kind: 'config_map',
|
172
|
-
payload: "server {
|
173
|
-
listen 8080;
|
174
|
-
server_name example.com;
|
175
|
-
location / {
|
176
|
-
proxy_pass http://127.0.0.1:80/;
|
177
|
-
}
|
178
|
-
location /vote/ {
|
179
|
-
proxy_pass http://127.0.0.1:8888/;
|
180
|
-
}
|
181
|
-
}",
|
182
|
-
}
|
183
|
-
end
|
184
|
-
|
185
|
-
def repo_attributes(image)
|
186
|
-
namespace, name = image.split('/')
|
187
|
-
{
|
188
|
-
namespace: namespace,
|
189
|
-
name: name,
|
190
|
-
slug: name,
|
191
|
-
type: 'UffizziCore::Repo::DockerHub',
|
192
|
-
description: '',
|
193
|
-
is_private: false,
|
194
|
-
repository_id: nil,
|
195
|
-
branch: '',
|
196
|
-
kind: nil,
|
197
|
-
}
|
198
|
-
end
|
199
|
-
end
|
200
|
-
end
|