Commit d0560381 authored by Alain Takoudjou's avatar Alain Takoudjou

software/drupal: use drupal stack now

parent 947699f6
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>
[template-drupal-instance]
filename = drupal-instance.cfg.in
md5sum = 3df0d11d328701ae3e45387efa72a4de
[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';
}
[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 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}
stop-on-error = true
# Start next.js server
[next-server]
output = ${directory:services}/next.js-server
recipe = collective.recipe.template
mode = 744
input = inline:#!/bin/sh
. ${next-env:output}
export PATH={{ nodejs_location }}/bin:$PATH
cd ${directory:node}
npx next start -p ${:port} -H ${:host}
port = 3001
# Cannot listen on Ipv6
host = ${apache-network-configuration:listening-ip4}
depends = ${build-next:recipe}
[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}
${next-server:recipe}
${proxy-apache-httpd: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
[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 =
<?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/nodejs/buildout.cfg ../../stack/drupal/buildout.cfg
../../component/python-2.7/buildout.cfg
../../component/pytest/buildout.cfg
../../stack/lamp/buildout.cfg
buildout.hash.cfg
parts +=
composer-setup
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]
path = ${template-drupal-instance:output}
part-list = drupal-site-install
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] [next.js-app]
recipe = plone.recipe.command # next.js project repository
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
project-url = https://github.com/chapter-three/next-drupal-basic-starter project-url = https://github.com/chapter-three/next-drupal-basic-starter
# Download drupal composer # Download drupal composer
...@@ -50,50 +11,4 @@ project-url = https://github.com/chapter-three/next-drupal-basic-starter ...@@ -50,50 +11,4 @@ project-url = https://github.com/chapter-three/next-drupal-basic-starter
recipe = slapos.recipe.build:gitclone recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git git-executable = ${git:location}/bin/git
repository = https://lab.nexedi.com/alain.takoudjou/drupal-composer.git repository = https://lab.nexedi.com/alain.takoudjou/drupal-composer.git
branch = master branch = master
\ No newline at end of file
[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]
recipe = slapos.recipe.template:jinja2
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/instance-drupal.cfg
extensions = jinja2.ext.do
context =
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
[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}
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