Overview
Installing
Configuration

Installing - Linux & Mac

CodeHistory is a Spring Boot Application and can be deployed in any way available for Spring Boot.

1. Check your version of Java

java -version

The version of Java should be 1.8.x or higher. If you don't see a supported version of Java, then download and install the Oracle JVM (JDK or JRE), or OpenJDK.

2. Download

Download the CodeHistory zip package and unzip the contents to any folder where you would like to host your web server (for example: /var/codehistory).

3. Configuration

Set values in json config or environment variables to initialize and index your repository.
For example: config.json for an open-source PDFBox repository:

{
  "REPO_PATH": "pdfbox",
  "REPO_URL": "https://github.com/apache/pdfbox",
  "REPO_FOLLOW_URL": "https://github.com/apache/pdfbox"
  "REPO_TYPE": "GITHUB",
  "REPO_COMMIT_URL_TEMPLATE": "%s/commit/%s",
  "ISSUE_TRACKER_TYPE": "JIRA",
  "ISSUE_TRACKER_URL": "https://issues.apache.org/jira",
  "DEFAULT_BRANCH": 'refs/remotes/origin/master',
}

To change the launch parameters, edit config_example.json. See Configuration - Options for available parameters.

4. Register as a Service

Register CodeHistory as a service. All methods described in the documentation are supported: Installing Spring Boot Applications - Unix/Linux Services.

Assuming that you have a CodeHistory installed in /var/codehistory, to install a CodeHistory as a systemd service, create a script named codehistory.service and place it in /etc/systemd/system directory.

Script example settings:

  • service directory: /var/codehistory
  • server port: 8080
  • config file: config_example.json

Script example:

[Unit]
Description=CodeHistory Service
StartLimitIntervalSec=0
After=syslog.target

[Service]
Type=simple
Restart=always
RestartSec=4
User=root
ExecStart=/bin/bash -c "/usr/bin/java -jar /var/codehistory/codehistory.jar /var/codehistory/config_example.json --server.port=8080"

[Install]
WantedBy=multi-user.target

Then flag CodeHistory to start automatically on system boot, using the following command:

sudo systemctl enable codehistory.service

Full Example

Ubuntu, service dir is /var/codehistory

Download CodeHistory zip package, then:

sudo mkdir /var/codehistory/
sudo unzip ~/Downloads/codehistory.zip -d /var/codehistory
sudo nano /etc/systemd/system/codehistory.service

Copy script content and save the file, then:

sudo systemctl enable codehistory.service
sudo systemctl start codehistory.service

To see the log:

sudo journalctl -u codehistory.service