ソースを参照

Merge pull request #34 from volga629/master

Add support of pgtune
FusionPBX 9 年 前
コミット
6b054c3e56

+ 8 - 1
install/fedora-server/22/deploy_fusionpbx_fedora_server22

@@ -164,7 +164,7 @@ echo "Installing required repository ..."
 dnf -y install http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-22.noarch.rpm
 dnf -y install http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-22.noarch.rpm
 cmd_yum_repo_fusionpbx > /etc/yum.repos.d/networklab.repo
-dnf -y install freeswitch freeswitch-config-vanilla freeswitch-application-valet_parking freeswitch-sounds-* freeswitch-codec-* freeswitch-application-memcache freeswitch-lang-* freeswitch-lua freeswitch-application-voicemail-ivr freeswitch-application-directory freeswitch-application-voicemail freeswitch-application-db freeswitch-application-callcenter freeswitch-application-limit freeswitch-application-curl freeswitch-xml-cdr freeswitch-format-mod-shout freeswitch-v8 freeswitch-application-enum incron chrony ipset git memcached fail2ban fail2ban-firewalld ulogd sudo ghostscript libtiff vim wget net-snmp net-snmp-utils postgresql-odbc nginx php-common php-pdo php-process php-pgsql php-soap php-odbc php-xml php-xmlrpc php-pgsql php-fpm  php-cli php-pear php-pdo php-gd php-mbstring php-mcrypt 
+dnf -y install pgtune freeswitch freeswitch-config-vanilla freeswitch-application-valet_parking freeswitch-sounds-* freeswitch-codec-* freeswitch-application-memcache freeswitch-lang-* freeswitch-lua freeswitch-application-voicemail-ivr freeswitch-application-directory freeswitch-application-voicemail freeswitch-application-db freeswitch-application-callcenter freeswitch-application-limit freeswitch-application-curl freeswitch-xml-cdr freeswitch-format-mod-shout freeswitch-v8 freeswitch-application-enum incron chrony ipset git memcached fail2ban fail2ban-firewalld ulogd sudo ghostscript libtiff vim wget net-snmp net-snmp-utils postgresql-odbc nginx php-common php-pdo php-process php-pgsql php-soap php-odbc php-xml php-xmlrpc php-pgsql php-fpm  php-cli php-pear php-pdo php-gd php-mbstring php-mcrypt 
 if [[ $? -eq 0 ]]; then
    echo "Setting up configuration file ..."
    mv /etc/ulogd.conf /etc/ulogd.conf.orig
@@ -212,6 +212,7 @@ fi
 echo "Setting up FusionPBX web app ..."
 deploy_fusion_pbx /usr/share/nginx/fusionpbx
 
+echo "Setting up Database PgSQL ..."
 if [[ ${DB_HOST%%.*} -eq 127 ]] && [[ "$DB_TYPE" != bdr ]]; then
    updatedb
    postgresql-setup --initdb
@@ -230,6 +231,9 @@ if [[ ${DB_HOST%%.*} -eq 127 ]] && [[ "$DB_TYPE" != bdr ]]; then
       cmd_odbc_fusionpbx_p2 >> /etc/odbcinst.ini
       cmd_postgres_hba_fusionpbx > ${find_psql_data_dir}/pg_hba.conf
       cmd_postgres_conf_fusionpbx > ${find_psql_data_dir}/postgresql.conf
