Hello Ted!

Peter Cock wrote, On 03/25/2013 01:51 PM:
> On Mon, Mar 25, 2013 at 5:41 PM, Ted Goldstein <tedgoldst...@gmail.com> wrote:
>> Hi
>> Does anyone have any experience or advice about running
>> two servers on the same database?
> My advice is don't do it. 

I'll second Peter's advice, don't ever do that :)

I forgot where I heard it, but someone (wise) said "Code flows from dev to 
prod, data should flow from prod to dev".

To facilitate that, we use the following script, that can quickly copy the data 
from our production server to our development server.
Once it's run, the databases contain the same datasets and workflows and 
everything, making testing and debugging much easier:


DATE=$(date "+%Y_%m_%d_%H%M%S")



echo "Dumping Prod-DB to:"
echo "  $FILE"
echo "(Enter 'galaxyprod' DB password)"
pg_dump -c -U galaxyprod galaxyprod | sed 's/galaxyprod/galaxydev/g' | gzip > 
"$FILE" || exit 1

echo "Dropping and re-creating Galaxy-Devel database."
echo "press CTRL-C to abort or ENTER to continue."
## First, drop all tables, functions, etc.

psql -t -d galaxydev -c "SELECT 'DROP TABLE ' || n.nspname || '.' ||c.relname 
|| ' CASCADE;' FROM pg_catalog.pg_class AS c LEFT JOIN pg_catalog.pg_namespace 
AS n ON n.oid = c.relnamespace WHERE relkind = 'r' AND n.nspname NOT IN 
('pg_catalog', 'pg_toast') AND pg_catalog.pg_table_is_visible(c.oid)" | psql 
zcat "$FILE" | psql galaxydev || exit 1

## Reset all the waiting jobs, we don't want to re-run them on dev
psql galaxydev -c "update job set state='error' where (state='new' or 

rm "$FILE"

Once this script is complete, the "galaxydev" database is an exact copy of 
"galaxyprod" database (except queued jobs).

Hope this helps,

Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:

To search Galaxy mailing lists use the unified search at:

Reply via email to