Drupal portal setup using docker image

I am trying to setup a docker image for Drupal site and integrate with apigee edge so that I can use it in jenkins job so that whenever I do customization in my Drupal portal, get it deployed automatically.  Below is the docker file which I have created

 

 

# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM drupal:8-apache

ARG ADMIN_USER
ARG ADMIN_PASS
ARG DB_URL

# install dependencies
RUN apt-get update
RUN apt-get update && apt-get install -y curl \
  git ranger unzip vim sqlite3 postgresql-client libmagick++-dev \
  libmagickwand-dev libpq-dev libfreetype6-dev \
  libjpeg62-turbo-dev libpng-dev libwebp-dev libxpm-dev
RUN docker-php-ext-configure gd --with-jpeg=/usr/include/ \
  --with-freetype=/usr/include/
RUN docker-php-ext-install gd bcmath

# install and setup drupal tools
RUN echo "memory_limit = -1;" > /usr/local/etc/php/php.ini
WORKDIR /var/www

RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
RUN php composer-setup.php
RUN php -r "unlink('composer-setup.php');"
RUN mv composer.phar /usr/local/bin/composer

#RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
#RUN php composer-setup.php
#RUN rm composer-setup.php
#RUN mv composer.phar /usr/bin/composer

# create project
RUN composer create-project drupal-composer/drupal-project:8.x-dev portal --stability dev --no-interaction

RUN echo "Project Created"

# install dependencies
WORKDIR /var/www/portal
#RUN composer require drupal/apigee_m10n drupal/restui drush/drush:8.*
RUN composer require  drupal/restui drush/drush:8.*
RUN echo "Dependence Updated"
RUN yes | ./vendor/drush/drush/drush init

RUN echo "About configure Apache"
# configure apache
RUN sed -i 's/DocumentRoot .*/DocumentRoot \/var\/www\/portal\/web/' /etc/apache2/sites-available/000-default.conf
RUN mkdir -p /var/www/portal/web/sites/default/files

#COPY ./web /var/www/portal/web

# perform site install
WORKDIR /var/www/portal/web
#RUN ../vendor/drush/drush/drush si apigee_devportal_kickstart --db-url="$DB_URL" --site-name="Apigee Developer Portal" --account-name="$ADMIN_USER" --account-pass="$ADMIN_PASS" --no-interaction
#RUN ../vendor/drush/drush/drush si apigee_devportal_kickstart --db-url="$DB_URL" --site-name="Apigee Developer Portal" --account-name="$ADMIN_USER" --account-pass="$ADMIN_PASS" --no-interaction
# enable dependencies
#RUN yes | ../vendor/drush/drush/drush en rest restui basic_auth

# configure apigee connection credentials from environment variables
#RUN ../vendor/drush/drush/drush config:set key.key.apigee_edge_connection_default key_provider apigee_edge_environment_variables --no-interaction


#RUN yes | ../vendor/drush/drush/drush cim --partial --source=$(pwd)/config
COPY ./modules/apigee_modules ./modules/apigee_modules 
COPY ./core ./core

# set up private filesystem
RUN mkdir -p /var/www/private
RUN usermod -aG root www-data
RUN chmod g+r,g+w /var/www/private
RUN echo "\$settings['file_private_path'] = '/var/www/private';" >> /var/www/portal/web/sites/default/settings.php


# set permissions
WORKDIR /var/www/portal
ADD ./set-permissions.sh ./set-permissions.sh
RUN chmod +x ./set-permissions.sh && ./set-permissions.sh --drupal_path=$(pwd)/web --drupal_user=root --httpd_group=www-data

RUN chmod 777 /var/www/portal/web/sites/default/settings.php



# import configuration files for rest module
WORKDIR /var/www/portal/
ADD ./config ./config
run chmod 777 ./config
#RUN mkdir ./config/sync

 

 

 

After building the image and running the build, I am able to create the developer portal site.  however, Not able to congiure apigee edge related configuration as it is not showing in drupal site.  also If I uncommet the config setting code (

RUN ../vendor/drush/drush/drush config:set key.key.apigee_edge_connection_default key_provider apigee_edge_environment_variables --no-interaction) build is failing.  
 
Can anyone help in identifying the mistake I am doing 

 

0 5 845
5 REPLIES 5

Hi @sheshagiribr 

Please consider to go through Usage section of README at https://github.com/apigee/docker-apigee-drupal-kickstart#usage

Most likely the environment variables are not set and Drupal should be installed while you configure Apigee Edge, that line is commented.

Hi @Former Community Member Thank you for responding.  I had already followed the steps you have mentioned.  Though I have followed the same steps, I am getting the errors during the build. Below is the error I am getting

 

Fetched 100 MB in 2min 0s (838 kB/s)
E: Failed to fetch http://deb.debian.org/debian/pool/main/libx/libxrender/libxrender-dev_0.9.10-1_amd64.deb  Connection failed [IP: 151.101.154.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/libx/libxpm/libxpm-dev_3.5.12-1_amd64.deb  Connection failed [IP: 151.101.154.132 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

 

Also I am getting below error 

Creating a "apigee/devportal-kickstart-project:8.x-dev" project at "./portal"
Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/
Installing apigee/devportal-kickstart-project (8.x-dev 7ee3fdc0cb9c811cb2e12e05e64bbf0b1eae71c3)
  - Installing apigee/devportal-kickstart-project (8.x-dev 7ee3fdc): Cloning 7ee3fdc0cb from cache
Created project in /var/www/portal
Loading composer repositories with package information
Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/
Updating dependencies (including require-dev)
Killed

 

@sheshagiribr 

Instead of installing Drupal core and dependency one by one, you should consider installing Devportal kickstart distribution

composer create-project apigee/devportal-kickstart-project:9.x-dev MY_PROJECT --no-interaction

And have these steps to consider to build your docker file, if you're customizing. In this case, you don't need to Install other dependencies like drush or apigee_m10n separately.

@hirenkumar 

If we use apigee/devportal-kickstart. It will override the changes whenever this docker file is run right.  we need to make some customisation in apigee modules and drupal pages so that we can implement some of our customised requirement.  Also the changes which we are planning to make should get reflected when the build happens

You can customize over and above kickstart as well, which has most required dependencies.

I would recommend you to go with Drupal 9, as that's way forward

You should got with drush version 10 or 9 - https://docs.drush.org/en/8.x/install/#drupal-compatibility