Skip to content

Commit

Permalink
ZNTA-2225 - define java.home sys prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Huang committed Oct 3, 2017
1 parent d0399fb commit e23b3c0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
22 changes: 22 additions & 0 deletions docs/user-guide/system-admin/configuration/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,28 @@ Zanata does not create an admin user by default. You need to register specific u
```

This is the default email address that will appear as the sender on Zanata emails.

Zanata will store some files on file system. You will need to define a system property.
```xml
<system-properties>
...
<property name="zanata.home" value="/example/path"/>
...
</system-properties>
```
The value should be a path that has read and write permission from jboss user. You can define individual system properties for each storage below or they will derive from above zanata.home directory (e.g. as sub directory).

- zanata.file.directory
- hibernate.search.default.indexBase

You can also define a system property for Javamelody (the server monitoring tool Zanata uses)
```xml
<system-properties>
...
<property name="javamelody.storage-directory" value="${zanata.home}/stats"/>
...
</system-properties>
```

Alternatively, you can pass this and other system properties to JBoss when starting it (see JBoss documentation for details on how to do this).

Expand Down
5 changes: 2 additions & 3 deletions server/docker/conf/zanata-config.cli
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ embed-server --std-out=echo --server-config=standalone-full.xml
batch

# ==== system properties /system-property=foo:add(value=bar) ====
/system-property="javamelody.storage-directory":add(value="${user.home}/zanata/stats: ")
/system-property="hibernate.search.default.indexBase":add(value="${user.home}/zanata/indexes: ")
/system-property="zanata.home":add(value="${user.home}/zanata")
/system-property="javamelody.storage-directory":add(value="${zanata.home}/stats")
/system-property="jboss.as.management.blocking.timeout":add(value="1000")
/system-property="zanata.security.authpolicy.internal":add(value="zanata.internal")
/system-property="zanata.security.authpolicy.openid":add(value="zanata.openid")
/system-property="zanata.email.defaultfromaddress":add(value="no-reply@zanata.org")
/system-property="zanata.file.directory":add(value="${user.home}/zanata/files: ")
/system-property="zanata.support.oauth":add(value="true")
## Allows the editor development server to use the docker server as a backend.
## The editor development server is run with `make watch` in zanata-frontend/src/editor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.slf4j.LoggerFactory;
import org.zanata.security.AuthenticationType;

import java.io.File;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
Expand Down Expand Up @@ -56,12 +57,12 @@ public class SystemPropertyConfigStore implements ConfigStore {
"zanata.file.directory";
private static final String KEY_HIBERNATE_SEARCH_INDEX_BASE =
"hibernate.search.default.indexBase";
// unfortunately we can't derive javamelody directory from zanata.home because it's used inside javamelody
private static final String KEY_JAVAMELODY_STORAGE_DIRECTORY =
"javamelody.storage-directory";

private static final String KEY_ZANATA_HOME = "zanata.home";
private static final Set<String> REQUIRED_PROP_KEYS = ImmutableSet
.of(KEY_DOCUMENT_FILE_STORE, KEY_JAVAMELODY_STORAGE_DIRECTORY,
KEY_HIBERNATE_SEARCH_INDEX_BASE);
.of(KEY_ZANATA_HOME, KEY_JAVAMELODY_STORAGE_DIRECTORY);

/**
* Server-wide switch to enable/disable OAuth support
Expand Down Expand Up @@ -125,11 +126,15 @@ public String getDefaultFromEmailAddress() {
}

public String getDocumentFileStorageLocation() {
return System.getProperty(KEY_DOCUMENT_FILE_STORE);
return System.getProperty(KEY_DOCUMENT_FILE_STORE, new File(getZanataHome(), "file").getAbsolutePath());
}

public String getHibernateSearchIndexBase() {
return System.getProperty(KEY_HIBERNATE_SEARCH_INDEX_BASE);
return System.getProperty(KEY_HIBERNATE_SEARCH_INDEX_BASE, new File(getZanataHome(), "indexes").getAbsolutePath());
}

public String getZanataHome() {
return System.getProperty(KEY_ZANATA_HOME);
}

public Map<AuthenticationType, String> getLoginModuleNames() {
Expand Down

0 comments on commit e23b3c0

Please sign in to comment.