This repository has been archived by the owner on Feb 13, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
374eab3
commit 4a5f486
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Example Scripts for Drupal VM | ||
|
||
## Post-Provision Scripts | ||
|
||
Drupal VM allows you to run extra shell scripts at the end of the provisioning process, in case you need to do extra custom setup, configure your environment, or install extra software outside the purview of Drupal VM. | ||
|
||
To use an extra script, configure the path to the script (relative to `provisioning/playbook.yml`) in `config.yml`: | ||
|
||
```yaml | ||
post_provision_scripts: | ||
- "../examples/post-provision.sh" | ||
``` | ||
The above example results in the example `post-provision.sh` script running after the main Drupal VM setup is complete. Note that this script would run _every_ time you provision the environment (e.g. once when you run `vagrant up`, then again every time you run `vagrant provision` again). | ||
|
||
You can define as many scripts as you would like, and any arguments after the path will be passed to the shell script itself (e.g. `"../examples/post-provision.sh --option"`). | ||
|
||
Generally, you should place your post-provision scripts inside a `scripts` directory in the root of your Drupal VM project directory; this directory is gitignored, so you can continue to update Drupal VM without accidentally overwriting your scripts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
# | ||
# Example shell script to run post-provisioning. | ||
# | ||
# This script configures the default Apache Solr search core to use one of the | ||
# Drupal Solr module's configurations. This shell script presumes you have | ||
# `solr` in the `installed_extras`, and is currently set up for the D7 versions | ||
# of Apache Solr Search or Search API Solr. | ||
|
||
SOLR_SETUP_COMPLETE_FILE=/etc/drupal_vm_solr_config_complete | ||
|
||
# Search API Solr module. | ||
SOLR_DOWNLOAD=http://ftp.drupal.org/files/projects/search_api_solr-8.x-1.x-dev.tar.gz | ||
SOLR_DOWNLOAD_DIR=/tmp | ||
SOLR_MODULE_NAME=search_api_solr | ||
|
||
# Check to see if we've already performed this setup. | ||
if [ ! -e "$SOLR_SETUP_COMPLETE_FILE" ]; then | ||
# Download and expand the Solr module. | ||
wget -qO- $SOLR_DOWNLOAD | tar xvz -C $SOLR_DOWNLOAD_DIR | ||
|
||
# Copy the Solr configuration into place over the default `collection1` core. | ||
sudo cp -a $SOLR_DOWNLOAD_DIR/$SOLR_MODULE_NAME/solr-conf/4.x/. /var/solr/collection1/conf/ | ||
|
||
# Fix file permissions. | ||
sudo chown -R solr:solr /var/solr/collection1/conf | ||
|
||
# Restart Apache Solr. | ||
sudo service solr restart | ||
|
||
# Create a file to indicate this script has already run. | ||
sudo touch $SOLR_SETUP_COMPLETE_FILE | ||
else | ||
exit 0 | ||
fi |