aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-docs/src/site/apt/adminguide/databases.apt
blob: 8adb560ae76998a72ef384f06f7ca7f44aa547fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
 ------
 Apache Archiva Databases
 ------
 Olivier Lamy
 ------
 2011-10-06
 ------

~~ Licensed to the Apache Software Foundation (ASF) under one                      
~~ or more contributor license agreements.  See the NOTICE file                    
~~ distributed with this work for additional information                           
~~ regarding copyright ownership.  The ASF licenses this file                      
~~ to you under the Apache License, Version 2.0 (the                               
~~ "License"); you may not use this file except in compliance                      
~~ with the License.  You may obtain a copy of the License at                      
~~                                                                                 
~~   http://www.apache.org/licenses/LICENSE-2.0                                    
~~                                                                                 
~~ Unless required by applicable law or agreed to in writing,                      
~~ software distributed under the License is distributed on an                     
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY                          
~~ KIND, either express or implied.  See the License for the                       
~~ specific language governing permissions and limitations                         
~~ under the License.                                                              

Apache Archiva Databases

  Archiva uses an external database for one purpose:

    * As a default user store for security

    []

  Generally, it is unnecessary to configure anything - the built in embedded database is suitable for the artifact management, and if
  an external authentication mechanism is not needed, the user database.

  However, it is possible to configure an external database as needed.

* Configuring an external database

  Archiva uses JNDI data sources to locate the databases to use:

    * <<<jdbc/users>>> - the user store

  Configuring an external database for either or both of these sources depends is configured in <<<jetty.xml>>> if you are using the
  {{{./standalone.html} standalone installation}}, or in the application server configuration if you are using the {{{./webapp.html} web application
  installation}}.

  By default the archiva and users databases are stored in the <<<databases>>> directory where Archiva is installed. To change the
  path, just edit all instances of the "DatabaseName" property in <<<conf/jetty.xml>>> (see below). 

  <<Note:>> If you are using MySQL as your database, Archiva fails when the users database created is initially set to UTF-8 for the character encoding. 
  As a workaround, set the database to UTF-8 encoding after it has been populated. See {{{http://jira.codehaus.org/browse/MRM-1373} MRM-1373}} for more details.

+------+
...

<New id="users" class="org.mortbay.jetty.plus.naming.Resource">
  <Arg>jdbc/users</Arg>
  <Arg>
    <New class="org.apache.derby.jdbc.EmbeddedDataSource">
      <Set name="DatabaseName">/path/to/database/directory/users</Set>
      <Set name="user">sa</Set>
      <Set name="createDatabase">create</Set>
    </New>
  </Arg>
</New>

<New id="usersShutdown" class="org.mortbay.jetty.plus.naming.Resource">
  <Arg>jdbc/usersShutdown</Arg>
  <Arg>
    <New class="org.apache.derby.jdbc.EmbeddedDataSource">
      <Set name="DatabaseName">/path/to/database/directory/users</Set>
      <Set name="user">sa</Set>
      <Set name="shutdownDatabase">shutdown</Set>
    </New>
  </Arg>
</New>
...
+------+

* Backing up the database

  While it is a good idea to back up both databases, it is not strictly necessary to back up the repository database on a regular basis. Should any
  data loss be suffered, this database can be regenerated by deleting it's contents and re-scanning the repositories.

  If you are using the default user security mechanism, it is important to back up the users database on a regular basis to ensure that the user
  passwords and information are not lost in the event of corruption. With the default embedded storage this is simply a matter of making a copy of
  the database directory on the filesystem. If you have configured an external database as the source for user information, please refer to your
  database documentation for backup instructions.
  
~~TODO: link to wiki location that does others