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
Xavier Thompson
slapos
Commits
912a8835
Commit
912a8835
authored
Oct 28, 2021
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
html5as: Match the final state of html5as-tutorial
parent
d7721eb4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
7 deletions
+81
-7
software/html5as/buildout.hash.cfg
software/html5as/buildout.hash.cfg
+6
-2
software/html5as/instance.cfg.in
software/html5as/instance.cfg.in
+1
-0
software/html5as/instance_html5as.cfg.in
software/html5as/instance_html5as.cfg.in
+10
-0
software/html5as/promise/check_index_exists.py
software/html5as/promise/check_index_exists.py
+52
-0
software/html5as/software.cfg
software/html5as/software.cfg
+12
-5
No files found.
software/html5as/buildout.hash.cfg
View file @
912a8835
...
...
@@ -17,11 +17,11 @@
[template-cfg]
filename = instance.cfg.in
md5sum =
9e486efe4ab1aba8cb72b04f6c6da8ad
md5sum =
51292164b96db5889010e0962c96ee96
[instance_html5as]
_update_hash_filename_ = instance_html5as.cfg.in
md5sum =
f86b2f37c0acd21ca1f41d90c5477d75
md5sum =
98b880debb61556066c5d720c1cb86e3
[template_nginx_conf]
_update_hash_filename_ = templates/nginx_conf.in
...
...
@@ -46,3 +46,7 @@ md5sum = 1c0ee16966e1fcdb3fd11c09f12ee2b2
[template_instance_replicate]
_update_hash_filename_ = instance_replicate.cfg.in
md5sum = 7ff7e11d05145115f53564ec1af205ef
[custom-promise]
_update_hash_filename_ = promise/check_index_exists.py
md5sum = a98d598136629e667e7e43e1d3746b53
software/html5as/instance.cfg.in
View file @
912a8835
...
...
@@ -15,6 +15,7 @@ template_launcher = {{ template_launcher_target }}
template_index_html = {{ template_index_html_target }}
template_graceful = {{ template_graceful_target }}
template_monitor = {{ template_monitor }}
custom_promise = {{ custom_promise }}
[instance-html5as]
recipe = slapos.recipe.template:jinja2
...
...
software/html5as/instance_html5as.cfg.in
View file @
912a8835
...
...
@@ -14,6 +14,7 @@ parts =
launcher
nginx-graceful
port-listening-promise
index-exists-promise
logrotate-entry-nginx
publish-connection-information
...
...
@@ -239,3 +240,12 @@ promise = check_url_available
name = html5as-http-frontend.py
url = ${html5as-frontend:connection-secure_access}
config-url = ${:url}
config-check-secure = 1
# Add the custom promise to check that the index file exists
[index-exists-promise]
recipe = slapos.cookbook:promise.plugin
eggs = slapos.core
file = {{ parameter_list['custom_promise'] }}
output = ${directory:plugins}/check-index-exists.py
config-filepath = ${html5as:default_index}
software/html5as/promise/check_index_exists.py
0 → 100644
View file @
912a8835
import
os
from
zope.interface
import
implementer
from
slapos.grid.promise
import
interface
from
slapos.grid.promise.generic
import
GenericPromise
@
implementer
(
interface
.
IPromise
)
class
RunPromise
(
GenericPromise
):
def
__init__
(
self
,
config
):
"""
Called when initialising the promise before testing.
Sets the configuration and the periodicity.
"""
super
(
RunPromise
,
self
).
__init__
(
config
)
self
.
setPeriodicity
(
minute
=
2
)
def
sense
(
self
):
"""
Called every time the promise is tested.
Signals a positive or negative result.
In this case, check whether the file exists.
"""
path
=
self
.
getConfig
(
'filepath'
)
if
os
.
path
.
isfile
(
path
):
self
.
logger
.
info
(
"filepath %s exists and is a file"
,
path
)
else
:
self
.
logger
.
error
(
"filepath %s does not exist or is not a file"
,
path
)
def
test
(
self
):
"""
Called after sense() if the instance is still converging.
Returns success or failure based on sense results.
In this case, fail if the previous sensor result is negative.
"""
return
self
.
_test
(
result_count
=
1
,
failure_amount
=
1
)
def
anomaly
(
self
):
"""
Called after sense() if the instance has finished converging.
Returns success or failure based on sense results.
Failure signals the instance has diverged.
In this case, fail if two out of the last three results are negative.
"""
return
self
.
_anomaly
(
result_count
=
3
,
failure_amount
=
2
)
software/html5as/software.cfg
View file @
912a8835
...
...
@@ -21,6 +21,8 @@ parts =
# Call creation of instance.cfg file that will be called for deployment of
# instance
template-cfg
# Add extra egg
extra-eggs
# Download instance.cfg.in (buildout profile used to deployment of instance),
# replace all {{ foo_bar }} parameters by real values
...
...
@@ -41,12 +43,9 @@ context =
key template_index_html_target template_index_html:target
key template_graceful_target template_graceful:target
key template_instance_replicate template_instance_replicate:target
# Monitor stack also provides a template for the instance
key template_monitor monitor2-template:rendered
key custom_promise custom-promise:target
# Have one shared section to define the default behaviour to download
# templates. Sections inheriting from this one won't need to redefine
# shared parameters
[download-base]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:_update_hash_filename_}
...
...
@@ -56,7 +55,6 @@ mode = 0644
[instance_html5as]
# This section inherit from download-base
<= download-base
# Filename and md5sum is defined in buildout.hash.cfg
[template_nginx_conf]
<= download-base
...
...
@@ -75,3 +73,12 @@ mode = 0644
[template_instance_replicate]
<= download-base
[extra-eggs]
recipe = zc.recipe.egg
eggs =
plone.recipe.command
# Download the custom promise
[custom-promise]
<= download-base
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