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
HongzheWang
slapos
Commits
a6612c22
Commit
a6612c22
authored
Jul 13, 2021
by
Lisa Casino
Browse files
Options
Browse Files
Download
Plain Diff
html5as: from plone.recipe.command to slapos.recipe.build
See merge request
nexedi/slapos!1012
parents
24591a08
35503663
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
23 deletions
+40
-23
software/html5as/buildout.hash.cfg
software/html5as/buildout.hash.cfg
+3
-3
software/html5as/instance.cfg.in
software/html5as/instance.cfg.in
+2
-2
software/html5as/instance_html5as.cfg.in
software/html5as/instance_html5as.cfg.in
+33
-17
software/html5as/instance_replicate.cfg.in
software/html5as/instance_replicate.cfg.in
+2
-1
No files found.
software/html5as/buildout.hash.cfg
View file @
a6612c22
...
...
@@ -17,11 +17,11 @@
[template-cfg]
filename = instance.cfg.in
md5sum =
924ea0270c118e3470c04f32da979888
md5sum =
8528c7b469caa8bdede682e6660ba702
[instance_html5as]
_update_hash_filename_ = instance_html5as.cfg.in
md5sum =
7d438ca356aea0b2ace7378de91e7587
md5sum =
d1efe7a42d66c416ddf8d24d8a8107f4
[template_nginx_conf]
_update_hash_filename_ = templates/nginx_conf.in
...
...
@@ -45,4 +45,4 @@ md5sum = 1c0ee16966e1fcdb3fd11c09f12ee2b2
[template_instance_replicate]
_update_hash_filename_ = instance_replicate.cfg.in
md5sum =
2dd03eb194641fbc560122d04b67e212
md5sum =
7ff7e11d05145115f53564ec1af205ef
software/html5as/instance.cfg.in
View file @
a6612c22
...
...
@@ -33,7 +33,7 @@ context =
default-parameters =
{
"title": "",
"download_url":
""
,
"download_url":
null
,
"port": 8081,
"monitor-httpd-port": 8197
}
...
...
@@ -51,7 +51,7 @@ context =
jsonkey default_parameter_dict :default-parameters
default-parameters =
{
"download_url":
""
,
"download_url":
null
,
"replicate-quantity": 1
}
...
...
software/html5as/instance_html5as.cfg.in
View file @
a6612c22
...
...
@@ -8,7 +8,6 @@
[buildout]
parts =
nginx_conf
downloader
mime_types
launcher
nginx-graceful
...
...
@@ -60,7 +59,6 @@ service = ${directory:etc}/service
log = ${directory:var}/log
run = ${directory:var}/run
backup = ${directory:srv}/backup
data = ${directory:srv}/html5as
[tempdirectory]
recipe = slapos.cookbook:mkdirectory
...
...
@@ -90,8 +88,8 @@ path_access_log = ${basedirectory:log}/nginx.access.log
path_error_log = ${basedirectory:log}/nginx.error.log
path_tmp = ${tempdirectory:tmp}
# Docroot
docroot = ${
basedirectory:data
}
default_index = ${
basedirectory:data
}/index.html
docroot = ${
downloader:location
}
default_index = ${
:docroot
}/index.html
# Config files
path_nginx_conf = ${directory:etc}/nginx.conf
path_mime_types = ${directory:etc}/mime_types
...
...
@@ -132,21 +130,39 @@ context =
# Command to put content in the docroot
[downloader]
recipe = plone.recipe.command
# This section will fail if the command fails.
stop-on-error = true
# If a tarball is passed as a parameter in download url
recipe = slapos.recipe.build
# Path where the recipe stores any produced file,
# it will be automatically removed at the beginning of "install".
location = ${directory:srv}/html5as
# We add: or '', otherwise jinja2 will render a 'None' string
url = {{ parameter_dict['download_url'] or '' }}
default_index_html = ${default_index_html:rendered}
# If a tarball is passed as a parameter in "download_url",
# it's content will be served by the instance.
# If the parameter is not provided it fallback to the default template
command =
rm -rf ${html5as:docroot}/*;
URL = {{ parameter_dict['download_url'] }};
if [ -n "$URL" ];
then
${html5as:curl-binary} -Lks $URL | ${html5as:tar-binary} xzv -C ${html5as:docroot} --strip-components 1;
else
cp ${default_index_html:rendered} ${html5as:docroot}/;
fi
install =
import os, shutil
buildout_offline = self.buildout['buildout']['offline']
try:
# Allow to do self.download() which can only be used in "online" mode
self.buildout['buildout']['offline'] = 'false'
if options['url']:
# Use fonctions from the slapos.recipe.build repository
# Download a file from a URL to a temporary path
file = self.download(options['url'], options.get('md5sum'))
# Create a directory and extract the file that are compressed inside
extract_dir = self.extract(file)
# Return the right directory path
workdir = guessworkdir(extract_dir)
# Recursively copy directory
self.copyTree(workdir, location)
else:
# Create directory and copy the default template inside
os.makedirs(location)
shutil.copy(options['default_index_html'], location)
finally:
# reset the parameter
self.buildout['buildout']['offline'] = buildout_offline
[default_index_html]
recipe = slapos.recipe.template:jinja2
...
...
software/html5as/instance_replicate.cfg.in
View file @
a6612c22
...
...
@@ -31,7 +31,8 @@ software-type = default
# What parameter are neede to be retrieved
return = server_url server-cdn-url monitor-setup-url
# Provided parameters
config-download_url = {{ parameter_dict['download_url'] }}
# We add: or '', otherwise jinja2 will render a 'None' string
config-download_url = {{ parameter_dict['download_url'] or '' }}
# Create request section in a loop.
{% for i in range(1, replicate_quantity + 1) %}
...
...
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