Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Bedrock WordPress apps #134

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ The classic PHP configuration is used as fallback when no framework was detected
This is also used when an `index.php` file was found in the root of your
project and no `composer.json`.

### Bedrock

Is used when the `extra.heroku.framework` key is set to `bedrock` in the `composer.json`.

### Magento

Is used when the `extra.heroku.framework` key is set to `magento` in the `composer.json`.
Expand Down
26 changes: 26 additions & 0 deletions conf/nginx/bedrock.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
root /app/<%= ENV['DOCUMENT_ROOT'] %>;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
index index.php index.html;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|ttf|woff)$ {
access_log off;
}

# Prevent access to dot files
location ~ /\. {
return 404;
}

# allow all php files
# should probably whitelist specific php files
location ~ \.php {
include fastcgi_params;
fastcgi_pass php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_buffers 256 4k;
}
29 changes: 29 additions & 0 deletions frameworks/bedrock
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

BUILD_DIR="$2"
basedir="$( cd -P "$( dirname "$0" )" && pwd )"

function sets_framework_bedrock() {
[ $(jq --raw-output '.extra.heroku.framework' < "$BUILD_DIR/composer.json") == "bedrock" ]
}

case "$1" in
detect)
if [ ! -f "$BUILD_DIR/composer.json" ]; then
exit 1
fi

if sets_framework_bedrock; then
echo "-----> Detected Bedrock WordPress app"
exit 0
else
exit 1
fi
;;
compile)
echo "-----> Setting up Bedrock WordPress app"
cp "$basedir/../conf/nginx/bedrock.conf.erb" "$BUILD_DIR/conf/site.conf.erb"
mkdir -p $BUILD_DIR/web/app/uploads
chmod a+w -R $BUILD_DIR/web/app/uploads
;;
esac