wiki:XBrain

Version 5 (modified by detwiler, 12 years ago) (diff)

--

Putting it to the test:

Links to the latest RXQuery and Public View files in CVS:

Installation instructions:

First install PostgreSql and make sure it accepts network connections such as:

psql -h localhost -U xbrain_user xbrain_queries

Query storage database

su - postgres
createuser xbrain_user --no-adduser --no-createdb -P
createdb xbrain_queries
cat > xbrain_queries.schema <<EOF
CREATE TABLE "database" (
        "id" integer NOT NULL,
        "name" character varying(100) NOT NULL,
        "description" character varying(400),
        Constraint "database_pkey" Primary Key ("id")
);
CREATE TABLE "query" (
        "id" integer NOT NULL,
        "title" character varying(200),
        "description" character varying(400),
        "content" text,
        "db_id" integer,
        "user_id" integer,
        "is_public" boolean DEFAULT 'f'::bool,
        "date_created" timestamp without time zone,
        "date_updated" timestamp without time zone,
        Constraint "query_pkey" Primary Key ("id")
);

CREATE SEQUENCE "query_id_seq" 
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
EOF
psql xbrain_queries < xbrain_queries.schema

Make sure the new user has rights on the query database; this is not as simple with PostgreSql but you can use a script like this one

#!/bin/sh
# Run like `./grantall.sh xbrain_queries xbrain_user`.
SQL="SELECT relname FROM pg_class WHERE (relkind = 'r' OR relkind = 'S')
AND relname !~ '^pg_' AND relname !~ '^sql_' ORDER BY relname"
OBJ=`psql -t -c "${SQL}" $1`
SQL="GRANT ALL ON ${OBJ} TO $2"
echo ${SQL}
for i in $OBJ; do
        psql -c "GRANT ALL ON \"$i\" TO $2" $1
done
EOF

You should now be able to connect and select from the database with

psql -h localhost -U xbrain_user xbrain_queries

Deploying the webapp

First install Tomcat5, create a "manager" user in /etc/tomcat5/tomcat-users.xml, and make sure you can log in at http://localhost:8080/manager/html

cvs checkout -d xbrain2005 -P src/brain/xbrain/xbrainweb
cd xbrain2005
vi build.properties 
# add lines that match /etc/tomcat5/tomcat-users.xml
#manager.username=sigadmin
#manager.password=mypass
ant deploy

Congratulations, go to http://localhost:8080/xbrain/