Skip to content
Snippets Groups Projects
Commit e593832d authored by Konstantinos Samaras-Tsakiris's avatar Konstantinos Samaras-Tsakiris
Browse files

Merge branch 'release-ci' into 'master'

Release ci

See merge request !8
parents a4aa83db 5b4cd3c7
Branches
Tags
1 merge request!8Release ci
Pipeline #2659476 passed
stages:
- build
nginx:
stage: build
image:
# We recommend using the CERN version of the Kaniko image: gitlab-registry.cern.ch/ci-tools/docker-image-builder
name: gitlab-registry.cern.ch/ci-tools/docker-image-builder
entrypoint: [""]
script:
- |
if [[ "$CI_COMMIT_BRANCH" == "v"* ]] ; then
export DATE=`date -u +%Y.%m.%dT%H-%M-%SZ`
export TAG=${TAG:-"RELEASE".$DATE}
else
export TAG=$CI_COMMIT_SHORT_SHA
fi
- wget --no-check-certificate https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64 -O /yq && chmod +x /yq
- export softwareVersions=$CI_PROJECT_DIR/images/softwareVersions
- export nginxVersion=`/yq e .nginx $softwareVersions`
# This is not the common Authentication config, unknown reason why common config fails
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n ${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD} | base64)\"}}}" > /kaniko/.docker/config.json
# Image builder for nginx
- /kaniko/executor --context "$CI_PROJECT_DIR/images/nginx" --dockerfile "$CI_PROJECT_DIR/images/nginx/Dockerfile"
--destination ${CI_REGISTRY_IMAGE}/nginx:${CI_COMMIT_BRANCH}-${TAG}
--build-arg NGINX_VERSION=\$nginxVersion;
- echo "Nginx image pushed to ${CI_REGISTRY_IMAGE}/nginx:${CI_COMMIT_BRANCH}-${TAG}"
sitebuilder:
stage: build
image:
# We recommend using the CERN version of the Kaniko image: gitlab-registry.cern.ch/ci-tools/docker-image-builder
name: gitlab-registry.cern.ch/ci-tools/docker-image-builder
entrypoint: [""]
script:
- |
if [[ "$CI_COMMIT_BRANCH" == "v"* ]]; then
export DATE=`date -u +%Y.%m.%dT%H-%M-%SZ`
export TAG=${TAG:-"RELEASE".$DATE}
else
export TAG=$CI_COMMIT_SHORT_SHA
fi
- wget --no-check-certificate https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64 -O /yq && chmod +x /yq
- export softwareVersions=$CI_PROJECT_DIR/images/softwareVersions
- export phpVersion=`/yq e .php $softwareVersions`
- export composerVersion=`/yq e .composer $softwareVersions`
- export drushVersion=`/yq e .drush $softwareVersions`
# This is not the common Authentication config, unknown reason why common config fails
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n ${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD} | base64)\"}}}" > /kaniko/.docker/config.json
# Image builder for Site-Builder
- /kaniko/executor --context "$CI_PROJECT_DIR/images" --dockerfile "$CI_PROJECT_DIR/images/Dockerfile"
--destination ${CI_REGISTRY_IMAGE}/site-builder:${CI_COMMIT_BRANCH}-${TAG}
--build-arg PHP_VERSION=$phpVersion --build-arg COMPOSER_VERSION=$composerVersion --build-arg DRUSH_VERSION=$drushVersion;
- echo "SiteBuilder image pushed to ${CI_REGISTRY_IMAGE}/site-builder:${CI_COMMIT_BRANCH}-${TAG}"
......@@ -86,7 +86,6 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin -
# RUN composer clearcache; composer require drush/drush ${DRUSH_VERSION}; composer install;
# ENV PATH=$PATH:/tmp/drush/vendor/bin
COPY ./s2i/bin/ ./hooks/ /usr/libexec/s2i/
COPY ./php-fpm/fix-permissions /fix-permissions
RUN chmod -R +x /usr/libexec/s2i/; \
chmod +x /fix-permissions
......@@ -101,7 +100,7 @@ ENV DRUPAL_APP_DIR /app
ENV DRUPAL_OPERATIONS_DIR /operations
# The following folders are copied from the CI environment during image build
COPY cern-drupal-distribution ${DRUPAL_APP_DIR}
COPY ../../cern-drupal-distribution ${DRUPAL_APP_DIR}
# Add scripts for Drupal operations
COPY drupal-operations-scripts ${DRUPAL_OPERATIONS_DIR}
RUN chmod +x ${DRUPAL_OPERATIONS_DIR}/*
......@@ -137,7 +136,7 @@ RUN ln -s ${DRUPAL_APP_DIR}/web/profiles/contrib/cern-install-profiles/cern ${DR
# post-update-cmd: DrupalProject\composer\ScriptHandler::createRequiredFiles
# Overwrite settings.php with ours.
# - settings.php
ADD ./configuration/sitebuilder/settings.php ${DRUPAL_APP_DIR}/web/sites/default/settings.php
ADD ./settings.php ${DRUPAL_APP_DIR}/web/sites/default/settings.php
# Remove ${DRUPAL_APP_DIR}/web/sites/default/{files, private, modules, themes}, preparing it to be symbolic link;
RUN rm -rf ${DRUPAL_APP_DIR}/web/sites/default/files; \
rm -rf ${DRUPAL_APP_DIR}/web/sites/default/private; \
......
<?php
// @codingStandardsIgnoreFile
// Database settings.
$databases['default']['default'] = [
'host' => getenv('dbHost'),
'port' => getenv('dbPort'),
'database' => getenv('dbName'),
'username' => getenv('dbUser'),
'password' => getenv('dbPassword'),
'namespace' => 'Drupal\Core\Database\Driver\mysql',
'driver' => 'mysql',
'prefix' => '',
'collation' => 'utf8mb4_general_ci',
];
// Location of the site configuration files.
$settings['config_sync_directory'] = '../config/sync';
// Configure file paths
// Private file paths.
$settings['file_private_path'] = getenv('DRUPAL_SHARED_VOLUME') . '/private';
// Configure tmp folder
$settings['file_temp_path'] = '/tmp';
// Configure feeds tmp folder
// Fix: https://www.drupal.org/project/feeds/issues/2912130
if (isset($config['system.file']) && !is_null($config['system.file']['path']['temporary']))
{
$config['system.file']['path']['temporary'] = getenv('DRUPAL_SHARED_VOLUME') . "/private/feeds/tmp";
}
// Config trusted host pattern
$trusted_host_pattern="^". str_replace(".","\.",getenv('HOSTNAME')) . "$";
$settings['trusted_host_patterns'] = [ '.*' ];
// Salt for one-time login links, cancel links, form tokens, etc.
$settings['hash_salt'] = hash("sha256",getenv('dbName') . getenv('dbUser') . getenv('dbPasswordgit '));
/**
* Load services definition file.
*/
$settings['container_yamls'][] = $app_root . '/' . $site_path . '/services.yml';
/**
* The default list of directories that will be ignored by Drupal's file API.
*
* By default ignore node_modules folders to avoid issues
* with common frontend tools and recursive scanning of directories looking for
* extensions.
*
* @see file_scan_directory()
* @see \Drupal\Core\Extension\ExtensionDiscovery::scanDirectory()
*/
$settings['file_scan_ignore_directories'] = [
'node_modules',
];
/**
* Redis Configuration.
* @See https://pantheon.io/docs/redis/ > No Keys Found
* @See also https://gist.github.com/keopx/7d5fe4d7a890c792c43bb79cf56718e0
* @ See also https://docs.platform.sh/frameworks/drupal8/redis.html
*/
if (extension_loaded('redis')) {
// Set Redis as the default backend for any cache bin not otherwise specified.
$settings['cache']['default'] = 'cache.backend.redis';
$settings['redis.connection']['interface'] = 'PhpRedis';
$settings['redis.connection']['host'] = 'redis.' . getenv('NAMESPACE') . '.svc.cluster.local';
$settings['redis.connection']['port'] = getenv('REDIS_SERVICE_PORT');
// Allow the services to work before the Redis module itself is enabled.
$settings['container_yamls'][] = 'modules/contrib/redis/redis.services.yml';
// Manually add the classloader path, this is required for the container cache bin definition below
// and allows to use it without the redis module being enabled.
$class_loader->addPsr4('Drupal\\redis\\', 'modules/contrib/redis/src');
// Use redis for container cache.
// The container cache is used to load the container definition itself, and
// thus any configuration stored in the container itself is not available
// yet. These lines force the container cache to use Redis rather than the
// default SQL cache.
$settings['bootstrap_container_definition'] = [
'parameters' => [],
'services' => [
'redis.factory' => [
'class' => 'Drupal\redis\ClientFactory',
],
'cache.backend.redis' => [
'class' => 'Drupal\redis\Cache\CacheBackendFactory',
'arguments' => ['@redis.factory', '@cache_tags_provider.container', '@serialization.phpserialize'],
],
'cache.container' => [
'class' => '\Drupal\redis\Cache\PhpRedis',
'factory' => ['@cache.backend.redis', 'get'],
'arguments' => ['container'],
],
'cache_tags_provider.container' => [
'class' => 'Drupal\redis\Cache\RedisCacheTagsChecksum',
'arguments' => ['@redis.factory'],
],
'serialization.phpserialize' => [
'class' => 'Drupal\Component\Serialization\PhpSerialize',
],
],
];
/** Optional prefix for cache entries */
$settings['cache_prefix'] = getenv('NAMESPACE');
/** @see: https://pantheon.io/docs/redis/ */
// Always set the fast backend for bootstrap, discover and config, otherwise
// this gets lost when redis is enabled.
$settings['cache']['bins']['bootstrap'] = 'cache.backend.chainedfast';
$settings['cache']['bins']['discovery'] = 'cache.backend.chainedfast';
$settings['cache']['bins']['config'] = 'cache.backend.chainedfast';
/** @see: https://github.com/md-systems/redis */
// Use for all bins otherwise specified.
$settings['cache']['default'] = 'cache.backend.redis';
// Use this to only use it for specific cache bins.
$settings['cache']['bins']['render'] = 'cache.backend.redis';
// Use for all queues unless otherwise specified for a specific queue.
$settings['queue_default'] = 'queue.redis';
// Or if you want to use reliable queue implementation.
$settings['queue_default'] = 'queue.redis_reliable';
// Use this to only use Redis for a specific queue (aggregator_feeds in this case).
$settings['queue_service_aggregator_feeds'] = 'queue.redis';
// Or if you want to use reliable queue implementation.
$settings['queue_service_aggregator_feeds'] = 'queue.redis_reliable';
}
/**
* Load local development override configuration, if available.
*
* Use settings.local.php to override variables on secondary (staging,
* development, etc) installations of this site. Typically used to disable
* caching, JavaScript/CSS compression, re-routing of outgoing emails, and
* other things that should not happen on development and testing sites.
*
* Keep this code block at the end of this file to take full effect.
*/
if (getenv('ENVIRONMENT') != 'production' && file_exists($app_root . '/' . $site_path . '/settings.' . getenv('ENVIRONMENT') . '.php')) {
include $app_root . '/' . $site_path . '/settings.' . getenv('ENVIRONMENT') . '.php';
}
// These settings fix https://gitlab.cern.ch/webservices/webframeworks-planning/-/issues/271
// with the patch from https://www.drupal.org/project/drupal/issues/2833539#comment-12574515
// See: https://www.drupal.org/project/drupal/issues/1650930
// if ($db_driver === 'mysql') {
// $databases['default']['default']['init_commands']['isolation'] = "SET SESSION tx_isolation='READ-COMMITTED'";
$databases['default']['default']['init_commands']['lock_wait_timeout'] = "SET SESSION innodb_lock_wait_timeout = 20";
$databases['default']['default']['init_commands']['wait_timeout'] = "SET SESSION wait_timeout = 600";
// }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment