PIFR 2 client for postgres on Ubuntu 9.10

Events happening in the community are now at Drupal community events on www.drupal.org.
You are viewing a wiki page. You are welcome to join the group and then edit it. Be bold!

in-progress:

starting from http://qa.drupal.org/node/44, http://groups.drupal.org/node/39942

ec2-request-spot-instances -t m1.small -p 0.035 -k XXX -g pfir2 -v ami-bb709dd2

ssh -i XXX.pem ubuntu@ec2-99-201-0-242.compute-1.amazonaws.com

sudo apt-get update
sudo apt-get upgrade

sudo apt-get --no-install-recommends install build-essential postgresql postgresql-client apache2 apache2-threaded-dev php5 php5-cgi php5-cli php5-gd php5-common php-pear php5-curl php5-pgsql cvs curl php5-dev libapache2-mod-php5 gawk patch htop rsync cron wget openssh-blacklist-extra

check the data dir:

sudo ls -l /var/lib/postgresql/8.4/main/

check the conf:

more /etc/postgresql/8.4/main/postgresql.conf

sudo a2enmod rewrite
sudo perl -pi -e 's/(\s+AllowOverride)\s+None$/\1 All/g' /etc/apache2/sites-available/default
sudo /etc/init.d/apache2 restart

add drupal.ini to /etc/php5/conf.d with the following (sudo nano /etc/php5/conf.d/drupal.ini) :

short_open_tag = Off
expose_php = Off
memory_limit = 256M
display_errors = On
log_errors = Off

Greatly reduce the number of apache processes allowed to run by adding to /etc/apache2/conf.d a file drupal.conf with:


<IfModule mpm_prefork_module>
    StartServers          2
    MinSpareServers       2
    MaxSpareServers       3
    MaxClients            5
    MaxRequestsPerChild   0
</IfModule>

Increase shhmax

sudo sysctl -w kernel.shmmax=73400320

cd /var
sudo chown ubuntu www
cvs -z6 -d :pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout -r DRUPAL-6-15 -d www drupal
cd www
sudo rm index.html

use patch for postgres config (below) restart postgres.

sudo su - postgres
createuser -s ubuntu
exit

createuser --pwprompt --encrypted --no-createrole --createdb -S username
(type in 'password' as the password)
createdb --encoding=UNICODE --owner=username drupal
createdb --encoding=UNICODE --owner=username drupal_checkout

chmod 755 sites/default
cp sites/default/default.settings.php sites/default/settings.php

nano sites/default/settings.php

add:

$db_url = array();
$db_url['default'] = 'pgsql://username:password@localhost/drupal';
$db_url['pifr_checkout'] = 'pgsql://username:password@localhost/drupal_checkout';

mkdir sites/default/files
chmod 777 sites/default/files
touch sites/default/files/review.log
chmod 777 sites/default/files/review.log
sudo chown www-data:www-data sites/default/files/review.log
ln -s ./sites/default/files/checkout

mkdir sites/all/modules
cd sites/all/modules
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -r DRUPAL-6--1 -d cvs_deploy contributions/modules/cvs_deploy

cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -r DRUPAL-6--2-2 -d project_issue_file_review contributions/modules/project_issue_file_review

Install Drupal, enable CVS Deploy, PIFR, PIFR Client, PIFR Assertion modules

crontab -e

    */2 * * * * /usr/bin/wget -O - -q -t 1 http://localhost/cron.php

prepare for tmpfs:

sudo mkdir /var/lib/postgresql/8.4/tmpfs
sudo chown postgres:postgres /var/lib/postgresql/8.4/tmpfs
sudo chmod 755 /var/lib/postgresql/8.4/main/

