From cf99ba1d71ac13a7c45f6fc7609c1c98c85b5823 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 10 Nov 2006 17:02:22 +0000 Subject: [PATCH] convenience for test: scratch db, push api, this kind of stuff --- peers-test.mk | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 peers-test.mk diff --git a/peers-test.mk b/peers-test.mk new file mode 100644 index 00000000..6fa0bcce --- /dev/null +++ b/peers-test.mk @@ -0,0 +1,91 @@ +### -*-Makefile-*- +CHROOT=/plc/root +PORT=5432 +SITEDIR=/etc/planetlab/configs +SITE=site.xml +RPM=$(shell ls -rt myplc*rpm | tail -1) +APIDIR=/usr/share/plc_api + +PLC1=lurch.cs.princeton.edu +PLC2=planetlab-devbox.inria.fr + +all:help + +#################### +PUSH=pclean pplc1 pplc2 papi1 papi2 + +push:$(PUSH) + +papi: pclean papi1 papi2 +pplc: pclean pplc1 pplc2 + +pclean: + -find . '(' -name '*.pyc' -o -name '*~' ')' | xargs rm +papi1: + rsync -a -v -C ./ root@$(PLC1):new_plc_api/ +pplc1: + rsync -a -v -C ./PLC/ root@$(PLC1):$(CHROOT)$(APIDIR)/PLC/ +papi2: + rsync -a -v -C ./ root@$(PLC2):new_plc_api/ +pplc2: + rsync -a -v -C ./PLC/ root@$(PLC2):$(CHROOT)$(APIDIR)/PLC/ + +#################### +DB=install-schema stop-clients clean-db restart +API=install-api restart + +db: $(DB) +api: $(API) + +install-schema: + @echo 'installing schema' + @cp planetlab4.sql $(CHROOT)$(APIDIR)/planetlab4.sql + +install-api: + find . -name '*.py' | xargs tar cf - | ( cd $(CHROOT)$(APIDIR) ; tar xf -) + -find $(CHROOT)$(APIDIR) -name '*pyc' | xargs rm + +stop-clients: + @echo 'pkilling psql' + @-pkill psql + @echo stopping httpd + @chroot $(CHROOT) /etc/plc.d/httpd stop + +clean-db: + @echo 'dropping db' + @chroot $(CHROOT) psql -U postgres --port $(PORT) template1 -c 'drop database planetlab4' + +restart: + @echo 'Restarting PLC' + @chroot $(CHROOT) service plc restart + +#################### +UPGRADE=down up reconfig restart +HELP=rpm + +upgrade: $(UPGRADE) + +rpm: + @echo latest rpm is $(RPM) + +down: + cp $(SITEDIR)/$(SITE) . + rpm -e myplc +up: + rpm -i $(RPM) + +reconfig: + service plc mount + mkdir -p $(SITEDIR) + cp $(SITE) $(SITEDIR) + (echo w; echo q) | chroot $(CHROOT) plc-config-tty + +####### +help: + @echo known targets: + @echo push: $(PUSH) + @echo db: $(DB) + @echo api: $(API) + @echo upgrade: $(UPGRADE) + @echo OTHERS: $(HELP) + -- 2.47.0