Updated build
Updated puppet build to support new migration for user management from IDP side Change-Id: I633add5af8d96223d331a129f39956b1af4f8867
This commit is contained in:
parent
7091e5ced9
commit
24076bd286
|
@ -80,16 +80,43 @@ function site_init {
|
|||
|
||||
# populate application database
|
||||
cd $target_dir
|
||||
php artisan migrate --env=$LARAVEL_ENV
|
||||
|
||||
echo "running redis FLUSHDB ...";
|
||||
echo "FLUSHDB" | redis-cli -h 127.0.0.1 -p $REDIS_PORT -a "$REDIS_PASSWORD";
|
||||
echo "running redis FLUSHALL ...";
|
||||
echo "FLUSHALL" | redis-cli -h 127.0.0.1 -p $REDIS_PORT -a "$REDIS_PASSWORD";
|
||||
|
||||
echo "generating doctrine proxies";
|
||||
php artisan doctrine:generate:proxies;
|
||||
echo "clearing doctrine metadata";
|
||||
php artisan doctrine:clear:metadata:cache;
|
||||
echo "clearing doctrine query cache";
|
||||
php artisan doctrine:clear:query:cache;
|
||||
echo "clearing doctrine result cache";
|
||||
php artisan doctrine:clear:result:cache;
|
||||
echo "running db migrations";
|
||||
php artisan doctrine:migrations:migrate --connection=model --force --env=$LARAVEL_ENV;
|
||||
|
||||
if [[ $USE_DB_SEEDING -eq 1 ]]; then
|
||||
php artisan db:seed --env=$LARAVEL_ENV --force
|
||||
fi
|
||||
|
||||
echo "regenerating route cache";
|
||||
php artisan route:clear;
|
||||
php artisan route:cache;
|
||||
|
||||
sudo npm install
|
||||
sudo npm run build
|
||||
# activate site
|
||||
rm -rf $SITE_ROOT/w
|
||||
ln -s $SITE_ROOT/slot0 $SITE_ROOT/w
|
||||
|
||||
echo "Restarting laravel queue worker ...";
|
||||
php artisan queue:restart;
|
||||
|
||||
echo "supervisorctl reload";
|
||||
supervisorctl reload;
|
||||
|
||||
}
|
||||
|
||||
function site_status {
|
||||
|
@ -208,12 +235,38 @@ function site_update {
|
|||
|
||||
# populate application database
|
||||
cd $target_dir
|
||||
php artisan migrate --env=$LARAVEL_ENV --force
|
||||
echo "running redis FLUSHDB ...";
|
||||
echo "FLUSHDB" | redis-cli -h 127.0.0.1 -p $REDIS_PORT -a "$REDIS_PASSWORD";
|
||||
echo "running redis FLUSHALL ...";
|
||||
echo "FLUSHALL" | redis-cli -h 127.0.0.1 -p $REDIS_PORT -a "$REDIS_PASSWORD";
|
||||
|
||||
echo "generating doctrine proxies";
|
||||
php artisan doctrine:generate:proxies;
|
||||
echo "clearing doctrine metadata";
|
||||
php artisan doctrine:clear:metadata:cache;
|
||||
echo "clearing doctrine query cache";
|
||||
php artisan doctrine:clear:query:cache;
|
||||
echo "clearing doctrine result cache";
|
||||
php artisan doctrine:clear:result:cache;
|
||||
echo "running db migrations";
|
||||
php artisan doctrine:migrations:migrate --connection=model --force --env=$LARAVEL_ENV;
|
||||
|
||||
echo "regenerating route cache";
|
||||
php artisan route:clear;
|
||||
php artisan route:cache;
|
||||
|
||||
sudo npm install
|
||||
sudo npm run build
|
||||
|
||||
# activate site
|
||||
rm -rf $SITE_ROOT/w
|
||||
ln -s $target_dir $SITE_ROOT/w
|
||||
# to reset op cache
|
||||
/usr/sbin/service $PHP_SERVICE_NAME restart
|
||||
|
||||
echo "Restarting laravel queue worker ...";
|
||||
php artisan queue:restart;
|
||||
|
||||
echo "supervisorctl reload";
|
||||
supervisorctl reload;
|
||||
}
|
||||
|
|
|
@ -142,6 +142,7 @@ class openstackid (
|
|||
'build-essential',
|
||||
'software-properties-common',
|
||||
'python-software-properties',
|
||||
'supervisor',
|
||||
]
|
||||
|
||||
package { $main_packages:
|
||||
|
@ -328,6 +329,36 @@ class openstackid (
|
|||
mode => '0755',
|
||||
}
|
||||
|
||||
file { '/etc/scripts':
|
||||
ensure => directory,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
}
|
||||
|
||||
file { '/etc/scripts/supervisor_watchdog.sh':
|
||||
ensure => present,
|
||||
content => template('openstackid/supervisor_watchdog.sh.erb'),
|
||||
owner => 'root',
|
||||
group => 'www-data',
|
||||
mode => '0770',
|
||||
require => [
|
||||
Package['supervisor'],
|
||||
File['/etc/scripts'],
|
||||
]
|
||||
}
|
||||
|
||||
file { '/etc/supervisor/conf.d/supervisor.conf':
|
||||
ensure => present,
|
||||
content => template('openstackid/supervisor.conf.erb'),
|
||||
owner => 'root',
|
||||
group => 'www-data',
|
||||
mode => '0640',
|
||||
require => [
|
||||
Package['supervisor'],
|
||||
]
|
||||
}
|
||||
|
||||
file { '/etc/openstackid/.env':
|
||||
ensure => present,
|
||||
content => template('openstackid/.env.erb'),
|
||||
|
@ -553,4 +584,11 @@ class openstackid (
|
|||
minute => '*',
|
||||
}
|
||||
|
||||
cron { 'InstallSupervisorWatchdog':
|
||||
ensure => 'present',
|
||||
command => '/etc/scripts/supervisor_watchdog.sh >> /var/log/supervisor_watchdog.log 2>&1',
|
||||
user => 'root',
|
||||
minute => '*/5',
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,4 +5,6 @@ RELEASE_NAME=openstackid-<%= @openstackid_release %>.tar.gz
|
|||
SOURCE_ROOT=http://tarballs.openstack.org/openstackid/
|
||||
USE_DB_SEEDING=<%= @use_db_seeding?1:0 %>
|
||||
LARAVEL_VERSION=<%= @laravel_version %>
|
||||
PHP_SERVICE_NAME=<%= @php_service_name %>
|
||||
PHP_SERVICE_NAME=<%= @php_service_name %>
|
||||
REDIS_PORT=<%= @redis_port %>
|
||||
REDIS_PASSWORD=<%= @redis_password %>
|
|
@ -0,0 +1,15 @@
|
|||
[supervisord]
|
||||
nodaemon=true
|
||||
pidfile=/run/supervisord.pid
|
||||
user=root
|
||||
|
||||
[program:laravel-worker]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command=php <%= @docroot %>/artisan queue:work
|
||||
autostart=true
|
||||
autorestart=true
|
||||
numprocs=8
|
||||
user=www-data
|
||||
stderr_logfile=/var/log/supervisor_laravel_worker.err.log
|
||||
stdout_logfile=/var/log/supervisor_laravel_worker.out.log
|
||||
logfile_maxbytes=10MB
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
dt=`date '+%d/%m/%Y %H:%M:%S'`
|
||||
output=$(supervisorctl status | grep -i ^RUNNING);
|
||||
|
||||
if test -z "$output"
|
||||
then
|
||||
echo "[$dt] - everything running just fine";
|
||||
else
|
||||
echo "[$dt] - some process has stopped, reloading supervisor";
|
||||
echo "$output"
|
||||
supervisorctl reload;
|
||||
fi
|
Loading…
Reference in New Issue