Skip to content

Commit

Permalink
--size_id bug in create-cluster, added pg_createcluster command, defa…
Browse files Browse the repository at this point in the history
…ult locale
  • Loading branch information
jokull committed Mar 7, 2012
1 parent f8fe963 commit 0a30008
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
6 changes: 3 additions & 3 deletions kraftwerk/cli/commands.py
Expand Up @@ -181,15 +181,15 @@ def create_node(config, args):
break
else:
sys.exit("Image %s not found for this provider. Aborting." % image_id)
size_id = str(getattr(args, 'size-id', config["size_id"]))

size_id = str(getattr(args, 'size_id', config["size_id"]))
for s in config.driver.list_sizes():
if str(s.id) == size_id:
size = s
break
else:
sys.exit("Size %s not found for this provider. Aborting." % size_id)

location_id = str(getattr(args, 'location-id', config.get("location_id", "0")))
if location_id != 'None':
for l in config.driver.list_locations():
Expand Down
2 changes: 1 addition & 1 deletion kraftwerk/project.py
Expand Up @@ -91,7 +91,7 @@ def sync_services(self, src_node, dest_node, timestamp=None):
if proc.returncode != 0:
sys.exit("To use this feature you must be running ssh-agent" + \
" with your relevant key added (%s)." % stdout)
rsync_cmd = "rsync -e \"ssh -o StrictHostKeyChecking=no\" --recursive --times --archive --compress --delete %s %s" % (rsync_src, rsync_dest)
rsync_cmd = "rsync -e \"ssh -o StrictHostKeyChecking=no\" --recursive –-copy-dirlinks --times --archive --compress --delete %s %s" % (rsync_src, rsync_dest)
stdout, stderr = src_node.ssh(rsync_cmd, user="web", pipe=True)
if stderr:
sys.exit("rsync error: %s" % stderr)
Expand Down
10 changes: 10 additions & 0 deletions kraftwerk/templates/scripts/node_setup.sh
Expand Up @@ -5,6 +5,14 @@ chown -R web:web /web /home/web

locale-gen en_US.UTF-8

cat > /etc/default/locale << "EOF"
LANG="en_US.UTF-8"
LANGUAGE="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
EOF

source /etc/default/locale

apt-get -q update
apt-get -y -qq upgrade
apt-get -y -qq install curl git-core mercurial nginx postgresql rsync runit unzip wget zip nginx htop redis-server
Expand All @@ -15,6 +23,8 @@ mkdir -p /var/service

POSTGRESQL_VERSION=$(apt-cache policy postgresql | grep -Eow "[0-9]\.[0-9]" | head -1)

pg_createcluster $POSTGRESQL_VERSION main --start

PG_HBA="/etc/postgresql/$POSTGRESQL_VERSION/main/pg_hba.conf"
cat > $PG_HBA << "EOF"
{% include 'conf/pg_hba.conf' %}
Expand Down
4 changes: 2 additions & 2 deletions kraftwerk/templates/scripts/project_setup.sh
Expand Up @@ -8,7 +8,7 @@ REQUIREMENTS="$ROOT/{{ project.src() }}/REQUIREMENTS"

{% if new -%}

su - web -c "virtualenv $ROOT"
su - web -c "virtualenv --system-site-packages $ROOT"
su - web -c "echo $ROOT > $VIRTUALENV_SITEPACKAGES/$PROJECT.pth"

cat > /etc/nginx/sites-enabled/$PROJECT << "EOF"
Expand All @@ -34,4 +34,4 @@ ln -s $SITE_SERVICE /etc/service/$PROJECT
su - web -c "$ROOT/bin/pip install{% if upgrade_packages %} -U{% endif %} -r $REQUIREMENTS"
sv restart /etc/service/$PROJECT

/etc/init.d/nginx reload
/etc/init.d/nginx reload

0 comments on commit 0a30008

Please sign in to comment.