View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Setting up a PostgreSQL database to function as a STORE repository

IN PROGRESS

Uploaded Image: CINCOMVW.gif + Uploaded Image: 100x58_1.gif

STORE is a perfect integrated solution in VisualWorks to handle all source code management. After
excessively dealing with all the pains of CVS in other classes, it was actually a relief to use STORE.
This tutorial will discuss how to install PostgreSQL on Linux and how to setup the database for usage
with STORE. If you've already got a working PostgreSQL installation, you can skip the first step.




Installing PostgreSQL

You will need administrative capabilities on some type of computer with a dedicated internet
connection in order to install PostgreSQL to function as a good STORE repository. My group happened
to have a dedicated Linux server available, so we used this to install PostgreSQL. On to the
installation.

Our Linux flavor of choice is CentOS 4.4 (a variant of Red Hat Enterprise Linux) and we chose
to install PostgreSQL via a binary package using yum. Alternatively, you can also install by compiling
the source code, but this will not be discussed here.

CentOS features a package manager called yum. It's also available in many other Linux flavors.

To install simply run the following as root:
	yum install postgresql postgresql-server


If yum is not available on your Linux flavor, use your favorite package manager such as apt-get
or install via rpm.

Once PostgreSQL is installed, configure the service to start automatically.(May be different
on other non-Red Hat based Linux distributions)
	/sbin/chkconfig postgresql on
	/sbin/chkconfig postgresql start





Configuring PostgreSQL

Now it's time to start the interactive shell and setup the initial PostgreSQL database and setup
a Table Owner account, someone who will have the power to create databases, add users, and change
general database structure.
	su – postgres
	psql template1
	createuser -a -d -P <chooseausername>


Generally the STORE table owner is named BERN, and this is the default name given in VisualWorks.

Next we will add the database users, which will also be the store user accounts. These accounts
do not need to be able to create databases, or add users, so we use the -D and -A switches here.
Repeat this step for however many different users you want to create.
	createuser -A -D -P <username here>


Creating user groups will not be discussed in this tutorial, as we had no need for this option while
managing our projects for our team.

You will also naturally have to create a database for STORE to use. Execute the following
	createdb <dbnamehere>





Configuring the STORE repository

We have no completed the actual PostgreSQL installation and configuration It is time to initialize
the STORE tables. Launch VisualWorks and open up a Workspace.

Evaluate the following expression and run it using the “Do It” button.
	Store.DbRegistry installDatabaseTables


You will now be prompted to connect to a Store database. Log on as the Table Owner administrative
user you had created.

The environment string is an identifier specifying the server address and the database name.
Example: 192.168.1.100_databaseName. You can use hostnames or IP addresses. Test.com_testDB. If you
are not running PostgreSQL on the default post, you will also have to specify it using the
following format: Test.com:5555_testDB.

You will be prompted to install the tables, confirm by clicking OK.
Next you can opt to install user management tables, we did not cover this in the tutorial, so click No.
Finish by accepting this last prompt.

You have now completed the STORE configuration.


Using STORE repository

To use the STORE functionalities for your team, distribute the usernames/passwords that you had
created earlier. When you want to connect to the STORE repository, go to the main VisualWorks window,
Select STORE from the menu, connect to repository, and fill out the information associated with your
repository. If you have completed all the steps, you should be able to connect.

To publish things to your repository, simple right click a bundle or package, and select publish.
Alternatively to Load items from the repository, connect to it and use the Published items option under
the STORE menu to browse published items in the repository. Select the item you'd like to load, right
click, and load.


Links to this Page