Standalone Git LFS server
Go Shell
Latest commit 5d94047 Nov 13, 2016 @rubyist rubyist committed on GitHub Merge pull request #49 from shadyoak/unit-test-fixes
Fixed unit tests to run on Windows
Permalink
Failed to load latest commit information.
mgmt Merge branch 'mgmt-download-from-oid' of https://github.com/Yopai/lfs… Oct 1, 2015
script Fix release script Apr 29, 2015
vendor/github.com Move dependencies to vendor folder to be compatible with Go 1.5+ Jun 13, 2016
.dockerignore update some docker stuff Apr 2, 2015
.gitignore Make the management interface look a little nicer Apr 7, 2015
CONTRIBUTING.md Update CONTRIBUTING to reflect additions to the mgmt interface Apr 7, 2015
Dockerfile Remove personal info from Dockerfile Apr 3, 2015
LICENSE harbour => lfs test server Apr 6, 2015
README.md Add support for resuming uploads with tusd server Jun 14, 2016
config.go Add support for resuming uploads with tusd server Jun 14, 2016
content_store.go Fixed unit tests to run on Windows Jun 24, 2016
content_store_test.go Fixed unit tests to run on Windows Jun 24, 2016
kvlogger.go harbour => lfs test server Apr 6, 2015
main.go Add support for resuming uploads with tusd server Jun 14, 2016
meta_store.go More robust handling of PUT errors Oct 1, 2015
meta_store_test.go Fixed unit tests to run on Windows Jun 24, 2016
mgmt-css.rice-box.go Merge branch 'mgmt-download-from-oid' of https://github.com/Yopai/lfs… Oct 1, 2015
mgmt-templates.rice-box.go Merge branch 'mgmt-download-from-oid' of https://github.com/Yopai/lfs… Oct 1, 2015
mgmt.go Fixed unit tests to run on Windows Jun 24, 2016
server.go Fixed unit tests to run on Windows Jun 24, 2016
server_test.go Fixed unit tests to run on Windows Jun 24, 2016
tracking_listener.go Enough documentation to make golint happy Mar 26, 2015
tus.go Add support for resuming uploads with tusd server Jun 14, 2016

README.md

LFS Test Server

LFS Test Server is an example server that implements the Git LFS API. It is intended to be used for testing the Git LFS client and is not in a production ready state.

LFS Test Server is written in Go, with pre-compiled binaries available for Mac, Windows, Linux, and FreeBSD.

See CONTRIBUTING.md for info on working on LFS Test Server and sending patches.

Installing

Download the latest version. It is a single binary file.

Alternatively, use the Go installer:

  $ go install github.com/github/lfs-test-server

Building

To build from source, use the Go tools:

  $ go get github.com/github/lfs-test-server

Running

Running the binary will start an LFS server on localhost:8080 by default. There are few things that can be configured via environment variables:

LFS_LISTEN      # The address:port the server listens on, default: "tcp://:8080"
LFS_HOST        # The host used when the server generates URLs, default: "localhost:8080"
LFS_METADB      # The database file the server uses to store meta information, default: "lfs.db"
LFS_CONTENTPATH # The path where LFS files are store, default: "lfs-content"
LFS_ADMINUSER   # An administrator username, default: unset
LFS_ADMINPASS   # An administrator password, default: unset
LFS_CERT        # Certificate file for tls
LFS_KEY         # tls key
LFS_SCHEME      # set to 'https' to override default http
LFS_USETUS      # set to 'true' to enable tusd (tus.io) resumable upload server; tusd must be on PATH, installed separately
LFS_TUSHOST     # The host used to start the tusd upload server, default "localhost:1080"

If the LFS_ADMINUSER and LFS_ADMINPASS variables are set, a rudimentary admin interface can be accessed via http://$LFS_HOST/mgmt. Here you can add and remove users.

To use the LFS test server with the Git LFS client, configure it in the repository's .gitconfig file:

  [lfs]
    url = "http://localhost:8080/"

HTTPS:

NOTE: If using https with a self signed cert also disable cert checking in the client repo.

    [lfs]
        url = "https://localhost:8080/"

    [http]
        sslverify = false

An example usage:

Generate a key pair

openssl req -x509 -sha256 -nodes -days 2100 -newkey rsa:2048 -keyout mine.key -out mine.crt

Make yourself a run script

#!/bin/bash

set -eu
set -o pipefail


LFS_LISTEN="tcp://:9999"
LFS_HOST="127.0.0.1:9999"
LFS_CONTENTPATH="content"
LFS_ADMINUSER="<cool admin user name>"
LFS_ADMINPASS="<better admin password>"
LFS_CERT="mine.crt"
LFS_KEY="mine.key"
LFS_SCHEME="https"

export LFS_LISTEN LFS_HOST LFS_CONTENTPATH LFS_ADMINUSER LFS_ADMINPASS LFS_CERT LFS_KEY LFS_SCHEME

./lfs-test-server

Build the server

go build

Run

bash run.sh

Check the managment page

browser: https://localhost:9999/mgmt