sudo mv sites/default/files/ sites/default/.files
mkdir sites/default/files/
sudo mount -t tmpfs -o rw,nosuid,nodev,noexec,uid=id -u www-data,gid=id -g www-data,size=50m tmpfs /var/www/sites/default/files
sudo chmod -R go+w /var/www/sites/default/files
sudo cp -r /var/www/sites/default/.files/* /var/www/sites/default/files

manual commands:

sudo mount -t tmpfs -o rw,nosuid,nodev,noexec,uid=id -u postgres,gid=id -g postgres tmpfs /var/lib/postgresql/8.4/tmpfs
sudo cp -a /var/lib/postgresql/8.4/main/* /var/lib/postgresql/8.4/tmpfs/
sudo chmod 700 /var/lib/postgresql/8.4/tmpfs

POSTGRES is a PITA:

http://www.cyberciti.biz/faq/psql-fatal-ident-authentication-failed-for-...
http://old.nabble.com/SAST-FATAL:-could-not-access-private-key-file-%22s...
http://www.postgresql.org/docs/8.3/static/ssl-tcp.html

diff --git pg_hba.conf pg_hba.conf
index a2618de..708103c 100644
--- pg_hba.conf
+++ pg_hba.conf
@@ -79,7 +79,7 @@ local   all         postgres                          ident
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
-local   all         all                               ident
+local   all         all                               trust
# IPv4 local connections:
host    all         all         127.0.0.1/32          md5
# IPv6 local connections:
diff --git postgresql.conf postgresql.conf
index 87e85ef..1b7c653 100644
--- postgresql.conf
+++ postgresql.conf
@@ -75,7 +75,7 @@ unix_socket_directory = '/var/run/postgresql'         # (change requires restart)
# - Security and Authentication -

#authentication_timeout = 1min         # 1s-600s
-ssl = true                             # (change requires restart)
+ssl = false                            # (change requires restart)
#ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH'     # allowed SSL ciphers
                                        # (change requires restart)
#password_encryption = on

more complete patch - some of this is probably not needed:

index 87e85ef..6d1ff1b 100644
--- postgresql.conf
+++ postgresql.conf
@@ -38,7 +38,8 @@
# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.

-data_directory = '/var/lib/postgresql/8.4/main'                # use data in another directory
+#data_directory = '/var/lib/postgresql/8.4/main'                # use data in another directory
+data_directory = '/var/lib/postgresql/8.4/tmpfs'        # use data in another directory
                                        # (change requires restart)
hba_file = '/etc/postgresql/8.4/main/pg_hba.conf'      # host-based authentication file
                                        # (change requires restart)
@@ -61,7 +62,7 @@ external_pid_file = '/var/run/postgresql/8.4-main.pid'                # write an extra PID fil
                                        # defaults to 'localhost', '*' = all
                                        # (change requires restart)
port = 5432                            # (change requires restart)
-max_connections = 100                  # (change requires restart)
+max_connections = 50                   # (change requires restart)
# Note:  Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).
#superuser_reserved_connections = 3    # (change requires restart)
@@ -75,7 +76,7 @@ unix_socket_directory = '/var/run/postgresql'         # (change requires restart)
# - Security and Authentication -

#authentication_timeout = 1min         # 1s-600s
-ssl = true                             # (change requires restart)
+ssl = false                            # (change requires restart)
#ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH'     # allowed SSL ciphers
                                        # (change requires restart)
#password_encryption = on
@@ -103,7 +104,7 @@ ssl = true                          # (change requires restart)

# - Memory -

-shared_buffers = 28MB                  # min 128kB
+shared_buffers = 50MB                  # min 128kB
                                        # (change requires restart)
#temp_buffers = 8MB                    # min 800kB
#max_prepared_transactions = 0         # zero disables the feature
@@ -147,7 +148,7 @@ shared_buffers = 28MB                       # min 128kB

# - Settings -

-#fsync = on                            # turns forced synchronization on or off
+fsync = off                            # turns forced synchronization on or off
#synchronous_commit = on               # immediate fsync at commit
#wal_sync_method = fsync               # the default is the first option
                                        # supported by the operating system:
@@ -199,11 +200,11 @@ shared_buffers = 28MB                     # min 128kB
# - Planner Cost Constants -

#seq_page_cost = 1.0                   # measured on an arbitrary scale
-#random_page_cost = 4.0                        # same scale as above
+random_page_cost = 2.0                 # same scale as above
#cpu_tuple_cost = 0.01                 # same scale as above
#cpu_index_tuple_cost = 0.005          # same scale as above
#cpu_operator_cost = 0.0025            # same scale as above
-#effective_cache_size = 128MB
+effective_cache_size = 156MB

# - Genetic Query Optimizer -

@@ -390,10 +391,10 @@ log_line_prefix = '%t '                   # special values:
                                        # actions running at least this number
                                        # of milliseconds.
#autovacuum_max_workers = 3            # max number of autovacuum subprocesses
-#autovacuum_naptime = 1min             # time between autovacuum runs
-#autovacuum_vacuum_threshold = 50      # min number of row updates before
+autovacuum_naptime = 10min             # time between autovacuum runs
+autovacuum_vacuum_threshold = 5000     # min number of row updates before
                                        # vacuum
-#autovacuum_analyze_threshold = 50     # min number of row updates before
+autovacuum_analyze_threshold = 5000    # min number of row updates before
                                        # analyze
#autovacuum_vacuum_scale_factor = 0.2  # fraction of table size before vacuum
#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze

Amazon Web Services (S3, EC2)

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: