Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nirina Malard
slapos
Commits
9388d933
Commit
9388d933
authored
Aug 23, 2023
by
Nirina Malard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/html5as-base: add flexible replicate
parent
496643ba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
33 deletions
+27
-33
software/html5as-base/buildout.hash.cfg
software/html5as-base/buildout.hash.cfg
+2
-2
software/html5as-base/instance.cfg.in
software/html5as-base/instance.cfg.in
+4
-7
software/html5as-base/instance_replicate.cfg.in
software/html5as-base/instance_replicate.cfg.in
+21
-24
No files found.
software/html5as-base/buildout.hash.cfg
View file @
9388d933
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
[template-cfg]
[template-cfg]
filename = instance.cfg.in
filename = instance.cfg.in
md5sum =
0f030af59547866bbebff22f4b29cef3
md5sum =
338a86dc7df98a777e881e0b24d64f8d
[instance_html5as]
[instance_html5as]
_update_hash_filename_ = instance_html5as.cfg.in
_update_hash_filename_ = instance_html5as.cfg.in
...
@@ -46,4 +46,4 @@ md5sum = 1c0ee16966e1fcdb3fd11c09f12ee2b2
...
@@ -46,4 +46,4 @@ md5sum = 1c0ee16966e1fcdb3fd11c09f12ee2b2
[template_instance_replicate]
[template_instance_replicate]
_update_hash_filename_ = instance_replicate.cfg.in
_update_hash_filename_ = instance_replicate.cfg.in
md5sum =
01fc8287b5429d21906a649d1163a51f
md5sum =
ae348dc2e72e1e41180bd74625db9d81
software/html5as-base/instance.cfg.in
View file @
9388d933
...
@@ -41,6 +41,7 @@ default-parameters =
...
@@ -41,6 +41,7 @@ default-parameters =
[instance-replicate]
[instance-replicate]
recipe = slapos.recipe.template:jinja2
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
url = {{ template_instance_replicate }}
url = {{ template_instance_replicate }}
output = ${buildout:directory}/${:filename}
output = ${buildout:directory}/${:filename}
filename = instance-replicate-html5as.cfg
filename = instance-replicate-html5as.cfg
...
@@ -52,14 +53,8 @@ context =
...
@@ -52,14 +53,8 @@ context =
# User can specify parameter for any of the two instances
# User can specify parameter for any of the two instances
default-parameters =
default-parameters =
{
{
"title": "",
"title1": "",
"title2": "",
"download_url": "",
"download_url": "",
"port1": 8081,
"replicate-quantity": 1
"port2": 8082,
"monitor-httpd-port1": 8197,
"monitor-httpd-port2": 8198
}
}
[switch-softwaretype]
[switch-softwaretype]
...
@@ -73,3 +68,5 @@ recipe = slapos.cookbook:slapconfiguration
...
@@ -73,3 +68,5 @@ recipe = slapos.cookbook:slapconfiguration
computer = ${slap-connection:computer-id}
computer = ${slap-connection:computer-id}
partition = ${slap-connection:partition-id}
partition = ${slap-connection:partition-id}
url = ${slap-connection:server-url}
url = ${slap-connection:server-url}
key = ${slap-connection:key-file}
cert = ${slap-connection:cert-file}
software/html5as-base/instance_replicate.cfg.in
View file @
9388d933
{% set parameter_dict = dict(default_parameter_dict, **slapparameter_dict) %}
{%- set parameter_dict = dict(default_parameter_dict, **slapparameter_dict) %}
{%- set replicate_quantity = int(parameter_dict['replicate-quantity']) %}
# Set default title and port for each replicate based on requested quantity
{%- for i in range(1, replicate_quantity + 1) %}
{%- do parameter_dict.setdefault("title-%d" % i, "") %}
{%- do parameter_dict.setdefault("port-%d" % i, 8081 + i) %}
{%- do parameter_dict.setdefault("monitor-httpd-port-%d" % i, 8197 + i) %}
{%- endfor %}
# Standard buildout section
[buildout]
[buildout]
parts =
parts =
publish-connection-information
publish-connection-information
...
@@ -24,34 +30,25 @@ software-type = default
...
@@ -24,34 +30,25 @@ software-type = default
# What parameter are neede to be retrieved
# What parameter are neede to be retrieved
return = server_url server-cdn-url monitor-setup-url
return = server_url server-cdn-url monitor-setup-url
# Provided parameters
# Provided parameters
config-title = {{ parameter_dict['title'] }}
config-download_url = {{ parameter_dict['download_url'] }}
config-download_url = {{ parameter_dict['download_url'] }}
# Create request section in a loop.
{% for i in range(1, replicate_quantity + 1) %}
# Request a normal html5as instance
# Request a normal html5as instance
[instance-
1
]
[instance-
{{ i }}
]
<= instance-request-base
<= instance-request-base
# Name of the instance
# Name of the instance
name = instance-html5as-1
name = instance-html5as-{{ i }}
# Port and title can be configured by instance
config-port = {{ parameter_dict["port-%s" % i] }}
config-port = {{ parameter_dict['port1'] }}
config-title = {{ parameter_dict["title-%s" % i] }}
config-title = {{ parameter_dict['title1'] }}
config-monitor-httpd-port = {{ parameter_dict["monitor-httpd-port-%s" % i] }}
config-monitor-httpd-port = {{ parameter_dict['monitor-httpd-port1'] }}
{% endfor %}
# Request a second html5as instance
[instance-2]
<= instance-request-base
# Name of the instance
name = instance-html5as-2
config-port = {{ parameter_dict['port2'] }}
config-title = {{ parameter_dict['title2'] }}
config-monitor-httpd-port = {{ parameter_dict['monitor-httpd-port2'] }}
# Publish information to connect to the two instances
# Publish information to connect to the two instances
[publish-connection-information]
[publish-connection-information]
recipe = slapos.cookbook:publish
recipe = slapos.cookbook:publish
instance-1-server_url = ${instance-1:connection-server_url}
{% for i in range(1, replicate_quantity + 1) %}
instance-1-server-cdn-url = ${instance-1:connection-server-cdn-url}
instance-{{ i }}-server_url = ${instance-{{ i }}:connection-server_url}
instance-1-server-monitor-setup-url = ${instance-1:connection-monitor-setup-url}
instance-{{ i }}-server-cdn-url = ${instance-{{ i }}:connection-server-cdn-url}
instance-2-server_url = ${instance-2:connection-server_url}
instance-{{ i }}-server-monitor-setup-url = ${instance-{{ i }}:connection-monitor-setup-url}
instance-2-server-cdn-url = ${instance-1:connection-server-cdn-url}
{% endfor %}
instance-2-server-monitor-setup-url = ${instance-1:connection-monitor-setup-url}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment