Message-ID: <22579960.487.1711698343422.JavaMail.serveradmin@t01app> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_486_11785532.1711698343421" ------=_Part_486_11785532.1711698343421 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html Confluence 3.5+ Setup

Confluence 3.5+ Setup

 

=20 =20

Introduction

This article takes you through a Confluence 3.5+ setup using the followi= ng software stack,

  1. Confluence Standalone (includes its own embedded Tomcat) for Linux
  2. Java Development Kit (JDK)
  3. PostgreSQL
  4. Apache Web Server (optional)

It is recommended that you finish reading the article before starting.

PostgreSQL

Confluence comes with its own embedded database called hsqldb. However, = for real production use you should use a full fledged database like Postgre= SQL.

Install PostgreSQL= on Ubuntu

Install PostgreSQL6.0 Po= stgreSQL on Ubuntu.

Install Confluence

Core Package

Download the tar.gz install package and decompress it,

=20
su - se=
rveradmin # if you are not already
gunzip confluence-3.5.7-std.tar.gz
tar -xvpf confluence-3.5.7-std.tar
su - bhitch # log in as a staff user that can run sudo
# Use specific version numbers. This will make upgrade easier in the future=
.
sudo mv home/serveradmin/confluence-3.5.7-std /opt/
=20

Next, we make the symbolic link directory. Scripts and anything else you= do will use the symbolic link directory. When the new version of Confluenc= e comes along you have various options for upgrading.

=20
su - bh=
itch # log in as a staff user that can run sudo
cd /opt
# make a symbolic link which scripts and commands can run against
sudo ln -s ./confluence-3.5.7-std ./confluence
=20

Manually Setup JDK

I use a manual Java setup with an instance of Java specifically for the = application.

Make sure you are install a JDK and not  a JRE. This is a requirement o= f Confluence.

Go to the Java website, choose the 64-bit JRE (Java = Runtime Engine). Download the .tar.gz file and upload= the file to the serveradmin home folder. For older versions of Java go to = the Java Archives site.

Use the account that will be launching the Java process. In this example= it will be serveradmin,

=20
su - se=
rveradmin # If you are not already serveradmin
cd ~
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=3D=
accept-securebackup-cookie" http://download.oracle.com/otn/java/jdk/7u7-b10=
/jre-7u7-linux-x64.tar.gz
=20

The steps for JRE and JDK are both the same. Here is an example of a JRE setup,

=20
su - se=
rveradmin # If you are not already serveradmin
cd ~ # Switch to the serveradmin home directory
tar -xvpf jre-7u7-linux-x64.tar.gz
=20

The result will be an uncompressed jre directory using the same name as = the package. In this example the folder name would be, jre-7u7-linu= x-x64.

If you plan to use multiple versions of Java, we recommend keeping the f= older name with the version number information and using symbolic links. If= you are only using one version of Java, then simply rename the folder.

For the server example, we will rename the folder,

=20
mv jre-=
7u7-linux-x64 java
=20

You may be interested in how to Zero Footprint Java on Windows.

Log in as your staff account which has sudo access to perform the actual= move to /opt/

=20
cd /hom=
e/serveradmin
sudo mv ./jdk1.6.0_16/ /opt/confluence/java # moves and renames the directo=
ry in one step
=20

Configure Conflu= ence to Use JDK

The downloaded Confluence package is powered by Tomcat. You can specify = Tomcat use a specific java directory by modifying the Conf= luence confluence/bin/setenv.sh file and test with confluence/bin/version.sh as described at Running Tomcat with a specifi= c JRE version.

This can be improved by moving "how to specify java for Tomcat" out of t= he Tomcat 6 setup instructions into a separate page and then using an "incl= ude" here.

Configure Confluence to Only Start and Stop with ServerAdmin

To prevent read errors and for security purposes we want Confluence to o= nly run as serveradmin.

Modify /opt/confluence/bin/startup.sh and /opt/= confluence/bin/shutdown.sh as instructed in "Only Allow serveradmi= n to Run Tomcat" at Portable Tomcat 6.x & Instances.

Configure Data Direct= ory

Also we need to create the home directory,

=20
su - se=
rveradmin
cd ~
mkdir confluence-data # Don't use specific version numbers here because the=
 data will actually be upgraded
su - bhitch # to get sudo access
sudo mv /home/serveradmin/confluence-data /opt/
=20

As serveradmin, set the home (data) directory by adding confluence.home = to the bottom of, /opt/confluence/confluence/WEB-INF/classes/conflu= ence-init.properties,

=20

