Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gary-rowe committed Apr 2, 2014
1 parent 896b84b commit c82cf05
Show file tree
Hide file tree
Showing 26 changed files with 1,577 additions and 16 deletions.
26 changes: 25 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# Eclipse
.classpath
.project
.settings/

# Intellij
.idea/
*.iml
*.iws

# NetBeans
nb*.xml

# Sublime
*.sublime-project
*.sublime-workspace

# Mac
.DS_Store

# Maven
target/

# Java
*.class

# Mobile Tools for Java (J2ME)
Expand All @@ -8,5 +32,5 @@
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
# Virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
4 changes: 4 additions & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The following people provided their time and effort to building this website (in first name alphabetical order):

Gary Rowe
Jim Burton
23 changes: 11 additions & 12 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ The MIT License (MIT)

Copyright (c) 2014 Bitcoin Solutions Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
74 changes: 71 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,72 @@
brit-server
===========
## MultiBit BRIT Server

A Dropwizard implementation of a BRIT server
This repo contains the source for the MultiBit BRIT server.

From a technical point of view this project uses

* Java - Primary language of the app
* [Maven](http://maven.apache.org/) - Build system
* [Dropwizard](http://dropwizard.io) - Self-contained web server

## Branches

We follow the ["master-develop" branching strategy](http://nvie.com/posts/a-successful-git-branching-model/).

This means that the latest release is on the "master" branch (the default) and the latest release candidate is on the "develop" branch.
Any issues are addressed in feature branches from "develop" and merged in as required.

#### Verify you have Maven 3+

Most IDEs (such as [Intellij Community Edition](http://www.jetbrains.com/idea/download/)) come with support for Maven built in,
but if not then you may need to [install it manually](http://maven.apache.org/download.cgi).

IDEs such as Eclipse may require the [m2eclipse plugin](http://www.sonatype.org/m2eclipse) to be configured.

To quickly check that you have Maven 3+ installed check on the command line:
```
$ mvn --version
```

#### Manually build and install MultiBit HD BRIT

At present it is necessary to checkout [multibit-hd](https://github.com/bitcoin-solutions/multibit-hd/) and build it manually. You will need to
use the HEAD of the `develop` branch.
```
$ mvn clean install
```

### Inside an IDE

Import the project as a Maven project in the usual manner.

To start the project you just need to execute `BritService.main()` as a Java application. You'll need a runtime configuration
that passes in `server brit-config.yml` as the Program Arguments.

On startup you will need to provide the passphrase for the Matcher key store. It is not persisted anywhere.

Open a browser to [http://localhost:9090/brit/public-key](http://localhost:9090/brit/public-key) and you should see the BRIT server
public key.

### Outside of an IDE

Assuming that you've got Java and Maven installed you'll find it very straightforward to get the BRIT server running. Just clone
from GitHub and do the following:

```
cd <project root>
mvn clean install
java -jar target/site-<version>.jar server brit-config.yml
```

where `<project root>` is the root directory of the project as checked out through git and `<version>` is the version
as found in `pom.xml` (e.g. "3.0.0") but you'll see a `.jar` in the `target` directory so it'll be obvious.

All commands will work on *nix without modification, use \ instead of / for Windows.

Open a browser to [http://localhost:9090/brit/public-key](http://localhost:9090/brit/public-key) and you should see the BRIT server
public key.

### Where does the ASCII art come from?

The ASCII art for the startup banner was created using the online tool available at
[TAAG](http://patorjk.com/software/taag/#p=display&f=Slant&t=BRIT%20Server)
51 changes: 51 additions & 0 deletions brit-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# ################################## Dropwizard specific settings ##################################

# Define the HTTP settings
http:
port: 9090
adminPort: 9091

logging:

level: WARN

# Logger-specific levels.
loggers:

# Set specific levels
#"com.sun.jersey.api.client": DEBUG
"com.yammer": INFO # See the banner
"org.multibit.hd": DEBUG

# ...
# Settings for logging to stdout.
console:

# If true, write log statements to stdout.
enabled: true

# Do not display log statements below this threshold to stdout.
threshold: ALL

# Settings for logging to a file.
file:

# If true, write log statements to a file.
enabled: false

# Do not write log statements below this threshold to the file.
threshold: ALL

# The file to which current statements will be logged.
currentLogFilename: /var/log/brit/developer.log

# When the log file rotates, the archived log will be renamed to this and gzipped. The
# %d is replaced with the previous day (yyyy-MM-dd). Custom rolling windows can be created
# by passing a SimpleDateFormat-compatible format as an argument: "%d{yyyy-MM-dd-hh}".
archivedLogFilenamePattern: /var/log/brit/developer-%d.log.gz

# The number of archived files to keep.
archivedFileCount: 5

# The timezone used to format dates. HINT: USE THE DEFAULT, UTC.
timeZone: UTC
122 changes: 122 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>org.multibit.hd</groupId>
<artifactId>brit-server</artifactId>

<!-- Only change this on a master or release branch -->
<version>develop-SNAPSHOT</version>

<url>http://localhost:9090</url>

<name>MultiBit BRIT Server</name>
<description>A BRIT server using Dropwizard</description>
<inceptionYear>2014</inceptionYear>

<!-- Set the version levels for linked dependencies -->
<properties>
<dropwizard.version>0.6.2</dropwizard.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<build>

<plugins>

<!-- All compilation is done under Java7 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<debug>true</debug>
</configuration>
</plugin>

<!-- Shade plugin is required to make a "slim" JAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.6</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/*.less</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.multibit.hd.brit.BritService</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>

<!-- Dropwizard framework -->
<!-- Core functionality -->
<dependency>
<groupId>com.yammer.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<!-- HTML Freemarker views support -->
<dependency>
<groupId>com.yammer.dropwizard</groupId>
<artifactId>dropwizard-views</artifactId>
<version>${dropwizard.version}</version>
</dependency>

<!-- Guava support library -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>14.0.1</version>
</dependency>

<!-- BRIT support -->
<dependency>
<groupId>org.multibit.hd</groupId>
<artifactId>mbhd-brit</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

<!-- Test libraries -->

<!-- Dropwizard resource testing support (includes JUnit, FEST etc) -->
<dependency>
<groupId>com.yammer.dropwizard</groupId>
<artifactId>dropwizard-testing</artifactId>
<version>${dropwizard.version}</version>
<scope>test</scope>
</dependency>

</dependencies>

</project>
27 changes: 27 additions & 0 deletions src/main/java/org/multibit/site/BritConfiguration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.multibit.site;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.yammer.dropwizard.config.Configuration;
import org.hibernate.validator.constraints.NotEmpty;

/**
* <p>DropWizard Configuration to provide the following to application:</p>
* <ul>
* <li>Initialisation code</li>
* </ul>
*
* @since 0.0.1
*  
*/
public class BritConfiguration extends Configuration {

@NotEmpty
@JsonProperty
private String matcherStoreDirectory ="/var/matcher";

public String getMatcherStoreDirectory() {
return matcherStoreDirectory;
}


}
Loading

0 comments on commit c82cf05

Please sign in to comment.