Skip to content
This repository has been archived by the owner on Nov 25, 2017. It is now read-only.

Commit

Permalink
A handful of tweaks that came up running through this today:
Browse files Browse the repository at this point in the history
* Correctly set ServerLimit in Apache.
* Some fabfile fixes to install extra stuff I missed before (svn).
* A few extra Fab commands.
* Caching fixes.
* pgpool fixes.
  • Loading branch information
jacobian committed Mar 17, 2010
1 parent 9e5d999 commit 6e9472d
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 16 deletions.
3 changes: 2 additions & 1 deletion apache/apache2.conf
Expand Up @@ -22,10 +22,11 @@ Listen *:80


Timeout 60 Timeout 60
StartServers 2 StartServers 2
ServerLimit 5
MinSpareThreads 2 MinSpareThreads 2
MaxSpareThreads 4 MaxSpareThreads 4
ThreadLimit 10 ThreadLimit 10
ThreadsPerChild 10 ThreadsPerChild 10
MaxClients 100 MaxClients 100
MaxRequestsPerChild 10000 MaxRequestsPerChild 10000


Expand Down
4 changes: 3 additions & 1 deletion fabfile.py
Expand Up @@ -36,4 +36,6 @@ def setup():


def killem(): def killem():
for name in env.hosts: for name in env.hosts:
CS.servers.find(name=name).delete() CS.servers.find(name=name).delete()

del Path
9 changes: 5 additions & 4 deletions fabfiles/multiple-webs.py
Expand Up @@ -21,7 +21,7 @@ def setup():
"Set up and bootstrap a new web server." "Set up and bootstrap a new web server."


# Install needed packages # Install needed packages
run('aptitude -y install git-core python-dev postgresql-dev postgresql-client build-essential libpq-dev apache2 libapache2-mod-wsgi') run('aptitude -y install subversion git-core python-dev postgresql-dev postgresql-client build-essential libpq-dev apache2 libapache2-mod-wsgi')


# Make the code directories, and go get the code # Make the code directories, and go get the code
run('mkdir -p %s' % os.path.join(env.web_root, "static")) run('mkdir -p %s' % os.path.join(env.web_root, "static"))
Expand Down Expand Up @@ -53,9 +53,6 @@ def setup():
# Done - where! Now restart Apache. # Done - where! Now restart Apache.
run('invoke-rc.d apache2 restart') run('invoke-rc.d apache2 restart')


def trysed():
dbip = '10.177.58.115'

def push(): def push():
"Push out new code to the server." "Push out new code to the server."
with cd(env.code_root): with cd(env.code_root):
Expand All @@ -70,6 +67,10 @@ def reload():
"Reload Apache to pick up new code changes." "Reload Apache to pick up new code changes."
run("invoke-rc.d apache2 reload") run("invoke-rc.d apache2 reload")


def restart_apache():
"Restart Apache."
run("invoke-rc.d apache2 restart")

def flush_cache(): def flush_cache():
"Flush memcached." "Flush memcached."
run("invoke-rc.d memcached restart") run("invoke-rc.d memcached restart")
Expand Down
3 changes: 1 addition & 2 deletions fumblerooski-site/buildout.cfg
Expand Up @@ -22,8 +22,7 @@ extra-paths = ${buildout:extra-paths}


[fumblerooski] [fumblerooski]
recipe = zerokspot.recipe.git recipe = zerokspot.recipe.git
repository = git://github.com/jacobian/fumblerooski.git repository = git://github.com/dwillis/fumblerooski.git
rev = 542c21e


[gcharts] [gcharts]
recipe = zerokspot.recipe.git recipe = zerokspot.recipe.git
Expand Down
6 changes: 3 additions & 3 deletions fumblerooski-site/fski/settings.py
Expand Up @@ -27,16 +27,16 @@


