Commit 70db124b authored by HongzheWang's avatar HongzheWang

: Simplify lamp usage

See merge request !1183
parents 3474cec6 57f985f2
...@@ -13,13 +13,9 @@ ...@@ -13,13 +13,9 @@
# section inheritance (< = ...) are NOT supported (but you should really # section inheritance (< = ...) are NOT supported (but you should really
# not need these here). # not need these here).
[template-apache-httpd]
filename = apache-httpd.conf.in
md5sum = 9940e05d5e624a7884f4e6e062355798
[template-matomo-instance] [template-matomo-instance]
filename = matomo-instance.cfg.in filename = matomo-instance.cfg.in
md5sum = f82fd755c4ca5569836e0638a7502306 md5sum = 63cca2dab84791adf805922b2b73ab4a
[template-matomo-backup.sh] [template-matomo-backup.sh]
filename = matomo-backup.sh.in filename = matomo-backup.sh.in
......
...@@ -5,22 +5,6 @@ dir-backup = ${directory:backup} ...@@ -5,22 +5,6 @@ dir-backup = ${directory:backup}
find-bin = {{ findutils_location }} find-bin = {{ findutils_location }}
diff-bin = {{ diffutils_location }} diff-bin = {{ diffutils_location }}
#php.ini parameters
php.memory_limit = 512M
php.date.timezone = Europe/Paris
php.upload_max_filesize = 10240M
php.post_max_size = 10240M
php.session.cookie_secure = True
php.max_execution_time = 1800
php.max_input_time = 3600
php.output_buffering = 'Off'
php.max_file_uploads = 100
[php-bin]
recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:bin}/php
command-line = ${instance-parameter:php-bin} -c ${php.ini-conf:output}
[matomo-backup-cron] [matomo-backup-cron]
recipe = slapos.cookbook:cron.d recipe = slapos.cookbook:cron.d
cron-entries = ${cron:cron-entries} cron-entries = ${cron:cron-entries}
...@@ -28,13 +12,6 @@ name = matomo-backup ...@@ -28,13 +12,6 @@ name = matomo-backup
frequency = 0 0 * * * frequency = 0 0 * * *
command = ${matomo-backup.sh:output} command = ${matomo-backup.sh:output}
[matomo-apache-httpd]
recipe = slapos.recipe.template:jinja2
url = {{ matomo_apache_httpd }}
output = ${directory:apache.d}/matomo.conf
context =
section parameter_dict apache-php-configuration
[matomo-backup.sh] [matomo-backup.sh]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
url = {{ matomo_backup_sh }} url = {{ matomo_backup_sh }}
......
...@@ -28,12 +28,13 @@ url = ${:_profile_base_location_}/${:filename} ...@@ -28,12 +28,13 @@ url = ${:_profile_base_location_}/${:filename}
[application] [application]
url = https://builds.matomo.org/matomo-4.7.1.zip url = https://builds.matomo.org/matomo-4.7.1.zip
md5sum = 8d592676bc2c0d51363ad7b2caf171fe md5sum = 8d592676bc2c0d51363ad7b2caf171fe
archive-root = matomo
# give the location of the instance-matomo.cfg fil # give the location of the instance-matomo.cfg fil
# Without it the instance-matomo.cfg file will not be executed # Without it the instance-matomo.cfg file will not be executed
[custom-application-deployment] [custom-application-deployment]
path = ${template-matomo-instance:output} path = ${template-matomo-instance:output}
part-list = matomo-backup.sh matomo-backup-cron matomo-apache-httpd part-list = matomo-backup.sh matomo-backup-cron
db-name = matomo db-name = matomo
db-user = matomo db-user = matomo
db-password = 12345678 db-password = 12345678
...@@ -49,13 +50,8 @@ context = ...@@ -49,13 +50,8 @@ context =
key gzip_location gzip:location key gzip_location gzip:location
key python3_location python3:location key python3_location python3:location
key php_location apache-php:location key php_location apache-php:location
key matomo_apache_httpd template-apache-httpd:target
key matomo_backup_sh template-matomo-backup.sh:target key matomo_backup_sh template-matomo-backup.sh:target
# download apache-httpd.conf.in
[template-apache-httpd]
<= matomo-download
# download matomo-backup.sh.in # download matomo-backup.sh.in
[template-matomo-backup.sh] [template-matomo-backup.sh]
<= matomo-download <= matomo-download
<VirtualHost *:{{ parameter_dict['port'] }}>
ServerAdmin admin@example.com
DocumentRoot {{ parameter_dict['document-root'] }}
SetEnvIf Origin "^http(s)?://(.+\.)?(app\.officejs\.com)$" ORIGIN_DOMAIN=$0
Header always set Access-Control-Allow-Origin "%{ORIGIN_DOMAIN}e" env=ORIGIN_DOMAIN
Header always set Access-Control-Allow-Credentials "true" env=ORIGIN_DOMAIN
Header always set Access-Control-Allow-Methods "PROPFIND, PROPPATCH, COPY, MOVE, DELETE, MKCOL, LOCK, UNLOCK, PUT, GETLIB, VERSION-CONTROL, CHECKIN, CHECKOUT, UNCHECKOUT, REPORT, UPDATE, CANCELUPLOAD, HEAD, OPTIONS, GET, POST" env=ORIGIN_DOMAIN
Header always set Access-Control-Allow-Headers "Overwrite, Destination, Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control, Authorization" env=ORIGIN_DOMAIN
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>
<Directory {{ parameter_dict['document-root'] }}>
Options +FollowSymlinks
AllowOverride All
Require all granted
SetEnv HOME {{ parameter_dict['document-root'] }}
SetEnv HTTP_HOME {{ parameter_dict['document-root'] }}
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
ErrorLog "{{ parameter_dict['log-dir'] }}/nextcloud-error.log"
CustomLog "{{ parameter_dict['log-dir'] }}/nextcloud-access.log" combined
</VirtualHost>
...@@ -16,14 +16,10 @@ ...@@ -16,14 +16,10 @@
filename = nextcloud-install.sh.in filename = nextcloud-install.sh.in
md5sum = 094c26b177fdde69b41d81b89bab542b md5sum = 094c26b177fdde69b41d81b89bab542b
[template-apache-httpd]
filename = apache-httpd.conf.in
md5sum = f7e8f6ea20f8685bb4e42cacaee4116f
[template-nextcloud-config.json] [template-nextcloud-config.json]
filename = nextcloud-config.json.in filename = nextcloud-config.json.in
md5sum = 6f42f0a8c5e5c0c657541a65c4d9ee57 md5sum = 6f42f0a8c5e5c0c657541a65c4d9ee57
[template-nextcloud-instance] [template-nextcloud-instance]
filename = nextcloud-instance.cfg.in filename = nextcloud-instance.cfg.in
md5sum = 4426b5e62c61efec2e68e7f548bc6463 md5sum = e144dc4cdc3bd0a9be81ac0cc2cfdbd4
...@@ -55,17 +55,6 @@ cli-url = ${slap-parameter:instance.cli-url} ...@@ -55,17 +55,6 @@ cli-url = ${slap-parameter:instance.cli-url}
data-dir = ${nc-directory:data} data-dir = ${nc-directory:data}
redis-socket = ${service-redis:unixsocket} redis-socket = ${service-redis:unixsocket}
#php.ini parameters
php.memory_limit = 512M
php.date.timezone = Europe/Paris
php.upload_max_filesize = 10240M
php.post_max_size = 10240M
php.session.cookie_secure = True
php.max_execution_time = 1800
php.max_input_time = 3600
php.output_buffering = 'Off'
php.max_file_uploads = 100
#SMTP settings #SMTP settings
mail.from = ${slap-parameter:instance.mail-from} mail.from = ${slap-parameter:instance.mail-from}
mail.domain = ${slap-parameter:instance.mail-domain} mail.domain = ${slap-parameter:instance.mail-domain}
...@@ -93,7 +82,6 @@ depends = ...@@ -93,7 +82,6 @@ depends =
${redis-promise:recipe} ${redis-promise:recipe}
${nextcloud-cron:recipe} ${nextcloud-cron:recipe}
${nextcloud-optimize:recipe} ${nextcloud-optimize:recipe}
${nextcloud-apache-httpd:recipe}
${nextcloud-backup-cron:recipe} ${nextcloud-backup-cron:recipe}
${nextcloud-news-updater:recipe} ${nextcloud-news-updater:recipe}
${nextcloud-config-update:recipe} ${nextcloud-config-update:recipe}
...@@ -120,13 +108,6 @@ input = inline:#!/bin/bash ...@@ -120,13 +108,6 @@ input = inline:#!/bin/bash
output = ${directory:bin}/check-nc-install output = ${directory:bin}/check-nc-install
mode = 744 mode = 744
[nextcloud-apache-httpd]
recipe = slapos.recipe.template:jinja2
url = {{ nextcloud_apache_httpd }}
output = ${directory:apache.d}/nextcloud.conf
context =
section parameter_dict apache-php-configuration
[nextcloud-cron] [nextcloud-cron]
recipe = slapos.cookbook:cron.d recipe = slapos.cookbook:cron.d
cron-entries = ${cron:cron-entries} cron-entries = ${cron:cron-entries}
...@@ -199,11 +180,6 @@ input = inline:#!/bin/sh ...@@ -199,11 +180,6 @@ input = inline:#!/bin/sh
${php-bin:wrapper-path} ${instance-parameter:nextcloud}/occ config:import ${nextcloud-config.json:output} ${php-bin:wrapper-path} ${instance-parameter:nextcloud}/occ config:import ${nextcloud-config.json:output}
mode = 744 mode = 744
[php-bin]
recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:bin}/php
command-line = ${instance-parameter:php-bin} -c ${php.ini-conf:output}
[publish-connection-information] [publish-connection-information]
admin-user = ${instance-parameter:admin-user} admin-user = ${instance-parameter:admin-user}
admin-password = ${instance-parameter:admin-password} admin-password = ${instance-parameter:admin-password}
......
...@@ -15,9 +15,6 @@ md5sum = d81902d2dec5d547779bec6336a438be ...@@ -15,9 +15,6 @@ md5sum = d81902d2dec5d547779bec6336a438be
[template-nextcloud-install.sh] [template-nextcloud-install.sh]
<= nc-download <= nc-download
[template-apache-httpd]
<= nc-download
[template-nextcloud-config.json] [template-nextcloud-config.json]
<= nc-download <= nc-download
...@@ -34,7 +31,6 @@ context = ...@@ -34,7 +31,6 @@ context =
raw redis_bin ${redis:location}/bin/redis-server raw redis_bin ${redis:location}/bin/redis-server
raw redis_cli ${redis:location}/bin/redis-cli raw redis_cli ${redis:location}/bin/redis-cli
key nextcloud_install_sh template-nextcloud-install.sh:target key nextcloud_install_sh template-nextcloud-install.sh:target
key nextcloud_apache_httpd template-apache-httpd:target
key nextcloud_parameter_json template-nextcloud-config.json:target key nextcloud_parameter_json template-nextcloud-config.json:target
section nextcloud_apps nextcloud-apps section nextcloud_apps nextcloud-apps
......
<VirtualHost *:{{ parameter_dict['port'] }}> <VirtualHost *:{{ parameter_dict['port'] }}>
ServerAdmin admin@example.com ServerAdmin admin@example.com
DocumentRoot {{ parameter_dict['document-root'] }}/matomo DocumentRoot {{ parameter_dict['document-root'] }}
SetEnvIf Origin "^http(s)?://(.+\.)?(app\.officejs\.com)$" ORIGIN_DOMAIN=$0 SetEnvIf Origin "^http(s)?://(.+\.)?(app\.officejs\.com)$" ORIGIN_DOMAIN=$0
Header always set Access-Control-Allow-Origin "%{ORIGIN_DOMAIN}e" env=ORIGIN_DOMAIN Header always set Access-Control-Allow-Origin "%{ORIGIN_DOMAIN}e" env=ORIGIN_DOMAIN
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
Dav off Dav off
</Directory> </Directory>
ErrorLog "{{ parameter_dict['log-dir'] }}/matomo-error.log" ErrorLog "{{ parameter_dict['log-dir'] }}/lamp-error.log"
CustomLog "{{ parameter_dict['log-dir'] }}/matomo-access.log" combined CustomLog "{{ parameter_dict['log-dir'] }}/lamp-access.log" combined
</VirtualHost> </VirtualHost>
...@@ -37,6 +37,14 @@ url = ${:_profile_base_location_}/${:filename} ...@@ -37,6 +37,14 @@ url = ${:_profile_base_location_}/${:filename}
[application] [application]
recipe = slapos.recipe.build:download-unpacked recipe = slapos.recipe.build:download-unpacked
# softwares using this stack can extend this section to provide the url of
# an archive containing the application using url and md5sum options.
# The archive will be extracted directly in apache's DocumentRoot folder.
# In case the archive contain multiple files and folders and only a
# specific folder should be used as DocumentRoot, archive-root can be
# set to the relative path of this folder.
archive-root =
[python] [python]
part = python3 part = python3
...@@ -67,6 +75,7 @@ output = ${buildout:directory}/instance.cfg ...@@ -67,6 +75,7 @@ output = ${buildout:directory}/instance.cfg
url = ${:_profile_base_location_}/${:filename} url = ${:_profile_base_location_}/${:filename}
context = context =
key application_location application:location key application_location application:location
key application_archive_root application:archive-root
key application_deployment_part_list custom-application-deployment:part-list key application_deployment_part_list custom-application-deployment:part-list
key apache_location apache:location key apache_location apache:location
key apache_php_location apache-php:location key apache_php_location apache-php:location
...@@ -107,6 +116,7 @@ context = ...@@ -107,6 +116,7 @@ context =
key db_name custom-application-deployment:db-name key db_name custom-application-deployment:db-name
key db_user custom-application-deployment:db-user key db_user custom-application-deployment:db-user
key db_password custom-application-deployment:db-password key db_password custom-application-deployment:db-password
key lamp_apache_httpd template-apache-httpd:target
[instance-apache-php] [instance-apache-php]
<= template-download-base <= template-download-base
...@@ -120,6 +130,10 @@ context = ...@@ -120,6 +130,10 @@ context =
[template-php.ini] [template-php.ini]
<= template-download-base <= template-download-base
# download apache-httpd.conf.in
[template-apache-httpd]
<= template-download-base
[erp5] [erp5]
# lamp stack reuses erp5 stack to have mariadb, but we don't need to checkout erp5 here. # lamp stack reuses erp5 stack to have mariadb, but we don't need to checkout erp5 here.
recipe = recipe =
......
...@@ -14,15 +14,15 @@ ...@@ -14,15 +14,15 @@
# not need these here). # not need these here).
[instance] [instance]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = a5a630377bfb0421d6993c9c2c411a23 md5sum = 603d03f43ea04e95237c80d3b9e72ba7
[instance-apache-php] [instance-apache-php]
filename = instance-apache-php.cfg.in filename = instance-apache-php.cfg.in
md5sum = 0952ef9f6cb5e259ad5519d2975d2f37 md5sum = 8506f245087dfdc02561e8739a567bd6
[instance-lamp] [instance-lamp]
filename = instance-lamp.cfg.jinja2.in filename = instance-lamp.cfg.jinja2.in
md5sum = b3d68a13d7a7ffcac774f51f02a68359 md5sum = 79343539dff96f2d4592a4358d469201
[template-apache.conf] [template-apache.conf]
filename = apache.conf.in filename = apache.conf.in
...@@ -30,4 +30,8 @@ md5sum = 04080510698732d84122b464fdb08c6a ...@@ -30,4 +30,8 @@ md5sum = 04080510698732d84122b464fdb08c6a
[template-php.ini] [template-php.ini]
filename = php.ini.in filename = php.ini.in
md5sum = 599358f7df4c1e0de86270f5992ef904 md5sum = 980f603c34fcb008ce73a9dde2dbceb3
[template-apache-httpd]
filename = apache-httpd.conf.in
md5sum = 4ad906791f0d6fd3a4aef8f5a8018b45
...@@ -13,6 +13,7 @@ parts = ...@@ -13,6 +13,7 @@ parts =
php.ini-conf php.ini-conf
apache-php-service apache-php-service
publish-connection-information publish-connection-information
lamp-apache-httpd
{{ parameter_dict['application-part-list'] }} {{ parameter_dict['application-part-list'] }}
...@@ -133,10 +134,17 @@ cert-file = ${ca-directory:certs}/httpd.crt ...@@ -133,10 +134,17 @@ cert-file = ${ca-directory:certs}/httpd.crt
key-file = ${ca-directory:certs}/httpd.key key-file = ${ca-directory:certs}/httpd.key
apache-config-dir = ${directory:apache.d} apache-config-dir = ${directory:apache.d}
[lamp-apache-httpd]
recipe = slapos.recipe.template:jinja2
url = {{ lamp_apache_httpd }}
output = ${directory:apache.d}/lamp.conf
context =
section parameter_dict apache-php-configuration
[apache-php-conf] [apache-php-conf]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
url = {{ parameter_dict['template-apache-conf'] }} url = {{ parameter_dict['template-apache-conf'] }}
output = ${directory:etc}/apache.conf output = ${directory:etc}/apache.confgraceful
context = context =
section parameter_dict apache-php-configuration section parameter_dict apache-php-configuration
extensions = jinja2.ext.do extensions = jinja2.ext.do
...@@ -188,6 +196,24 @@ backend-url = ${apache-php-configuration:url} ...@@ -188,6 +196,24 @@ backend-url = ${apache-php-configuration:url}
php-bin = {{ parameter_dict['apache-php-location'] }}/bin/php php-bin = {{ parameter_dict['apache-php-location'] }}/bin/php
php-ini = ${php.ini-conf:output} php-ini = ${php.ini-conf:output}
#Defaut php.ini parameters
#They have been set in file php.ini.in
#I reserve them here just for an example
#You can reset them like this in your own software
php.memory_limit = 512M
php.date.timezone = Europe/Paris
php.upload_max_filesize = 10240M
php.post_max_size = 10240M
php.session.cookie_secure = True
php.max_execution_time = 1800
php.max_input_time = 3600
php.output_buffering = 'Off'
php.max_file_uploads = 100
[php-bin]
recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:bin}/php
command-line = ${instance-parameter:php-bin} -c ${php.ini-conf:output}
#---------------- #----------------
#-- #--
......
...@@ -37,8 +37,7 @@ return = ...@@ -37,8 +37,7 @@ return =
{% do publish_dict.__setitem__('backend-url', '${request-apache:connection-backend-url}') -%} {% do publish_dict.__setitem__('backend-url', '${request-apache:connection-backend-url}') -%}
{% do monitor_base_url_dict.__setitem__('apache', '${request-apache:connection-monitor-base-url}') -%} {% do monitor_base_url_dict.__setitem__('apache', '${request-apache:connection-monitor-base-url}') -%}
{% do mariadb_dict.__setitem__('database-list', [{'name': db_name, 'user': db_user, 'password': db_password}]) -%} {% do mariadb_dict.__setitem__('database-list', [{'name': db_name, 'user': db_user, 'password': db_password }]) -%}
{% do mariadb_dict.__setitem__('test-database-amount', 0) -%} {% do mariadb_dict.__setitem__('test-database-amount', 0) -%}
{% do mariadb_dict.__setitem__('tcpv4-port', 2099) -%} {% do mariadb_dict.__setitem__('tcpv4-port', 2099) -%}
{% do mariadb_dict.__setitem__('max-slowqueries-threshold', 1000) -%} {% do mariadb_dict.__setitem__('max-slowqueries-threshold', 1000) -%}
......
...@@ -54,7 +54,11 @@ extra-context = ...@@ -54,7 +54,11 @@ extra-context =
raw db_password {{ db_password }} raw db_password {{ db_password }}
[dynamic-template-apache-php-parameters] [dynamic-template-apache-php-parameters]
{% if application_archive_root %}
application-location = {{ application_location }}/{{ application_archive_root }}
{% else %}
application-location = {{ application_location }} application-location = {{ application_location }}
{% endif %}
application-part-list = {{ application_deployment_part_list }} application-part-list = {{ application_deployment_part_list }}
template-apache-conf = {{ template_apache_conf }} template-apache-conf = {{ template_apache_conf }}
apache-location = {{ apache_location }} apache-location = {{ apache_location }}
...@@ -72,6 +76,7 @@ filename = template-apache-php.cfg ...@@ -72,6 +76,7 @@ filename = template-apache-php.cfg
extra-context = extra-context =
key custom_application_template application-parameters:custom-application-template key custom_application_template application-parameters:custom-application-template
section parameter_dict dynamic-template-apache-php-parameters section parameter_dict dynamic-template-apache-php-parameters
raw lamp_apache_httpd {{ lamp_apache_httpd }}
[dynamic-template-mariadb-parameters] [dynamic-template-mariadb-parameters]
bash = {{ bash_location }} bash = {{ bash_location }}
......
...@@ -13,15 +13,15 @@ session.save_path = "{{ parameter_dict['tmp-dir'] }}" ...@@ -13,15 +13,15 @@ session.save_path = "{{ parameter_dict['tmp-dir'] }}"
session.auto_start = 0 session.auto_start = 0
date.timezone = {{ instance_dict.get('php.date.timezone', 'Europe/Paris') }} date.timezone = {{ instance_dict.get('php.date.timezone', 'Europe/Paris') }}
file_uploads = On file_uploads = On
upload_max_filesize = {{ instance_dict.get('php.upload_max_filesize', '8M') }} upload_max_filesize = {{ instance_dict.get('php.upload_max_filesize', '10240M') }}
post_max_size = {{ instance_dict.get('php.post_max_size', '8M') }} post_max_size = {{ instance_dict.get('php.post_max_size', '10240M') }}
magic_quotes_gpc=Off magic_quotes_gpc=Off
memory_limit = {{ instance_dict.get('php.memory_limit', '128M') }} memory_limit = {{ instance_dict.get('php.memory_limit', '512M') }}
session.cookie_secure = True session.cookie_secure = True
max_execution_time = {{ instance_dict.get('php.max_execution_time', 60) }} max_execution_time = {{ instance_dict.get('php.max_execution_time', 1800) }}
max_input_time = {{ instance_dict.get('php.max_input_time', 60) }} max_input_time = {{ instance_dict.get('php.max_input_time', 3600) }}
output_buffering = {{ instance_dict.get('php.output_buffering', 4096) }} output_buffering = {{ instance_dict.get('php.output_buffering', 4096) }}
max_file_uploads = {{ instance_dict.get('php.max_file_uploads', 20) }} max_file_uploads = {{ instance_dict.get('php.max_file_uploads', 100) }}
#extension_dir="./"# #extension_dir="./"#
sys_temp_dir="{{ parameter_dict['tmp-dir'] }}" sys_temp_dir="{{ parameter_dict['tmp-dir'] }}"
......
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