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

Updates to support PHP on current dokku #2

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ebfe9ee
Debug messages
drmikecrowe Sep 28, 2014
f2758b5
Enabling debug
drmikecrowe Sep 28, 2014
00cf93c
Making /root/bin directory before downloading jq
drmikecrowe Sep 28, 2014
9212102
Disabling debug debug
drmikecrowe Sep 28, 2014
4a39553
Reverting debug message change -- needed to enable in buildpack.conf …
drmikecrowe Sep 28, 2014
3b36c4c
Enabling debug
drmikecrowe Sep 28, 2014
c242fdd
Adding cmsmadesimple
drmikecrowe Sep 28, 2014
5175a76
Adding cmsmadesimple
drmikecrowe Sep 28, 2014
e4795d7
Removing cmsmadesimple
drmikecrowe Sep 28, 2014
4c690a3
Test -- trying to create temporary directories in run script
drmikecrowe Sep 28, 2014
9cd9bde
Test -- trying to create temporary directories in run script
drmikecrowe Sep 28, 2014
fe2ee04
Running php-fpm as dokku
drmikecrowe Sep 28, 2014
4c75db5
Increasing types_hash_max_size 2048 in nginx.conf
drmikecrowe Sep 29, 2014
3ad0ad5
Making log directories writable
drmikecrowe Oct 2, 2014
ee189c5
Making log directories writable
drmikecrowe Oct 2, 2014
c93af17
Merge branch 'master' of github.com:drmikecrowe/dokku-buildpack-php
drmikecrowe Oct 2, 2014
c939297
Merge branch 'master' of github.com:drmikecrowe/dokku-buildpack-php
drmikecrowe Oct 2, 2014
30adf6b
Merge branch 'master' of github.com:drmikecrowe/dokku-buildpack-php
drmikecrowe Oct 2, 2014
eb0b530
More log changes
drmikecrowe Oct 2, 2014
fafa3da
More log changes
drmikecrowe Oct 2, 2014
ee172a4
Moving logfile location for pipe
drmikecrowe Oct 3, 2014
6d66c95
Reverting my changes to test new lxc
drmikecrowe Oct 3, 2014
6adb78e
Reverting my changes to test new lxc
drmikecrowe Oct 3, 2014
fe01f33
Putting custom above site.conf
drmikecrowe Oct 3, 2014
d77b954
Tweaking logs
drmikecrowe Oct 3, 2014
e4fce0e
Tweaking logs
drmikecrowe Oct 3, 2014
cbc3de4
Tweaking logs
drmikecrowe Oct 3, 2014
d049dc7
Tweaking logs
drmikecrowe Oct 3, 2014
eb1968a
Tweaking logs
drmikecrowe Oct 3, 2014
3a86e58
Tweaking logs
drmikecrowe Oct 3, 2014
da845dd
Changing upload dir to 777 permissions
drmikecrowe Oct 5, 2014
ec5f58b
Changing upload dir to 777 permissions
drmikecrowe Oct 5, 2014
8537877
Fixing redirect to port :5000
drmikecrowe Oct 11, 2014
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
22 changes: 19 additions & 3 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,12 @@ function package_newrelic_enabled() {

export_env_dir "$3"

# Create dokku user so volumes can be read/write
#useradd -b /app/web -s /dev/null -u 1000 -U dokku

# Download jq binary for JSON processing
export PATH="$HOME/bin:$PATH"
mkdir -p $HOME/bin
curl "http://${S3_BUCKET}.s3.amazonaws.com/jq/jq" -L -s -o - > "$HOME/bin/jq"
chmod +x "$HOME/bin/jq"

Expand All @@ -261,7 +265,7 @@ PHP_INCLUDES=
COMPILE_CMD=
NGINX_INCLUDES=
NEWRELIC_VERSION=4.4.5.35
LOG_FILES=( "/app/vendor/nginx/logs/access.log" "/app/vendor/nginx/logs/error.log" "/app/vendor/php/var/log/error.log" )
LOG_FILES=( "/app/vendor/nginx/logs/access.log" "/app/vendor/nginx/logs/error.log" "/app/vendor/php/var/log/php-error.log" )

# Read config variables from composer.json if it exists
if [ -f "$BUILD_DIR/composer.json" ]; then
Expand Down Expand Up @@ -393,6 +397,11 @@ if [ -n "$FRAMEWORK" ] && [ -f "$FRAMEWORK" ]; then
LOG_FILES=$(unique_array ${LOG_FILES[@]} ${FRAMEWORK_LOG_FILES[@]})
fi

# for d in ${LOG_FILES[@]}; do
# chown dokku `dirname $d`
# chmod 777 `dirname $d`
# done

if [ -n "$COMPILE_CMD" ]; then
status "Running compile commands"
while read -r cmd; do
Expand Down Expand Up @@ -430,15 +439,22 @@ export DOCUMENT_ROOT="$DOCUMENT_ROOT"
export INDEX_DOCUMENT="$INDEX_DOCUMENT"
export NGINX_INCLUDES="$NGINX_INCLUDES"

if [[ ! -d /app/logs ]]; then
mkdir /app/logs
fi
chmod 777 -R /app/logs
find /app/web/uploads -type d -exec chmod 777 {} \;
find /app/web/tmp -type d -exec chmod 777 {} \;

if [ -n "\$NEW_RELIC_LICENSE_KEY" ]; then
echo "newrelic.license=\"\$NEW_RELIC_LICENSE_KEY\"" > /app/vendor/php/etc/conf.d/newrelic_license.ini
fi

erb conf/nginx.conf.erb > /app/vendor/nginx/conf/nginx.conf
erb conf/site.conf.erb > /app/vendor/nginx/conf/site.conf

`init_log_plex_fifo ${LOG_FILES}`
`tail_log_plex ${LOG_FILES} ${SYS_LOG_FILES}`
# `init_log_plex_fifo ${LOG_FILES}`
# `tail_log_plex ${LOG_FILES} ${SYS_LOG_FILES}`

(
exec php-fpm -p "/app/vendor/php"
Expand Down
12 changes: 8 additions & 4 deletions conf/nginx/base.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ http {

keepalive_timeout 65;

error_log logs/error.log notice;
access_log logs/access.log;
error_log /app/logs/error.log notice;
access_log /app/logs/access.log;

rewrite_log on;

types_hash_max_size 2048;

client_max_body_size 100m;
client_body_timeout 600s;
Expand Down Expand Up @@ -68,10 +72,10 @@ http {
#Specify a charset
charset utf-8;

include site.conf;

<% Shellwords.split(ENV['NGINX_INCLUDES'].to_s).each do |f| %>
include /app/<%= f %>;
<% end %>

include site.conf;
}
}
2 changes: 2 additions & 0 deletions conf/nginx/default_site.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ root /app/<%= ENV['DOCUMENT_ROOT'] %>;

location ~ \.php {
include fastcgi_params;
fastcgi_param SERVER_PORT 80;
fastcgi_param SERVER_NAME $http_host;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass php;
fastcgi_buffers 256 4k;
Expand Down
2 changes: 1 addition & 1 deletion conf/php/php-fpm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
; If it's set to "syslog", log is sent to syslogd instead of being written
; in a local file.
; Default Value: log/php-fpm.log
error_log = var/log/error.log
error_log = /app/logs/php-error.log

; syslog_facility is used to specify what type of program is logging the
; message. This lets syslogd specify that messages from different facilities
Expand Down