Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alehatsman committed Feb 17, 2018
0 parents commit 08ea57c
Show file tree
Hide file tree
Showing 15 changed files with 625 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
out/
config.yml
vendor/
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:latest as builder
WORKDIR /go/src/github.com/atsman/nexus-minimal/
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o ./out/nexus-minimal .

FROM alpine:latest
RUN apk --no-cache add ca-certificates
VOLUME ["/etc/nexus-minimal"]
WORKDIR /root/
COPY --from=builder /go/src/github.com/atsman/nexus-minimal/out .
CMD ./nexus-minimal
174 changes: 174 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
name = "github.com/aws/aws-sdk-go"
version = "1.12.79"

[[constraint]]
name = "github.com/julienschmidt/httprouter"
version = "1.1.0"

[[constraint]]
name = "github.com/sirupsen/logrus"
version = "1.0.4"

[[constraint]]
name = "github.com/spf13/viper"
version = "1.0.0"

[prune]
go-tests = true
unused-packages = true
25 changes: 25 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
The MIT License (MIT)
=====================

Copyright © 2016-2018 Aleh Atsman

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.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
shell := bash

build:
go build -o ./out/nexus-minimal ./

run:
make build
./out/nexus-minimal
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
[![MIT License][license-image]][license-url]
[![Build Status](https://travis-ci.org/Atsman/nexus-minimal.svg?branch=master)](https://travis-ci.org/Atsman/nexus-minimal)
[![Go Report Card](https://goreportcard.com/badge/github.com/Atsman/nexus-minimal)]

# Nexus Minimal (aka Lil Nexus)

Nexus minimal is an implementation of nexus repo in golang. Decision to implement new tiny repo come to me when i realized that nexus requires 4gb RAM machine at minimum. (Java world :)) Proof here: [Nexus memory requrements](https://help.sonatype.com/display/NXRM3/System+Requirements#SystemRequirements-Memory). That is too much, especially when you need it only for small personal projects. This project gives you minimal, but complete nexus functionality, with ability to save artifacts on filesystem or to s3 and basic auth. For most of usecases that is more than enought.

## How to use it ?

```
docker run -d atsman/nexus-minimal -p 8080:8080
```

## Configuration

For s3:
```yml
---
http:
addr: ":8080"
username: "myuser"
password: "mypassword"

storage:
type: "s3"
bucket_name: "my-super-nexus-bucket"
access_key: "*******************"
secret_key: "**************************************"
```
And for file system:
```yml
---
http:
addr: ":8080"
username: "myuser"
password: "mypassword"

storage:
type: "fs"
base_dir: "/tmp/nexus-minimal"
```
## How to build it ?
Make sure to install golang, set all env variables etc.
Clone project to your go-workspace.
Cd to the project folder and run:
```
make build
```

And it will compile app.

Run:

```
make run
```

And it will run app locally on port 8080 by default.

## License

[MIT](LICENSE)

[license-url]: LICENSE

[license-image]: https://img.shields.io/github/license/mashape/apistatus.svg

[capture]: capture.png
17 changes: 17 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package main

import (
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
)

func InitConfig() {
viper.SetConfigName("config")
viper.AddConfigPath("/etc/nexus-minimal/")
viper.AddConfigPath("$HOME/.nexus-minimal")
viper.AddConfigPath(".")
err := viper.ReadInConfig()
if err != nil {
log.Warn("error during reading config file")
}
}
Loading

0 comments on commit 08ea57c

Please sign in to comment.