# Umcomment this and the middleware below to enable caching. # Umcomment this and the middleware below to enable caching.
# Replace the IPs with the internal IPs of the machines running memcached. # Replace the IPs with the internal IPs of the machines running memcached.
CACHE_BACKEND = 'memcached://10.X.X.X:11211;10.X.X.X:11211/' # CACHE_BACKEND = 'memcached://10.X.X.X:11211;10.X.X.X:11211/'


MIDDLEWARE_CLASSES = ( MIDDLEWARE_CLASSES = (
'django.middleware.cache.UpdateCacheMiddleware', # 'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware', 'django.middleware.doc.XViewMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware', # 'django.middleware.cache.FetchFromCacheMiddleware',
) )


ROOT_URLCONF = 'fumblerooski.urls' ROOT_URLCONF = 'fumblerooski.urls'
Expand Down
9 changes: 6 additions & 3 deletions notes/pycon-2010-script.txt
Expand Up @@ -61,7 +61,7 @@ Pre-fetch the big data file::


Bootstrap up the example app:: Bootstrap up the example app::


web1$ aptitude install git-core python-dev postgresql-dev postgresql-client build-essential libpq-dev web1$ aptitude install git-core python-dev postgresql-dev postgresql-client build-essential libpq-dev subversion
web1$ mkdir -p /home/web/static web1$ mkdir -p /home/web/static
web1$ cd /home/web web1$ cd /home/web
web1$ git clone git://github.com/jacobian/django-deployment-workshop.git web1$ git clone git://github.com/jacobian/django-deployment-workshop.git
Expand Down Expand Up @@ -91,7 +91,7 @@ Install and configure Postgres.
Edit config files pg_hba.conf to include the correct IP addresses, then start:: Edit config files pg_hba.conf to include the correct IP addresses, then start::


db1$ vim pg_hba.conf db1$ vim pg_hba.conf
db1$ vim postgresql.config db1$ vim postgresql.conf
db1$ invoke-rc.d postgresql-8.4 start db1$ invoke-rc.d postgresql-8.4 start


And create users and database. Root user for convenience:: And create users and database. Root user for convenience::
Expand Down Expand Up @@ -338,7 +338,10 @@ Copy over the WAL files::


db2$ RSYNC_RSH="ssh -i /var/lib/postgresql/.ssh/no-pass" rsync -arv --remove-source-files postgres@<db1>:/pg_archive/* /pg_archive/ db2$ RSYNC_RSH="ssh -i /var/lib/postgresql/.ssh/no-pass" rsync -arv --remove-source-files postgres@<db1>:/pg_archive/* /pg_archive/


In real life, the above would be a cron job. In real life, the above would be a cron job::

RSYNC_RSH="ssh -i /var/lib/postgresql/.ssh/no-pass"
*/5 * * * * rsync -arv --remove-source-files postgres@<db1>:/pg_archive/* /pg_archive/


Start PostgreSQL and verify it is in recovery mode:: Start PostgreSQL and verify it is in recovery mode::


Expand Down
2 changes: 1 addition & 1 deletion pgpool/pgpool-single-db.conf
Expand Up @@ -5,7 +5,7 @@ listen_addresses = 'localhost'
port = 5432 port = 5432


# Don't use local auth; defer to the database instead. # Don't use local auth; defer to the database instead.
enable_pool_hba = true enable_pool_hba = false


# Don't use any of pgpool's fancy features # Don't use any of pgpool's fancy features
replication_mode = false replication_mode = false
Expand Down
2 changes: 1 addition & 1 deletion pgpool/pgpool-with-failover.conf
Expand Up @@ -5,7 +5,7 @@ listen_addresses = 'localhost'
port = 5432 port = 5432


# Don't use local auth; defer to the database instead. # Don't use local auth; defer to the database instead.
enable_pool_hba = true enable_pool_hba = false


# Don't use any of pgpool's fancy features # Don't use any of pgpool's fancy features
replication_mode = false replication_mode = false
Expand Down

0 comments on commit 6e9472d

Please sign in to comment.