Commit 947699f6 authored by Alain Takoudjou's avatar Alain Takoudjou

Split drupal SR into stack/drupal and software/drupal

parent 098a5e33
Listen {{ parameter_dict['ip'] }}:{{ parameter_dict['node-port'] }}
<VirtualHost *:{{ parameter_dict['node-port'] }}>
ServerAdmin admin@example.com
ServerName example.com
SSLProxyEngine on
SSLProxyCheckPeerCN off
ProxyRequests Off
ProxyPreserveHost on
ProxyPass / http://{{ parameter_dict['node-server'] }}/
ProxyPassReverse / http://{{ parameter_dict['node-server'] }}/
ErrorLog "{{ parameter_dict['log-dir'] }}/nodejs-error.log"
CustomLog "{{ parameter_dict['log-dir'] }}/nodejs-access.log" combined
</VirtualHost>
[buildout]
extends =
../../component/nodejs/buildout.cfg
../../component/pytest/buildout.cfg
../lamp/buildout.cfg
buildout.hash.cfg
parts +=
instance
install-drupal
[apache-php]
<= apache-php8.1
[python-interpreter]
eggs +=
${pytest:eggs}
[drupal-download]
<= template-download-base
url = ${:_profile_base_location_}/${:filename}
[custom-application-deployment]
db-name = drupal_db
db-user = drupal
[create-next-app]
recipe = plone.recipe.command
location = ${buildout:parts-directory}/nextjs
command =
mkdir -p ${:location}
cd ${:location}
${nodejs:location}/bin/npm install create-next-app
stop-on-error = true
[next.js-app]
recipe = plone.recipe.command
location = ${create-next-app:location}/app
command =
cd ${create-next-app:location}
${nodejs:location}/bin/npx create-next-app app --use-npm -e ${:project-url}
stop-on-error = true
[install-drupal]
recipe = slapos.recipe.cmmi
path = ${application:location}
configure-command = true
# ${composer-bin:output} config vendor-dir docroot/vendor
make-targets =
make-options =
make-binary =
${composer-bin:output} install
# ${composer-bin:output} update
${composer-bin:output} require drupal/next
post-install =
mkdir -p drush/config
cp ${pathauto.pattern.article.yml:target} drush/config/
environment =
COMPOSER_HOME=@@LOCATION@@
PATH=${apache-php:location}/bin:%(PATH)s
[template-drupal-instance]
<= drupal-download
[template-settings.php]
<= drupal-download
[template-settings.local.php]
<= drupal-download
[template-drupal-apache.conf]
<= drupal-download
[pathauto.pattern.article.yml]
<= template-download-base
url = ${:_profile_base_location_}/config/${:filename}
# Update stack lamp for drupal
[lamp-instance]
output = ${buildout:directory}/instance-lamp.cfg
[instance]
recipe = slapos.recipe.template:jinja2
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/instance.cfg
extensions = jinja2.ext.do
context =
key buildout_egg_directory buildout:eggs-directory
key buildout_develop_directory buildout:develop-eggs-directory
key buildout_directory buildout:directory
key template_instance_drupal template-drupal-instance:target
key instance_lamp lamp-instance:output
key composer_location composer:location
key php_location apache-php:location
key mariadb_location mariadb:location
key nodejs_location nodejs:location
key nextjs_app_location next.js-app:location
key template_apache_conf template-drupal-apache.conf:target
key template_settings_php template-settings.php:target
key template_settings_local template-settings.local.php:target
[instance]
filename = instance.cfg.in
md5sum = 158282e578bf9416f5e0e524496b9f68
[template-drupal-instance]
filename = drupal-instance.cfg.in
md5sum = cb6606a18968396236699876e55d6269
[template-settings.php]
filename = default.settings.php.in
md5sum = ef6369e834d774dfaeedc993d70aa98f
[template-settings.local.php]
filename = settings.local.php.in
md5sum = 2692b85c568694c618255095ecea11c5
[template-drupal-apache.conf]
filename = apache.conf.in
md5sum = fa1d986228151256cacab67037ce4bfc
[pathauto.pattern.article.yml]
filename = pathauto.pattern.article.yml
md5sum = 92bea34b59f3493336eb593c8957fdc9
uuid: 45442741-d3b7-4aa6-9a19-35b61af63a15
langcode: fr
status: true
dependencies:
module:
- node
id: article
label: Article
type: 'canonical_entities:node'
pattern: 'blog/[node:title]'
selection_criteria:
c58c9f1d-ff1f-458b-8f26-6d3a3f015289:
id: 'entity_bundle:node'
negate: false
uuid: c58c9f1d-ff1f-458b-8f26-6d3a3f015289
context_mapping:
node: node
bundles:
article: article
selection_logic: and
weight: -5
relationships: { }
<?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';
}
[buildout]
extends =
{{ template_monitor }}
{{ logrotate_cfg }}
{{ nxdtest_template }}
{{ templace_apache_php }}
parts +=
drupal-site-install
next-server
proxy-apache-httpd
promise-next-server
nextjs-frontend-promise
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
[apache-php-configuration]
enable-php8 = !py!True
document-root = ${:default-document-root}/docroot
node-port = 8000
node-server = ${next-server:host}:${next-server:port}
[directory]
node = ${:srv}/node
[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]
recipe = slapos.cookbook:wrapper
command-line =
${php-bin:wrapper-path} ${directory:www}/vendor/drush/drush/drush
wrapper-path = ${directory:bin}/drush
[composer-bin]
recipe = slapos.cookbook:wrapper
command-line =
${php-bin:wrapper-path} {{ composer_location }}/bin/composer-bin
wrapper-path = ${directory:bin}/composer
[blt-bin]
recipe = slapos.cookbook:wrapper
command-line =
${php-bin:wrapper-path} ${directory:www}/vendor/vendor/bin/blt
wrapper-path = ${directory:bin}/blt
[env-base]
recipe = collective.recipe.template
input = inline:
${:env}
output = ${directory:etc}/.${:env-name}.env
mode = 600
[drupal-env]
<= env-base
env =
export DRUPAL_PROFILE=${instance-parameter:site-profile}
export LOCALE=${instance-parameter:site-locale}
export DB_URL=${mariadb-urlparse:url}
export SITE_NAME="${instance-parameter:site-name}"
export SITE_MAIL=${instance-parameter:site-mail}
export ACCOUNT_NAME="${instance-parameter:account-name}"
export ACCOUNT_MAIL=${instance-parameter:account-mail}
export ACCOUNT_PASS=${drupal-admin-passwd:passwd}
export PATH={{ mariadb_location }}/bin:${directory:bin}:$PATH
env-name = site
[next-env]
<= env-base
env =
export PATH={{ nodejs_location }}/bin:$PATH
export NEXT_PUBLIC_DRUPAL_BASE_URL=${request-frontend:connection-secure_access}
export NEXT_IMAGE_DOMAIN=${request-frontend:connection-domain}
export DRUPAL_PREVIEW_SECRET=
export DRUPAL_REVALIDATE_SECRET=
export DRUPAL_SITE_ID=
export DRUPAL_FRONT_PAGE=
## Authentication (Bearer)
#export DRUPAL_CLIENT_ID=
#export DRUPAL_CLIENT_SECRET=
#
## Authentication (Basic)
#export DRUPAL_USERNAME=
#export DRUPAL_PASSWORD=
env-name = next
[build-next]
recipe = plone.recipe.command
command = if [ -z "$(ls -A ${directory:node})" ]; then
rm -rf ${directory:node};
cp -ax {{ nextjs_app_location }}/ ${directory:node};
fi
if [ -s "${directory:var}/.install-done" ]; then
# build next.js require next and next_jsonapi installed
export NEXT_PUBLIC_DRUPAL_BASE_URL=${request-frontend:connection-secure_access}
export NEXT_IMAGE_DOMAIN=${request-frontend:connection-domain}
cd ${directory:node}
{{ nodejs_location }}/bin/npm run build
fi
update-command = ${:command}
# Start next.js server
[next-server-script]
output = ${directory:bin}/next.js-server
recipe = collective.recipe.template
mode = 744
input = inline:#!/bin/sh
. ${next-env:output}
cd ${directory:node}
npx next start "$@"
depends = ${build-next:recipe}
[next-server]
recipe = slapos.cookbook:wrapper
command-line =
${next-server-script:output} -p ${:port} -H ${:host}
wrapper-path = ${directory:services}/next.js-server
port = 3001
# Cannot listen on Ipv6
host = ${apache-network-configuration:listening-ip4}
wait-for-files =
${directory:var}/.install-done
[promise-next-server]
# Check any apache port in ipv4, expect other ports and ipv6 to behave consistently
<= monitor-promise-base
promise = check_socket_listening
name = nextjs-server-port-listening.py
config-host = ${next-server:host}
config-port = ${next-server:port}
[drupal-site-install]
output = ${directory:scripts}/drupal-install
recipe = collective.recipe.template
input = inline:#!/bin/sh
set -e
CONFIG_FILE=${directory:www}/docroot/sites/default/settings.php
INSTALL_FILE=${directory:var}/.install-done
if [ -s "$INSTALL_FILE" ]; then
echo "Drupal is installed."
exit 0;
fi
. ${drupal-env:output}
if [ ! -s "$CONFIG_FILE" ]; then
cp ${settings.php:output} $CONFIG_FILE
fi
drush site:install $DRUPAL_PROFILE \
--locale=$LOCALE \
--db-url=$DB_URL \
--site-name="$SITE_NAME" \
--site-mail=$SITE_MAIL \
--account-name="$ACCOUNT_NAME" \
--account-mail=$ACCOUNT_MAIL \
--account-pass=$ACCOUNT_PASS \
--verbose --yes
# Rebuild all caches.
drush cache:rebuild
# install modules Next.js and Next.js JSON:API
drush en next next_jsonapi --verbose --yes
# install drush configs
drush config-import --strict=0 --partial \
--source=${directory:www}/drush/config \
--uri=default --root=${directory:www} \
--verbose --yes
drush cache:rebuild
echo "done" > $INSTALL_FILE
chmod 440 $INSTALL_FILE
mode = 744
depends =
${settings.php:recipe}
${settings.local.php:recipe}
${composer-bin:recipe}
${drush-bin:recipe}
[drupal-admin-passwd]
recipe = slapos.cookbook:generate.password
storage-path = ${directory:etc}/.admin_pwd
[proxy-apache-httpd]
recipe = slapos.recipe.template:jinja2
url = {{ template_apache_conf }}
output = ${directory:apache.d}/apache-drupal.conf
context =
section parameter_dict apache-php-configuration
[request-nextjs-frontend]
<= slap-connection
recipe = slapos.cookbook:requestoptional
name = Next.js Frontend
# XXX We have hardcoded SR URL here.
software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
shared = true
config-url = https://[${apache-php-configuration:ip}]:${apache-php-configuration:node-port}
config-https-only = true
return = domain secure_access
[nextjs-frontend-promise]
<= monitor-promise-base
promise = check_url_available
name = nextjs-server-frontend.py
config-url = ${request-nextjs-frontend:connection-secure_access}
[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-locale = ${slap-parameter:instance.site-locate}
site-name = ${slap-parameter:instance.site-name}
site-mail = ${slap-parameter:instance.site-mail}
account-name = ${slap-parameter:instance.account-name}
account-mail = ${slap-parameter:instance.account-mail}
[publish-connection-information]
admin-username = ${instance-parameter:account-name}
admin-password = ${drupal-admin-passwd:passwd}
nextjs-url = ${request-nextjs-frontend:connection-secure_access}
[slap-parameter]
instance.site-profile = standard
instance.site-locate = fr
instance.site-name = Drupal SlapOS
instance.site-mail = admin@example.com
instance.account-name = admin
instance.account-mail = admin@example.com
instance.trusted-host =
[buildout]
extends =
{{ instance_lamp }}
parts =
switch_softwaretype
[switch_softwaretype]
apache = dynamic-template-drupal:output
eggs-directory = {{ buildout_egg_directory }}
develop-eggs-directory = {{ buildout_develop_directory }}
offline = true
[dynamic-template-drupal-parameters]
# Additional parameters for instance apache-php
[dynamic-template-drupal]
<= jinja2-template-base
url = {{ template_instance_drupal }}
filename = template-drupal.cfg
extra-context =
section parameter_dict dynamic-template-drupal-parameters
key templace_apache_php dynamic-template-apache-php:output
key mariadb_location dynamic-template-mariadb-parameters:mariadb-location
raw composer_location {{ composer_location }}
raw php_location {{ php_location }}
raw nodejs_location {{ nodejs_location }}
raw nextjs_app_location {{ nextjs_app_location }}
raw template_apache_conf {{ template_apache_conf }}
raw template_settings_php {{ template_settings_php }}
raw template_settings_local {{ template_settings_local }}
<?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 -%}
];
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