-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Version v2.3.0-RC2 * fix DB connect test message (#87) * Rename docker dir to conf, closes #85 * Backport recent image changes to master
- Loading branch information
Showing
9 changed files
with
239 additions
and
8 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
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,26 @@ | ||
APP_ENV="{{APP_ENV}}" | ||
APP_DEBUG="{{APP_DEBUG}}" | ||
APP_URL="{{APP_URL}}" | ||
APP_KEY={{APP_KEY}} | ||
|
||
DB_DRIVER="{{DB_DRIVER}}" | ||
DB_HOST="{{DB_HOST}}" | ||
DB_DATABASE="{{DB_DATABASE}}" | ||
DB_USERNAME="{{DB_USERNAME}}" | ||
DB_PASSWORD="{{DB_PASSWORD}}" | ||
|
||
CACHE_DRIVER="{{CACHE_DRIVER}}" | ||
SESSION_DRIVER="{{SESSION_DRIVER}}" | ||
QUEUE_DRIVER="{{QUEUE_DRIVER}}" | ||
|
||
MAIL_DRIVER="{{MAIL_DRIVER}}" | ||
MAIL_HOST="{{MAIL_HOST}}" | ||
MAIL_PORT="{{MAIL_PORT}}" | ||
MAIL_USERNAME="{{MAIL_USERNAME}}" | ||
MAIL_PASSWORD="{{MAIL_PASSWORD}}" | ||
MAIL_ADDRESS="{{MAIL_ADDRESS}}" | ||
MAIL_NAME="{{MAIL_NAME}}" | ||
|
||
REDIS_HOST="{{REDIS_HOST}}" | ||
REDIS_DATABASE="{{REDIS_DATABASE}}" | ||
REDIS_PORT="{{REDIS_PORT}}" |
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,2 @@ | ||
#minute hour mday month wday who command | ||
* * * * * www-data php /var/www/html/artisan schedule:run >> /dev/null 2>&1 |
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,127 @@ | ||
#!/bin/bash | ||
set -eo pipefail | ||
|
||
[[ $DEBUG == true ]] && set -x | ||
|
||
check_database_connection() { | ||
case ${DB_DRIVER} in | ||
mysql) | ||
prog="mysqladmin -h ${DB_HOST} -u ${DB_USERNAME} ${DB_PASSWORD:+-p$DB_PASSWORD} status" | ||
;; | ||
pgsql) | ||
prog=$(find /usr/lib/postgresql/ -name pg_isready) | ||
prog="${prog} -h ${DB_HOST} -U ${DB_USERNAME} -d ${DB_DATABASE} -t 1" | ||
;; | ||
esac | ||
timeout=60 | ||
while ! ${prog} >/dev/null 2>&1 | ||
do | ||
timeout=$(( $timeout - 1 )) | ||
if [[ $timeout -eq 0 ]]; then | ||
echo | ||
echo "Could not connect to database server. Aborting..." | ||
return 1 | ||
fi | ||
echo -n "." | ||
sleep 1 | ||
done | ||
echo | ||
} | ||
|
||
initialize_system() { | ||
APP_ENV=${APP_ENV:-development} | ||
APP_DEBUG=${APP_DEBUG:-true} | ||
APP_URL=${APP_URL:-http://localhost} | ||
APP_KEY=${APP_KEY:-SECRET} | ||
|
||
DB_DRIVER=${DB_DRIVER:-pgsql} | ||
DB_HOST=${DB_HOST:-postgres} | ||
DB_DATABASE=${DB_DATABASE:-cachet} | ||
DB_USERNAME=${DB_USERNAME:-postgres} | ||
DB_PASSWORD=${DB_PASSWORD:-postgres} | ||
DB_PORT=${DB_PORT:-5432} | ||
|
||
CACHE_DRIVER=${CACHE_DRIVER:-apc} | ||
SESSION_DRIVER=${SESSION_DRIVER:-apc} | ||
QUEUE_DRIVER=${QUEUE_DRIVER:-database} | ||
|
||
MAIL_DRIVER=${MAIL_DRIVER:-smtp} | ||
MAIL_HOST=${MAIL_HOST:-mailtrap.io} | ||
MAIL_PORT=${MAIL_PORT:-2525} | ||
MAIL_USERNAME=${MAIL_USERNAME:-null} | ||
MAIL_PASSWORD=${MAIL_PASSWORD:-null} | ||
MAIL_ADDRESS=${MAIL_ADDRESS:-null} | ||
MAIL_NAME=${MAIL_NAME:-null} | ||
|
||
REDIS_HOST=${REDIS_HOST:-null} | ||
REDIS_DATABASE=${REDIS_DATABASE:-null} | ||
REDIS_PORT=${REDIS_PORT:-null} | ||
|
||
# configure env file | ||
|
||
sed 's,{{APP_ENV}},'"${APP_ENV}"',g' -i /var/www/html/.env | ||
sed 's,{{APP_DEBUG}},'"${APP_DEBUG}"',g' -i /var/www/html/.env | ||
sed 's,{{APP_URL}},'"${APP_URL}"',g' -i /var/www/html/.env | ||
sed 's,{{APP_KEY}},'${APP_KEY}',g' -i /var/www/html/.env | ||
|
||
sed 's,{{DB_DRIVER}},'"${DB_DRIVER}"',g' -i /var/www/html/.env | ||
sed 's,{{DB_HOST}},'"${DB_HOST}"',g' -i /var/www/html/.env | ||
sed 's,{{DB_DATABASE}},'"${DB_DATABASE}"',g' -i /var/www/html/.env | ||
sed 's,{{DB_USERNAME}},'"${DB_USERNAME}"',g' -i /var/www/html/.env | ||
sed 's,{{DB_PASSWORD}},'"${DB_PASSWORD}"',g' -i /var/www/html/.env | ||
|
||
sed 's,{{CACHE_DRIVER}},'"${CACHE_DRIVER}"',g' -i /var/www/html/.env | ||
sed 's,{{SESSION_DRIVER}},'"${SESSION_DRIVER}"',g' -i /var/www/html/.env | ||
sed 's,{{QUEUE_DRIVER}},'"${QUEUE_DRIVER}"',g' -i /var/www/html/.env | ||
|
||
sed 's,{{MAIL_DRIVER}},'"${MAIL_DRIVER}"',g' -i /var/www/html/.env | ||
sed 's,{{MAIL_HOST}},'"${MAIL_HOST}"',g' -i /var/www/html/.env | ||
sed 's,{{MAIL_PORT}},'"${MAIL_PORT}"',g' -i /var/www/html/.env | ||
sed 's,{{MAIL_USERNAME}},'"${MAIL_USERNAME}"',g' -i /var/www/html/.env | ||
sed 's,{{MAIL_PASSWORD}},'"${MAIL_PASSWORD}"',g' -i /var/www/html/.env | ||
sed 's,{{MAIL_ADDRESS}},'"${MAIL_ADDRESS}"',g' -i /var/www/html/.env | ||
sed 's,{{MAIL_NAME}},'"${MAIL_NAME}"',g' -i /var/www/html/.env | ||
|
||
sed 's,{{REDIS_HOST}},'"${REDIS_HOST}"',g' -i /var/www/html/.env | ||
sed 's,{{REDIS_DATABASE}},'"${REDIS_DATABASE}"',g' -i /var/www/html/.env | ||
sed 's,{{REDIS_PORT}},'"${REDIS_PORT}"',g' -i /var/www/html/.env | ||
|
||
php composer.phar install --no-dev -o | ||
php artisan app:install | ||
rm -rf bootstrap/cache/* | ||
touch /var/www/.cachet-installed | ||
start_system | ||
} | ||
|
||
start_system() { | ||
check_database_connection | ||
[ -f "/var/www/.cachet-installed" ] && echo "Starting Cachet" || initialize_system | ||
php artisan config:cache | ||
sudo /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf | ||
} | ||
|
||
case ${1} in | ||
init|start) | ||
|
||
case ${1} in | ||
start) | ||
start_system | ||
;; | ||
init) | ||
initialize_system | ||
;; | ||
esac | ||
;; | ||
help) | ||
echo "Available options:" | ||
echo " start - Starts the Cachet server (default)" | ||
echo " init - Initialize the Cachet server (e.g. create databases, compile assets)." | ||
echo " help - Displays the help" | ||
echo " [command] - Execute the specified command, eg. bash." | ||
;; | ||
*) | ||
exec "$@" | ||
;; | ||
esac | ||
|
||
exit 0 |
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,30 @@ | ||
server { | ||
listen 8000 default; ## Listen for ipv4; this line is default and implied | ||
|
||
# Make site accessible from http://localhost/ | ||
server_name localhost; | ||
root /var/www/html/public; | ||
|
||
index index.html index.htm index.php; | ||
|
||
charset utf-8; | ||
|
||
location / { | ||
try_files $uri $uri/ /index.php?$query_string; | ||
} | ||
|
||
# Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | ||
location ~ \.php$ { | ||
fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
include fastcgi_params; | ||
fastcgi_pass cachet:9000; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_index index.php; | ||
fastcgi_keep_conn on; | ||
} | ||
|
||
location ~ /\.ht { | ||
deny all; | ||
} | ||
|
||
} |
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,24 @@ | ||
[www] | ||
user = www-data | ||
group = www-data | ||
|
||
listen = 9000 | ||
|
||
request_terminate_timeout = 120s | ||
|
||
pm = ondemand | ||
pm.max_children = 5 | ||
pm.process_idle_timeout = 10s | ||
pm.max_requests = 500 | ||
chdir = / | ||
|
||
env[DB_DRIVER] = $DB_DRIVER | ||
env[DB_HOST] = $DB_HOST | ||
env[DB_DATABASE] = $DB_DATABASE | ||
env[DB_USERNAME] = $DB_USERNAME | ||
env[DB_PASSWORD] = $DB_PASSWORD | ||
env[CACHE_DRIVER] = $CACHE_DRIVER | ||
|
||
|
||
[global] | ||
daemonize = no |
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,22 @@ | ||
[supervisord] | ||
logfile=/dev/null ; (main log file;default $CWD/supervisord.log) | ||
logfile_maxbytes=0 ; (max main logfile bytes b4 rotation;default 50MB) | ||
logfile_backups=0 ; (num of main logfile rotation backups;default 10) | ||
loglevel=info ; (log level;default info; others: debug,warn,trace) | ||
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid) | ||
nodaemon=true ; (start in foreground if true;default false) | ||
|
||
; the below section must remain in the config file for RPC | ||
; (supervisorctl/web interface) to work, additional interfaces may be | ||
; added by defining them in separate rpcinterface: sections | ||
[rpcinterface:supervisor] | ||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface | ||
|
||
[supervisorctl] | ||
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket | ||
|
||
[program:php-fpm] | ||
command=/usr/sbin/php5-fpm -c /etc/php5/fpm | ||
|
||
[program:cron] | ||
command=/usr/sbin/cron -f |
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
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