Commit b6a5ce52 authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Alain Takoudjou

Update drupal configuration, add parameter json schema

parent b30122ef
[template-drupal-instance] [template-drupal-instance]
filename = drupal-instance.cfg.in filename = drupal-instance.cfg.in
md5sum = 93e5694836b85ef82de4e90a07c5127d md5sum = 09a421327c11d4715a61516607c9de85
[template-settings.php]
filename = default.settings.php.in
md5sum = ef6369e834d774dfaeedc993d70aa98f
[template-settings.local.php]
filename = settings.local.php.in
md5sum = 2692b85c568694c618255095ecea11c5
<?php
// phpcs:ignoreFile
$databases = [];
$settings['update_free_access'] = FALSE;
# $settings['file_public_base_url'] = 'http://downloads.example.com/files';
# $settings['file_public_path'] = 'sites/default/files';
$settings['file_temp_path'] = '{{ parameter_dict['tmp-dir'] }}';
/**
* Load services definition file.
*/
$settings['container_yamls'][] = $app_root . '/' . $site_path . '/services.yml';
$settings['file_scan_ignore_directories'] = [
'node_modules',
'bower_components',
];
$settings['entity_update_batch_size'] = 50;
$settings['entity_update_backup'] = TRUE;
$settings['migrate_node_migrate_type_classic'] = FALSE;
/**
* Load local development override configuration, if available.
*
* Create a settings.local.php file to override variables on secondary (staging,
* development, etc.) installations of this site.
*
* Keep this code block at the end of this file to take full effect.
*/
if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
include $app_root . '/' . $site_path . '/settings.local.php';
}
...@@ -2,6 +2,21 @@ ...@@ -2,6 +2,21 @@
enable-php8 = !py!True enable-php8 = !py!True
document-root = ${:default-document-root}/docroot document-root = ${:default-document-root}/docroot
[template-base]
recipe = slapos.recipe.template:jinja2
context =
section parameter_dict instance-parameter
[settings.php]
<= template-base
url = {{ template_settings_php }}
output = ${directory:www}/docroot/sites/settings.base.php
[settings.local.php]
<= template-base
url = {{ template_settings_local }}
output = ${directory:www}/docroot/sites/settings.local.php
[drush-bin] [drush-bin]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
command-line = command-line =
...@@ -20,7 +35,7 @@ input = inline: ...@@ -20,7 +35,7 @@ input = inline:
export ACCOUNT_MAIL=${instance-parameter:account-mail} export ACCOUNT_MAIL=${instance-parameter:account-mail}
export ACCOUNT_PASS=${drupal-admin-passwd:passwd} export ACCOUNT_PASS=${drupal-admin-passwd:passwd}
export PATH={{ mariadb_location }}/bin:$PATH export PATH={{ mariadb_location }}/bin:$PATH
output = ${directory:etc}/site.env output = ${directory:etc}/.site.env
mode = 600 mode = 600
[drupal-site-install] [drupal-site-install]
...@@ -29,29 +44,46 @@ recipe = collective.recipe.template ...@@ -29,29 +44,46 @@ recipe = collective.recipe.template
input = inline:#!/bin/sh input = inline:#!/bin/sh
set -e set -e
CONFIG_FILE=${directory:www}/docroot/sites/default/settings.php
INSTALL_FILE=${directory:var}/.install-done INSTALL_FILE=${directory:var}/.install-done
if [ -s "$INSTALL_FILE" ]; then if [ -s "$INSTALL_FILE" ]; then
echo "Drupal is installed." echo "Drupal is installed."
exit 0; exit 0;
fi fi
. ${drupal-env:output} . ${drupal-env:output}
if [ ! -s "$CONFIG_FILE" ]; then
cp ${settings.php:output} $CONFIG_FILE
fi
${drush-bin:wrapper-path} site:install $DRUPAL_PROFILE \ ${drush-bin:wrapper-path} site:install $DRUPAL_PROFILE \
--locale=$LOCALE \ --locale=$LOCALE \
--db-url=$DB_URL \ --db-url=$DB_URL \
--site-name=$SITE_NAME \ --site-name="$SITE_NAME" \
--site-mail=$SITE_MAIL \ --site-mail=$SITE_MAIL \
--account-name=$ACCOUNT_NAME \ --account-name="$ACCOUNT_NAME" \
--account-mail=$ACCOUNT_MAIL \ --account-mail=$ACCOUNT_MAIL \
--account-pass=$ACCOUNT_PASS \ --account-pass=$ACCOUNT_PASS \
--verbose --yes --verbose --yes
echo "done" > $INSTALL_FILE
# Rebuild all caches.
${drush-bin:wrapper-path} cache:rebuild
echo "done" > $INSTALL_FILE
chmod 440 $INSTALL_FILE
mode = 744 mode = 744
depends =
${settings.php:recipe}
${settings.local.php:recipe}
[drupal-admin-passwd] [drupal-admin-passwd]
recipe = slapos.cookbook:generate.password recipe = slapos.cookbook:generate.password
storage-path = ${directory:etc}/.admin_pwd storage-path = ${directory:etc}/.admin_pwd
[instance-parameter] [instance-parameter]
tmp-dir = ${directory:tmp}
trusted-host-list =
\[${apache-php-configuration:ip}\]
${request-frontend:connection-domain}
${slap-parameter:instance.trusted-host}
site-profile = ${slap-parameter:instance.site-profile} site-profile = ${slap-parameter:instance.site-profile}
site-locale = ${slap-parameter:instance.site-locate} site-locale = ${slap-parameter:instance.site-locate}
site-name = ${slap-parameter:instance.site-name} site-name = ${slap-parameter:instance.site-name}
...@@ -59,6 +91,10 @@ site-mail = ${slap-parameter:instance.site-mail} ...@@ -59,6 +91,10 @@ site-mail = ${slap-parameter:instance.site-mail}
account-name = ${slap-parameter:instance.account-name} account-name = ${slap-parameter:instance.account-name}
account-mail = ${slap-parameter:instance.account-mail} account-mail = ${slap-parameter:instance.account-mail}
[publish-connection-information]
admin-username = ${instance-parameter:account-name}
admin-password = ${drupal-admin-passwd:passwd}
[slap-parameter] [slap-parameter]
instance.site-profile = standard instance.site-profile = standard
instance.site-locate = fr instance.site-locate = fr
...@@ -66,3 +102,4 @@ instance.site-name = Drupal SlapOS ...@@ -66,3 +102,4 @@ instance.site-name = Drupal SlapOS
instance.site-mail = admin@example.com instance.site-mail = admin@example.com
instance.account-name = admin instance.account-name = admin
instance.account-mail = admin@example.com instance.account-mail = admin@example.com
instance.trusted-host =
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Parameters to instantiate NextCloud",
"type": "object",
"additionalProperties": false,
"properties": {
"apache-computer-guid": {
"title": "Computer ID for Apache Instance.",
"description": "Unique identifier of the computer, like \"COMP-1234\". By default, let Master choose a computer.",
"type": "string"
},
"mariadb-computer-guid": {
"title": "Computer ID for Mariadb Instance.",
"description": "Unique identifier of the computer, like \"COMP-1234\". By default, let Master choose a computer.",
"type": "string"
},
"instance.site-name": {
"title": "Site Name",
"description": "Drupal site name",
"type": "string"
},
"instance.site-mail": {
"title": "Site Mail",
"description": "Site email address",
"type": "string"
},
"instance.account-mail": {
"title": "Admin Mail",
"description": "Admin email address",
"type": "string"
},
"instance.account-name": {
"title": "Admin username",
"description": "Admin username.",
"type": "string"
}
}
}
<?php
# Warning: This file will be modified by SlapOS!
$settings['trusted_host_patterns'] = [
{% for host in parameter_dict['trusted-host-list'].split('\n') -%}
{% if host.strip() -%}
{{ "'^" ~ host.strip().replace('.', '\.') ~ "$'," }}
{% endif -%}
{% endfor -%}
];
[buildout] [buildout]
extends = extends =
../../component/redis/buildout.cfg
../../component/nodejs/buildout.cfg ../../component/nodejs/buildout.cfg
../../component/python-2.7/buildout.cfg ../../component/python-2.7/buildout.cfg
../../component/pytest/buildout.cfg ../../component/pytest/buildout.cfg
../../component/java-jdk/buildout.cfg
../../stack/lamp/buildout.cfg ../../stack/lamp/buildout.cfg
buildout.hash.cfg buildout.hash.cfg
...@@ -31,7 +29,6 @@ path = ${template-drupal-instance:output} ...@@ -31,7 +29,6 @@ path = ${template-drupal-instance:output}
part-list = drupal-site-install part-list = drupal-site-install
db-name = drupal_db db-name = drupal_db
db-user = drupal db-user = drupal
#default-frontend = False
[composer] [composer]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
...@@ -39,7 +36,7 @@ url = https://getcomposer.org/installer ...@@ -39,7 +36,7 @@ url = https://getcomposer.org/installer
filename = composer-setup.php filename = composer-setup.php
[composer-php.ini] [composer-php.ini]
# A minimal php.ini that will be used to install druplal # A minimal php.ini that will be used for composer
recipe = collective.recipe.template recipe = collective.recipe.template
input = input =
inline:[PHP] inline:[PHP]
...@@ -92,7 +89,7 @@ branch = master ...@@ -92,7 +89,7 @@ branch = master
[install-drupal] [install-drupal]
recipe = slapos.recipe.cmmi recipe = slapos.recipe.cmmi
path = ${application:location} path = ${application:location}
configure-command = true configure-command =true
# ${composer-bin:output} config vendor-dir docroot/vendor # ${composer-bin:output} config vendor-dir docroot/vendor
make-targets = make-targets =
make-options = make-options =
...@@ -113,6 +110,14 @@ context = ...@@ -113,6 +110,14 @@ context =
key php_location apache-php:location key php_location apache-php:location
key mariadb_location mariadb:location key mariadb_location mariadb:location
key nodejs_location nodejs:location key nodejs_location nodejs:location
key template_settings_php template-settings.php:target
key template_settings_local template-settings.local.php:target
[template-settings.php]
<= drupal-download
[template-settings.local.php]
<= drupal-download
[template] [template]
recipe = recipe =
......
{
"name": "Drupal",
"description": "Drupal Software Release",
"serialisation": "xml",
"software-type": {
"default": {
"title": "Default",
"description": "Drupal",
"request": "instance-drupal-input-schema.json",
"response": "instance-drupal-output-schema.json",
"index": 0
}
}
}
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