1 #############################
3 # Deploy hello-world instance
5 #############################
10 publish-connection-parameter
12 # Define egg directories to be the one from Software Release
15 eggs-directory = ${buildout:eggs-directory}
16 develop-eggs-directory = ${buildout:develop-eggs-directory}
21 # Fetch arbitrary parameters defined by the user in SlapOS Master for his instance.
22 # We use the slapconfiguration recipe with a few parameters (partition id,
23 # computer id, certificate, etc).
24 # It will then authenticate to SlapOS Master and fetch the instance parameters.
25 # The parameters are accessible from $${instance-parameter:configuration.name-of-parameter}
26 # Always the same. Just copy/paste.
27 # See docstring of slapos.cookbook:slapconfiguration for more informations.
28 recipe = slapos.cookbook:slapconfiguration
29 computer = $${slap_connection:computer_id}
30 partition = $${slap_connection:partition_id}
31 url = $${slap_connection:server_url}
32 key = $${slap_connection:key_file}
33 cert = $${slap_connection:cert_file}
35 # Define default parameter(s) that will be used later, in case user didn't
37 # All possible parameters should have a default.
38 # In our use case, we are expecting from the user to specify one (optional) parameter: "name". We put the default value here if he doesn't specify it, so that it doesn't crash.
39 configuration.name = John Doe
40 # If our use case requires that the user can specify a mail address so that his instance can mail to him (for example), we can do:
41 # configuration.mail-address =
42 # If the user doesn't specify it, it won't break and the recipe can handle it (i.e don't send any mail for example).
45 # Create all needed directories, depending on your needs
47 recipe = slapos.cookbook:mkdirectory
48 home = $${buildout:directory}
51 # Executables put here will be started but not monitored (for startup scripts)
52 script = $${:etc}/run/
53 # Executables put here will be started and monitored (for daemons)
54 service = $${:etc}/service
55 # Executables put here will be launched after buildout has completed to see
56 # if instance is running
57 promise = $${:etc}/promise/
58 # Path of the log directory used by our service (see [hello-world])
61 # Create a simple shell script that will only output your name if you
62 # specified it as instance parameter.
63 # Usually, of course, we use more useful commands, like web servers.
65 # This recipe will try to "exec" the command-line after separating parameters.
66 recipe = slapos.cookbook:wrapper
67 # Notice that there is only one $ at ${dash:location}, it is because it comes from the Software Release buildout profile.
68 command-line = ${dash:location}/bin/dash -c 'echo "Hello $${instance-parameter:configuration.name}, it is $(date)." > $${directory:log}/log.log; sleep 1000000;'
69 # Put this shell script in the "etc/service" directory. Every executable of this
70 # repository will be started and monitored by supervisord. If one service
71 # exits/crashes, it will trigger a "bang" and cause run of slapgrid for the
73 wrapper-path = $${directory:service}/hello-world
76 # Publish all the parameters needed for the user to connect to the instance.
77 # It can be anything: URL(s), password(s), or arbitrary parameters.
78 # Here we'll just echo back the entered name as instance parameter
79 [publish-connection-parameter]
80 recipe = slapos.cookbook:publish
81 name = Hello $${instance-parameter:configuration.name}!