# confluence.home=3Dc:/confluence/data
confluence.home=3D/opt/conflu= ence-data/

=20

Configure PostgreSQL

Setup Database

These are the command line version of the instructions from Confluences wiki on= setting up an external database.

The commands were derived from the visual guide by Confluence.

First log into the PostgreSQL prompt as explain in PostgreSQL on Ubuntu.

Create the confluence database admin account.

Make sure to change putYourPasswordHere to a secure pas= sword.

=20
CREATE R=
OLE confluencedbuser LOGIN ENCRYPTED PASSWORD 'putYourPasswordHere'
NOINHERIT
VALID UNTIL 'infinity';
COMMENT ON ROLE confluencedbuser IS 'Account used by the Confluence applica=
tion.';
=20

The servers will respond to each respective command,

=20
CREATE R=
OLE
COMMENT
=20

Create the database.

=20
CREATE D=
ATABASE confluencedb
WITH ENCODING=3D'UTF8'
OWNER=3Dconfluencedbuser
CONNECTION LIMIT=3D-1;
=20

If all goes well the response will be,

=20
CREATE D=
ATABASE
=20

Finally quit the PostgreSQL prompt,

=20
\q
= =20

The name of the database is different than in the confluence documentati= on. Rather than the database name confluence, we use confluencedb to clearl= y designate a database.

Setup JDBC4 Driver

As of Confluence 3.5.1 the PostgreSQL JDBC4 driver is now included. This= section is still useful as a reference for future version mismatches.

Confluence 3.2 - 3.5.0 does include a JDBC driver for PostgreSQL. Howeve= r, because we are using the newest version of Java, download the JDBC4 driv= er from the PostgreSQL website and place the jar fil= e into the /opt/confluence/confluence/WEB-INF/lib/ directory. Then delete t= he old JDBC4 driver.

=20
su - se=
rveradmin
wget http://jdbc.postgresql.org/download/postgresql-9.0-801.jdbc4.jar
rm /opt/confluence/confluence/WEB-INF/lib/postgresql-8.4-701.jdbc3.jar=20

Starting the Co= nfluence Service

We will now start Confluence for the first time to initialize everything= .

If using virtual machine technology, now would be a good time to take a = snapshot of the system.

=20
cd /opt=
/confluence/bin/
./startup.sh
=20

Next, hit the website with a browser, http://krypton:8080/ to start t= he first time configuration wizard.

If you have been following these notes on how to setup Ubuntu, your firewall may = be enabled. Make sure to enable access to port 8080.

Step through the configuration wizard and make the following selections,=

  1. Choose Product Installation
  2. Makes sure PostgreSQL is selected (it should be by def= ault) click External Database.
  3. Click Direct JDBC
  4. Fill out the form,
    1. Database URL: Change the default line, jdbc:postgresql://localhost:5432= /confluence to jdbc:postgresql://localhost:5432/confluencedb
    2. User: confluencedbuser
    3. Pass: the pasword you used earlier to create the confluencedb user
    4. Click Next

At this point if you happen to be monitoring your system you should see = a spike in CPU and confluence slowly taking up more memory. Be patient as t= his step can take a few minutes as the tables and contents of the database = are generated.

If all goes well the you will be prompted to Load Content. You can opt t= o load some default content, start with a blank slate or restore from backe= d up data if you are rebuilding from a previous installation of Confluence.=

The intial user will be called "Server Admin" with user name serveradmin=

Stopping the Service

There appears to be a problem with shutting down the Confluence server= . According to Atlassian, this only happens on certain configuration an= d they are not able to determine yet why. I have personally experienced wit= h every type of Virtualized Ubuntu system I have setup over the past few ye= ars.

Start by trying to perform a normal shutdown,

=20
su - sv=
radm
/opt/confluence/bin/shutdown.sh
=20

Next ensure that Confluence actually shut down,

=20
ps -ef =
| grep java | grep confluence
=20

The resulting output shows all your java processes. Look for you Conflue= nce java process which looks something similar to below,

=20
svradm =
   2364     1  0 01:00 ?        00:02:37 /opt
=20

If it does not exist then the shutdown occurred properly. However, if it= still exists try running ps again in a few minutes. If it still exists aft= er that you need to kill the process,

=20
kill 23=
64 # Note change 2364, to the process ID that you see on your screen.
= =20

Administrator Tasks

This section still needs to be written to take the user through setting = up the base url, creating their first space, disabling automatic backup, ho= w to do real backups and any other important activities.

Setup Confluence= to Send Emails

Confluence can send email notifications for updates and also used to per= form user setup and password resets.

Setup your server to= allow Email Delivery.

