Commit 4a4e3e32 authored by Kirill Smelkov's avatar Kirill Smelkov

helloworld: Unify naming for internal "hello web" service

Since 7cd2f953 (helloworld: Turn it into real web-service) helloworld SR
implements real web-service which talks to outside world with the help
of shipped-with-it "hello web" program.

Buildout sections which create helloweb service and promise were named
based on helloworld prefix though, which is not very consistent. Thus the
change for such sections to the same name as the "hello web" program uses.

Also for style consistency the "hello web" program is renamed from
hello-web to helloweb, as this naming style is usually used for
helloworld.{c,py.rb,go,etc}

So the final naming is:

    helloweb

for both program and related sections.
parent c8c81baa
#!{{ python_executable }}
"""Simple web-server that says "Hello World" for every path
hello-web [--logfile <logfile>] <bind-ip> <bind-port> ...
helloweb [--logfile <logfile>] <bind-ip> <bind-port> ...
"""
import sys
......@@ -41,7 +41,7 @@ def main():
f = open(args.logfile, 'a', buffering=1)
sys.stderr = f
print >>sys.stderr, '* %s Hello-Web starting at %s' % (
print >>sys.stderr, '* %s helloweb starting at %s' % (
time.asctime(), (args.bind_ip, args.bind_port))
# TODO autodetect ipv6/ipv4
......
......@@ -6,8 +6,8 @@
[buildout]
parts =
directory
hello-world
hello-world-promise
helloweb
helloweb-promise
publish-connection-parameter
# Define egg directories to be the one from Software Release
......@@ -56,12 +56,12 @@ service = $${:etc}/service
# Executables put here will be launched after buildout has completed to see
# if instance is running
promise = $${:etc}/promise/
# Path of the log directory used by our service (see [hello-world])
# Path of the log directory used by our service (see [helloweb])
log = $${:var}/log
# Create a simple web server that says "hello <configuration.name>" to the web.
[hello-world]
[helloweb]
# helloworld service is listening on:
# - global IPv6 address, and
# - fixed port
......@@ -75,26 +75,26 @@ port = 7777
url = http://[$${:ipv6}]:$${:port}
# the service will log here
logfile = $${directory:log}/hello-world.log
logfile = $${directory:log}/helloweb.log
# Actual script that starts the service:
# This recipe will try to "exec" the command-line after separating parameters.
recipe = slapos.cookbook:wrapper
command-line =
${hello-web-bin:rendered} --logfile $${hello-world:logfile}
${helloweb-bin:rendered} --logfile $${helloweb:logfile}
$${:ipv6} $${:port} $${instance-parameter:configuration.name}
# Put this shell script in the "etc/service" directory. Each executable of this
# repository will be started and monitored by supervisord. If a service
# exits/crashes, it will trigger a "bang" and cause a re-run of the instance.
wrapper-path = $${directory:service}/hello-world
wrapper-path = $${directory:service}/helloweb
# promise, that checks that hello-world service is alive
[hello-world-promise]
# promise, that checks that helloweb service is alive
[helloweb-promise]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promise}/hello-world
hostname= $${hello-world:ipv6}
port = $${hello-world:port}
path = $${directory:promise}/helloweb
hostname= $${helloweb:ipv6}
port = $${helloweb:port}
# Publish all the parameters needed for the user to connect to the instance.
......@@ -103,4 +103,4 @@ port = $${hello-world:port}
[publish-connection-parameter]
recipe = slapos.cookbook:publish
name = Hello $${instance-parameter:configuration.name}!
url = $${hello-world:url}
url = $${helloweb:url}
......@@ -20,7 +20,7 @@ parts =
instance-profile
# "build" python program (install + correct shebang for our python)
hello-web-bin
helloweb-bin
# Download instance.cfg.in (buildout profile used to deployment of instance),
......@@ -31,15 +31,15 @@ recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg.in
output = ${buildout:directory}/instance.cfg
# MD5 checksum can be skipped for development (easier to develop), but must be filled for production
md5sum = 968bea0fc81dc604a874c53648b7d13f
md5sum = 1861b47bcc4dc61751857193303c8bef
mode = 0644
# install hello-web with correct python_executable
[hello-web-bin]
# install helloweb with correct python_executable
[helloweb-bin]
recipe = slapos.recipe.template:jinja2
filename = hello-web
md5sum = da4a93ff679d40c6682859476dcf4ce0
filename = helloweb
md5sum = 2cfa80eba8cadea3e9cad64db2e3f536
template = ${:_profile_base_location_}/${:filename}.in
rendered = ${buildout:bin-directory}/${:filename}
mode = 0755
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment