Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .platform/hooks/postdeploy/01_permission_adjust.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

# We need to expose these environment variables to webapp user
# for being able to access to the database.
sudo chmod 644 /opt/elasticbeanstalk/deployment/env

# Make sure Drupal files are symlinked and
# have proper ownership.
if [[ ! -e /var/www/html/web/sites/default/files ]];
then
sudo ln -s /drupalfiles /var/www/html/web/sites/default/files
fi
sudo chown -R webapp /drupalfiles/*
sudo chgrp -R webapp /drupalfiles/*
36 changes: 36 additions & 0 deletions .platform/hooks/postdeploy/02_drupal_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -e

# The Apache webserver runs as webapp, so we need to execute
# the deploy procedure with that user, otherwise we might create
# inacessible files under sites/default/files .
# By default, we login using `ec2-user`.
if [ "$(whoami)" != "webapp" ]; then
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
sudo -uwebapp "$SCRIPTPATH/02_drupal_deploy.sh"
exit 0
fi

date

export $(cat /opt/elasticbeanstalk/deployment/env | xargs)

if ! grep -q elasticbeanstalk "$HOME/.bashrc"; then
echo 'export $(cat /opt/elasticbeanstalk/deployment/env | xargs)' >> "$HOME/.bashrc"
fi

source "$HOME/.bashrc"

cd /var/www/html || exit 1
DRUSH="./vendor/bin/drush"
$DRUSH updb --no-interaction
$DRUSH cr
$DRUSH cim --no-interaction
$DRUSH cim --no-interaction
$DRUSH cr
$DRUSH cr
# Uncomment this if you use Search API
# $DRUSH sapi-c
# $DRUSH sapi-i

date