diff mbox

[Branch,~linaro-validation/lava-server/trunk] Rev 275: Add helper scripts for development setup

Message ID 20111109192614.3833.19775.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Zygmunt Krynicki Nov. 9, 2011, 7:26 p.m. UTC
------------------------------------------------------------
revno: 275
committer: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
branch nick: lava-server
timestamp: Fri 2011-10-28 02:29:27 +0200
message:
  Add helper scripts for development setup
added:
  create-devel-db.sh
  run-postgresql-instance.sh


--
lp:lava-server
https://code.launchpad.net/~linaro-validation/lava-server/trunk

You are subscribed to branch lp:lava-server.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-server/trunk/+edit-subscription
diff mbox

Patch

=== added file 'create-devel-db.sh'
--- create-devel-db.sh	1970-01-01 00:00:00 +0000
+++ create-devel-db.sh	2011-10-28 00:29:27 +0000
@@ -0,0 +1,32 @@ 
+echo "Setting up development database..."
+
+lava_instance_user=devel
+lava_password=devel
+lava_database=devel
+
+echo "Dropping old database and user"
+sudo -u postgres dropdb $lava_database
+sudo -u postgres dropuser $lava_instance_user
+
+echo "Creating new user and database"
+# Create database user
+sudo -u postgres createuser \
+    --no-createdb \
+    --encrypted \
+    --login \
+    --no-superuser \
+    --no-createrole \
+    --no-password \
+    $lava_instance_user
+
+# Set a password for our new user
+sudo -u postgres psql \
+    --quiet \
+    --command="ALTER USER \"$lava_instance_user\" WITH PASSWORD '$lava_password'"
+
+# Create a database for our new user
+sudo -u postgres createdb \
+    --encoding=UTF-8 \
+    --owner=$lava_instance_user \
+    --no-password \
+    $lava_database

=== added file 'run-postgresql-instance.sh'
--- run-postgresql-instance.sh	1970-01-01 00:00:00 +0000
+++ run-postgresql-instance.sh	2011-10-28 00:29:27 +0000
@@ -0,0 +1,2 @@ 
+#!/bin/sh
+DEVEL_DB=pgsql ./lava_server/manage.py $@