This is a guide for PostgreSQL databases only.

Some information you will need

You first need to gather some information about the database server. You will need the hostname, port, database name and password. You can find all that information in the Continua.Server.Service.exe.config file. The default location is: C:\Program Files\VSoft Technologies\ContinuaCI\Server

After opening the file, look for this section:


<!-- Current -->
<property name="connection.driver_class">NHibernate.Driver.NpgsqlDriver</property>
<property name="dialect">NHibernate.Dialect.PostgreSQL82Dialect</property>
<property name="connection.connection_string">Server=127.0.0.1;Port=9001;Database=ContinuaCI;User Id=postgres;Password=dsf99EDF983245LJfsdf;MinPoolSize=10;MaxPoolSize=256</property>

The last line contains all the information you need to connect to backup/restore the database.


Backing up

The program used to dump the database is called pg_dump.exe, a copy of it comes with the ContinuaCI Server installer and can be found in the %InstallDirectory%\Server\PostgreSQL\bin, the default location is C:\Program Files\VSoft Technologies\ContinuaCI\Server\PostgreSQL\bin.

pg_dump.exe has many options, the ones we recommend are the following:


Option
-h

'127.0.0.1' if you're on the same machine as the Continua database server

-p9001 is the default port we use when installing Continua.
-Upostgres is the default username when installing Continua
-F pThis outputs the database in plain text which equates to SQL commands
-f <backup_filename>The full path and file name where the database backup will be written to.
<database_name>The final option is the database name which is ContinuaCI by default.


The final command then will look something like this:

pg_dump.exe -h localhost -p 9001 -U postgres -F p -f C:\continua_backup.bak ContinuaCI

The pg_dump command will require a password after connecting to the postgres server. There are 3 ways to enter the password:

  1. After executing the command, you will be prompted for the password which you will be able to type in at the command line.
  2. pg_dump will look for the environment variable PGPASSWORD. If you store the database password here, pg_dump will use it. This method isn't recommended as it's the least secure.
  3. Store the password in pgpass.conf. The location of this file is C:\Users\<user_name>\AppData\Roaming\postgresql\pgpass.conf. This .conf file should take the following format:

    <host_name>:<port>:<database>:<username>:<password>
     
    //for example:
    localhost:9001:*:postgres:password


    This method is considered most secure as you can set permissions on the file. More information on the pgpass.conf file can be found at http://www.postgresql.org/docs/8.2/static/libpq-pgpass.html


Restoring

Make sure you've read Some information you will need and Backing up before proceeding.

When pg_dump was executed, the -F p option was given. This means the backup file contains a list of sql commands with the data requires to re-create your database. To restore this type of backup file you need to use the psql.exe command. The default location of this file is: C:\Program Files\VSoft Technologies\ContinuaCI\Server\PostgreSQL\bin.

The options to use when restoring a database with psql are:

Option
-h

'127.0.0.1' if you're on the same machine as the Continua database server

-p9001 is the default port we use when installing Continua.
-Upostgres is the default username when installing Continua
<database_name>Usually ContinuaCI by default.
<backup_file>Full path and file name of the file created from running pg_dump.exe

Using the information gathered from the Continua.Server.Service.exe.config file, the restore command will look something like this:

psql.exe -h localhost -p 9001 -U postgres ContinuaCI < C:\continua_backup.bak

The password requires are the same as pg_dump. Please make sure you read the Backing up section for ways to managing the input of the password.

Note: When restoring the database, take note that you specify the database name. You will either need to delete the old ContinuaCI database then restore it, or restore it to a different name. If you restore it to a different name you can then rename the old ContinuaCI database, then rename the newly restored to ContinuaCI. Alternatively, you can restore it to any name you like then modify the Continua.Server.Service.exe.config file's Database= property to your new database name. That way you're able to start the ContinuaCI server with the new database before and switch back to the old one if you need to.