4 The lamp recipe helps you to deploy simply a php based application on slapos. This recipe is
5 able to setup mariadb, apache and apache-php for your php application, and is also capable of
6 configuring your software during installation to ensure a full compatibility.
12 just add this part in your software.cfg to use the lamp.simple module
18 you also need to extend lamp.cfg
21 http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.50:/stack/lamp.cfg
27 When you install some software (such as prestashop) you need to remove or rename folder, with slapos you can not
28 access to the www-data directory. to do this, you need to tell to lamp recipe to remove or/and it when software
29 will be instantiated. Some software requires more than rename or delete a folder (manualy create database etc...)
30 in this case you need to write a python script and lamp recipe must run it when installing your software.
37 this part of lamp recipe work with slapos.toolbox, Therefore you must add it to your recipe.
38 in software.cfg, replace instance-recipe-egg part by
41 recipe = zc.recipe.egg
44 ${instance-recipe:egg}
45 slapos.toolbox[lampconfigure]
47 and add into your instance.cfg
49 lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
55 the action (delete, rename, script, chmod) only starts when the condition is filled.
58 file_token = path_of_file
60 and the action will begin when path_of_www-data/path_of_file will be created
61 you can also use database to check condition. add
63 table_name = name_of_table
64 constraint = sql_where_condition
66 name_of_table is the full or partial name(in some cases we can not know the prefix used to create tables) of table
67 into mariadb databse for example table_name = admin. if you use
68 name_of_table = **, the action will begin when database is ready.
69 constraint is the sql_condition to use when search entry into name_of_table for example constraint = `admin_id`=1
71 you can't use file_token and table_name at the same time, otherwise file_token will be used in priority. Beware of conditions that will never be satisfied.
77 The action starts when condition is true
78 1- delete file or folder
79 into instance.cfg, use
81 delete = file_or_folder1, file_or_folder2, file_or_folder3 ...
83 for example delete = admin
85 2- rename file or folder
86 into instance.cfg, use
88 rename_chmod = mode (optional)
89 rename = old_name1 => new_name1, old_name2 => new_name2, ...
92 rename = old_name1, old_name2 => new_name2, ... in this case old_name1 will be rename and the new name will be chose
93 by joining old_name1 and mysql_user: this should give
94 rename = old_name1 => old_name1-mysql_user, old_name2 => new_name2, ...
95 use rename_chmod to apply a mode to new_name1, new_name2, ...
97 3- Change mode of file or directory
99 this is usefull if you want to change the mode of files into your www-data, use
101 chmod = file1, file2, ....
102 mode = mode_to_apply (ex= 0644)
104 4- Launch python script
106 use script = ${configure-script:location}/${configure-script:filename} into instance.cfg, add part configure-script
109 parts = configure-script
112 recipe = hexagonit.recipe.download
113 location = ${buildout:parts-directory}/${:_buildout_section_name_}
114 url = url_of_script_name.py
115 filename = script_name.py
118 The script_name.py should contain a main function, sys.argv is given to the main. you can write script_name.py like this
121 mysql_port, mysql_host, mysql_user, mysql_password, mysql_database, base_url, htdocs = args
124 if __name__ == '__main__':
127 base_url: is the url of php software
128 htdocs: is the path of www-data directory
129 mysql_user, mysql_password, mysql_database, mysql_host: is the mariadb parameters
130 you can also use "import MySQLdb" if you want to access to database via your python script