-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
1,945 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip | ||
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,29 @@ | ||
# Boxitory | ||
|
||
is repository for Vagrant's Virtual Machine boxes, which can manage box versions and provides *Vagrant* compatible http interface. | ||
is repository for Vagrant's Virtual Machine boxes, which can manage box versions and provides *Vagrant* compatible http interface. Boxes are stored on local filesystem. | ||
|
||
Download [Latest release](https://github.com/sparkoo/boxitory/releases/latest) | ||
|
||
For more info how it works, how to configure, ... [See Wiki](https://github.com/sparkoo/boxitory/wiki) | ||
|
||
## Build & run | ||
|
||
`./mvnw install && java -jar target/boxitory-{version}.jar` | ||
``` | ||
$ ./mvnw install && java -jar target/boxitory-{version}.jar | ||
``` | ||
or | ||
``` | ||
$ ./mvnw spring-boot:run | ||
``` | ||
|
||
By default, http server will start on port *8083*. | ||
|
||
#### Build status (travis-ci) | ||
|
||
devel [![Build Status](https://travis-ci.org/sparkoo/boxitory.svg?branch=devel)](https://travis-ci.org/sparkoo/boxitory) | ||
|
||
master: [![Build Status](https://travis-ci.org/sparkoo/boxitory.svg?branch=master)](https://travis-ci.org/sparkoo/boxitory) | ||
|
||
## How it works | ||
|
||
*Boxitory* currently implements just filesystem box provider. That requires strict folder structure. | ||
devel [![Build Status](https://travis-ci.org/sparkoo/boxitory.svg?branch=devel)](https://travis-ci.org/sparkoo/boxitory) | ||
[![codecov](https://codecov.io/gh/sparkoo/boxitory/branch/devel/graph/badge.svg)](https://codecov.io/gh/sparkoo/boxitory) | ||
|
||
### Box files on filesystem | ||
|
||
There must be one home folder for all boxes with subfolders for each box type. Individial box versions must be named `{name}_{version}_{provider}.box`. | ||
|
||
See example below: | ||
``` | ||
$ tree test_repository/ | ||
test_repository/ | ||
├── f25 | ||
│ ├── f25_1_virtualbox.box | ||
│ └── f25_2_virtualbox.box | ||
├── f26 | ||
│ ├── f26_1_virtualbox.box | ||
│ ├── f26_2_virtualbox.box | ||
│ └── f26_3_virtualbox.box | ||
``` | ||
|
||
### Http interface | ||
|
||
Server starts at port *8083* and boxes can be requested on `http://hostname:port/box_name` for example: | ||
``` | ||
$ curl http://localhost:8083/f26 | ||
{ | ||
"name": "f26", | ||
"description": "f26", | ||
"versions": [ | ||
{ | ||
"version": "1", | ||
"providers": [ | ||
{ | ||
"url": "sftp://my_box_server:/tmp/test_repository/f26/f26_1_virtualbox.box", | ||
"name": "virtualbox" | ||
} | ||
] | ||
}, | ||
{ | ||
"version": "2", | ||
"providers": [ | ||
{ | ||
"url": "sftp://my_box_server:/tmp/test_repository/f26/f26_2_virtualbox.box", | ||
"name": "virtualbox" | ||
} | ||
] | ||
}, | ||
] | ||
} | ||
``` | ||
master: [![Build Status](https://travis-ci.org/sparkoo/boxitory.svg?branch=master)](https://travis-ci.org/sparkoo/boxitory) | ||
|
||
## Configuration | ||
|
||
### Options | ||
* `box.home` | ||
* path where to find boxes | ||
* in example above, it will be set to `/tmp/test_repository` | ||
* **default value**: `.` | ||
* `box.prefix` | ||
* prefix for the output json, that is prepend before absolute local path of the box | ||
* do define for example protocol or server, where boxes are placed | ||
* e.g.: `sftp://my_box_server:` | ||
* **default value**: *empty* | ||
* `box.sort_desc` | ||
* boolean value `true|false` | ||
* when default or `false`, boxes are sorted by version in ascending order | ||
* when `true`, boxes are sorted by version in descending order | ||
* default value: `false` | ||
* `box.checksum` | ||
* string value: `disabled|md5|sha1|sha256` | ||
* default value: `disabled` | ||
* when default or `disabled` boxes output json not contains properties `checksumType` and `checksum` | ||
* when `md5|sha1|sha256` boxes output json contains properties `checksumType` and `checksum` with coresponding values | ||
### Advanced Options | ||
* `box.checksum_buffer_size` | ||
* Box file is loaded to this buffer to calculate box checksums | ||
* default value: `1024` | ||
|
||
### How to configuration | ||
Configuration can be provided by `application.properties` file on classpath | ||
``` | ||
# application.properties | ||
box.home=/tmp/test_repository | ||
box.prefix=sftp://my_box_server: | ||
``` | ||
or as command line arguments `java -jar -Dbox.home=/tmp/test_repository target/boxsitory-${version}.jar` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
box.home=/custom/test/repository/path | ||
box.host_prefix=sftp://localhost: | ||
server.port=8083 | ||
box.checksum=disabled | ||
|
||
box.sort_desc=false | ||
|
||
box.checksum=md5 | ||
box.checksum_buffer_size=1024 | ||
box.checksum_persist=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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/xsd/maven-4.0.0.xsd"> | ||
<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/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>cz.sparko.boxitory</groupId> | ||
<artifactId>boxitory</artifactId> | ||
<version>1.2.0</version> | ||
<version>1.2.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>boxitory</name> | ||
<description>Demo project for Spring Boot</description> | ||
<description>Vagrant box repository</description> | ||
<url>https://github.com/sparkoo/boxitory</url> | ||
<developers> | ||
<developer> | ||
<name>sparkoo</name> | ||
<url>https://github.com/sparkoo</url> | ||
</developer> | ||
</developers> | ||
<contributors> | ||
<contributor> | ||
<name>D3ryk</name> | ||
<url>https://github.com/D3ryk</url> | ||
</contributor> | ||
</contributors> | ||
<organization> | ||
<name>sparkoo</name> | ||
<url>https://github.com/sparkoo</url> | ||
</organization> | ||
|
||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>1.5.3.RELEASE</version> | ||
<relativePath /> <!-- lookup parent from repository --> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
|
||
<issueManagement> | ||
|
@@ -34,8 +52,8 @@ | |
<url>https://github.com/sparkoo/boxitory</url> | ||
<connection>scm:git:git://github.com/sparkoo/boxitory.git</connection> | ||
<developerConnection>scm:git:[email protected]:sparkoo/boxitory.git</developerConnection> | ||
<tag>v1.2.0</tag> | ||
</scm> | ||
<tag>HEAD</tag> | ||
</scm> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
|
@@ -94,8 +112,48 @@ | |
<artifactId>maven-release-plugin</artifactId> | ||
<version>2.5.3</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>cobertura-maven-plugin</artifactId> | ||
<version>2.7</version> | ||
<configuration> | ||
<formats> | ||
<format>html</format> | ||
<format>xml</format> | ||
</formats> | ||
<instrumentation> | ||
<ignoreTrivial>true</ignoreTrivial> | ||
</instrumentation> | ||
<check/> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.20</version> | ||
<configuration> | ||
<excludedGroups>e2e</excludedGroups> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>2.18.1</version> | ||
<configuration> | ||
<groups>e2e</groups> | ||
<includes> | ||
<include>**/*Test.java</include> | ||
</includes> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 7 additions & 4 deletions
11
src/main/java/cz/sparko/boxitory/conf/NotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
package cz.sparko.boxitory.conf; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
import org.springframework.web.client.HttpClientErrorException; | ||
|
||
@ResponseStatus(value = HttpStatus.NOT_FOUND) | ||
public class NotFoundException extends RuntimeException { | ||
public class NotFoundException extends HttpClientErrorException { | ||
public NotFoundException(String message) { | ||
super(message); | ||
super(HttpStatus.NOT_FOUND, message); | ||
} | ||
|
||
public static NotFoundException boxNotFound(String boxName) { | ||
return new NotFoundException("box [" + boxName + "] does not exist"); | ||
} | ||
} |
Oops, something went wrong.