+      pgtune -c 600 -i ${find_psql_data_dir}/postgresql.conf >/tmp/pgtune.conf
+      mv ${find_psql_data_dir}/postgresql.conf{,.bak}
+      cp /tmp/pgtune.conf ${find_psql_data_dir}/postgresql.conf
       chown -R postgres:postgres ${find_psql_data_dir}
       systemctl restart ${find_psql_service_file##*/}
       su - postgres -c "echo \"*:*:*:${USERNAME_FUSIONPBX}:${DBNAME_USER_PASSWD}\" > ~/.pgpass; chmod 600 ~/.pgpass"
@@ -256,6 +260,9 @@ elif [[ "$DB_TYPE" = bdr ]]; then
       cmd_postgres_bdr_conf_fusionpbx > ${find_psql_data_dir}/postgresql.conf
       cmd_postgres_conf_fusionpbx >> ${find_psql_data_dir}/postgresql.conf
       cmd_postgres_bdr_hba_fusionpbx > ${find_psql_data_dir}/pg_hba.conf
+      pgtune -c 600 -i ${find_psql_data_dir}/postgresql.conf >/tmp/pgtune.conf
+      mv ${find_psql_data_dir}/postgresql.conf{,.bak}
+      cp /tmp/pgtune.conf ${find_psql_data_dir}/postgresql.conf
       chown -R postgres:postgres ${find_psql_data_dir} /etc/pki/pg_bdr
       systemctl restart postgresql-9.4.service
       su - postgres -c "echo \"*:*:*:${USERNAME_FUSIONPBX}:${DBNAME_USER_PASSWD}\" > ~/.pgpass; chmod 600 ~/.pgpass"

+ 12 - 11
install/fedora-server/22/install-functions_fedora_server22

@@ -389,8 +389,7 @@ EOF
 
 cmd_postgres_conf_fusionpbx() {
 cat << 'EOF'
-max_connections = 100
-shared_buffers = 256MB
+listen_addresses = "*"
 logging_collector = on
 log_destination = 'stderr'
 log_directory = 'pg_log'
@@ -535,13 +534,13 @@ fi
 
 if [[ "$DB_TYPE" = bdr ]] && [[ $rc_n -ne 0 ]]; then
    "$dnf_bin" install -y http://packages.2ndquadrant.com/postgresql-bdr94-2ndquadrant/yum-repo-rpms/postgresql-bdr94-2ndquadrant-fedora-1.0-2.noarch.rpm
-   "$dnf_bin" install -y postgresql-bdr94-bdr postgresql-bdr94-contrib
+   "$dnf_bin" install -y postgresql-bdr94-bdr postgresql-bdr94-contrib pgtune
 else
-    "$dnf_bin" install -y postgresql-bdr94-bdr postgresql-bdr94-contrib
+    "$dnf_bin" install -y postgresql-bdr94-bdr postgresql-bdr94-contrib pgtune
 fi
 
 if [[ "$DB_TYPE" != bdr ]] && [[ $rc -ne 0 ]]; then
-   "$dnf_bin" -y install postgresql-server
+   "$dnf_bin" -y install postgresql-server postgresql-contrib pgtune
 fi
 
 default_interface=$(ip -o route get 8.8.8.8 | awk '{print $5}')
@@ -576,6 +575,9 @@ if [[ "$DB_TYPE" != bdr ]]; then
    mv ${find_psql_data_dir}/postgresql.conf ${find_psql_data_dir}/postgresql.conf.orig
    psql_hba_config > ${find_psql_data_dir}/pg_hba.conf
    psql_config > ${find_psql_data_dir}/postgresql.conf
+   pgtune -c 600 -i ${find_psql_data_dir}/postgresql.conf >/tmp/pgtune.conf
+   mv ${find_psql_data_dir}/postgresql.conf{,.bak}
+   cp /tmp/pgtune.conf ${find_psql_data_dir}/postgresql.conf
    chown -R postgres:postgres ${find_psql_data_dir}
    systemctl restart postgresql.service
    su - postgres -c "echo \"*:*:*:${USERNAME_FUSIONPBX}:${DBNAME_USER_PASSWD}\" > ~/.pgpass; chmod 600 ~/.pgpass"
@@ -598,6 +600,9 @@ else
    cmd_postgres_bdr_conf_fusionpbx > ${find_psql_data_dir}/postgresql.conf
    cmd_postgres_conf_fusionpbx >> ${find_psql_data_dir}/postgresql.conf
    cmd_postgres_bdr_hba_fusionpbx > ${find_psql_data_dir}/pg_hba.conf
+   pgtune -c 600 -i ${find_psql_data_dir}/postgresql.conf >/tmp/pgtune.conf
+   mv ${find_psql_data_dir}/postgresql.conf{,.bak}
+   cp /tmp/pgtune.conf ${find_psql_data_dir}/postgresql.conf
    chown -R postgres:postgres ${find_psql_data_dir} /etc/pki/pg_bdr
    systemctl restart postgresql-9.4.service
    su - postgres -c "echo \"*:*:*:${USERNAME_FUSIONPBX}:${DBNAME_USER_PASSWD}\" > ~/.pgpass; chmod 600 ~/.pgpass"
@@ -660,9 +665,7 @@ EOF
 cmd_remote_pgsql_p5() {
 cat << 'EOF'
 psql_config() {
-printf "%s" "max_connections = 100
-shared_buffers = 256MB
-logging_collector = on
+printf "%s" "logging_collector = on
 log_destination = 'stderr'
 log_directory = 'pg_log'
 log_filename = 'postgresql-%G-%m-%d-%a.log'
@@ -689,9 +692,7 @@ EOF
 cmd_remote_pgsql_p6() {
 cat << 'EOF'
 cmd_postgres_conf_fusionpbx() {
-printf "%s" "max_connections = 100
-shared_buffers = 256MB
-logging_collector = on
+printf "%s" "logging_collector = on
 log_destination = 'stderr'
 log_directory = 'pg_log'
 log_filename = 'postgresql-%G-%m-%d-%a.log'