Verify Confluence can send emails using Confluence Administration, Mail = Servers and Send test email link.

Op= timize Confluence

There are some basic tasks we should do before getting other people on b= oard.

Once logged in go to, Browser, Confluence Admin. There are tasks there t= hat Confluence recommends, the most important to us being,

These instructions should be written with more detail. Particularly, "Se= tup email".

  1. Disable automatic backup
  2. Setup Confluence to send emails
  3. Update Confluence plugins

Connect= Apache to Confluence using Mod_JK

As this install of Confluence is powered by Tomcat we can front Confluen= ce with the Apache Web Server.

Enable Tomcat AJP C= onnector

First we must enable the the Connector. In this example we will use the = standard port 9009 in the Confluence Tomcat. Edit /opt/confluence/c= onf/server.xml.

Add the Connector directive <Connector port= =3D"8009" protocol=3D"AJP/1.3 "URIEncoding=3D"UTF-8" /> just ab= ove the Engine directive,

=20
useURIVa=
lidationHack=3D"false" URIEncoding=3D"UTF-8"/>

        <Connector port=3D"8009" protocol=3D"AJP/1.3" URIEncoding=3D"UTF=
-8" />

        <Engine name=3D"Standalone"
=20

The UTF-8 is important as Confluence is developed to post using UTF-8.

Without this setting errors occur= when working with attachments containing special characters. Further detai= ls are covered in the Bonsai Tomcat Connector article.

Select and Enable= Context Path

Often you want to use the Apache Web Server to front more than one web a= pplication. In order to do this you want each web application to work withi= n it's own context. This is pretty standard in most java applications. As s= uch, we will pick a context path, in this case "wiki". As such the original= url, http://localhost:8080/ changes to http://localhost:8080/wik= i

Modify the bundled Confluence Tomcat Context directive = and change the attribute path=3D"" to path=3D"/wik= i",

=20
<Con=
text path=3D"/wiki" docBase=3D"../confluence" debug=3D"0" reloadable=3D"fal=
se" useHttpOnly=3D"true">
=20

This change does not take effect until the Confluence service stopped an= d started again. We will do that in the the next section.

Configure Apa= che Tomcat Connector

Still need to fill in clearer instructions on this topic.

Once port 8009 is enabled, mod_jk can be enabled by following the Apache To= mcat Connector instructions.

Change Base Url in= Confluence

Put instructions here about changing the base url if fronted by Apache.<= /p>

Verify In= ternationalization Features

Even if you do not plan to have the wiki work for multiple languages, yo= u should verify the internationalization is working properly just to handle= special characters.

Visit the http://<host address>:<port>/admin/encodin= gtest.action url on your system and follow the instructions.

Future Upgrade Notes

As part of planning for future upgrades here is a checklist to keep in m= ind.

Backup Your Data

It goes without saying, backup your data. With Cloud and Virtual computi= ng take a snap shot. With manual backups you can use Confluence's built in = backup utility (provide link to instructions) or manually make the followin= g backups,

Database Password

Make sure you know the admin password for your database.

Key Files

Optionally, if there was a version mismatch with the jdbc driver,

Special Modifications

You may choose to modify special files. For  example, I modify the footer,

  • /opt/confluence/confluence/decorators/includes/footer-content.vm

Plug-Ins

Also, keep a page listing any plug-ins you install. Upgrades generally d= o not require you to reinstall the plugins but they might be deprecated. Af= ter the upgrade is done, login as Administrator on Confluence and ensure pl= ug-ins are up to date.

Disable Search E= ngine Indexing

In the case of a private site, you may not want Google or any other sear= ch engine to crawl your wiki. Even in the case of a password protected site= this will still happen and take up unnecessary bandwidth, processing and b= ump up the amount of memory consumed by Confluence.

This content needs to be refined and should in fact link to a detailed a= rticle on robots.txt and other ways of preventing crawling.

If you had been following the steps outline by the Bonsai Framework the = Confluence configuration will be,

As such, robots.txt will be placed in the root of the website and look l= ike this,

=20
User-ag=
ent: *
Disallow: /wiki/
=20

System Profile

Using htop, initial setup without any spaces created is 396MB. The proce= ss itself uses  VIRT=3D913M and RES=3D338M.

#!/bin/sh

# Bonsaiframework - Modification Start
# ---------------------------= -----------
if [ "$LOGNAME" !=3D "svrdm" ]; then
echo "This service= should only managed with the user svradm"
exit 1
fi
# --------= ------------------------------
# Bonsaiframework - Modification End

------=_Part_486_11785532.1711698343421--