Skip to content

Commit bc0175b

Browse files
author
Boris
committed
add files
1 parent 66c9bd9 commit bc0175b

26 files changed

+1664
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/build/
2+
/bin/
3+
/vendor/
4+
*~
5+
go.sum
6+

Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
GOPATH=$(shell pwd)/vendor:$(shell pwd)
2+
GOBIN=$(shell pwd)/build/
3+
GOFILES=./cmd/$(wildcard *.go)
4+
GONAME=$(shell basename "$(PWD)")
5+
PID=/tmp/go-$(GONAME).pid
6+
GOOS=linux
7+
#GOARCH=386
8+
BUILD=`date +%FT%T%z`
9+
MKDIR_P = mkdir -p
10+
11+
all :: build
12+
13+
get:
14+
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go get -d $(GOFILES)
15+
16+
build:
17+
@echo "Building $(GOFILES) to ./build"
18+
cd front && go-bindata -pkg front -o ../modules/front/front.go ./...
19+
cd ../
20+
go mod vendor
21+
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) GOOS=$(GOOS) GOARCH=$(GOARCH) go build -ldflags "-s -w -X main.vBuild=${BUILD}" -o build/$(GONAME) $(GOFILES)
22+
strip ./build/$(GONAME)
23+
24+
run:
25+
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go run $(GOFILES)
26+
27+
clear:
28+
@clear
29+
30+
clean:
31+
@echo "Cleaning"
32+
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go clean
33+
34+
.PHONY: build get install run clean dirs
35+

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# extractor
2+
Extractor is a web tool for an extracting specific indices from the indicated repository, from the snapshot identified by users choice.
3+
4+
Requires Elasticsearch v7.0 or greater.
5+
6+
7+
## INSTALL ##
8+
9+
To install *extractor* on Linux use the following commands:
10+
11+
$ git clone https://github.com/uzhinskiy/extractor.git
12+
$ cd extractor
13+
$ make
14+
15+
## USAGE ##
16+
17+
$ sudo cp ./build/extractor /usr/local/sbin/
18+
$ sudo cp main.yml /usr/local/etc/extractor.yml
19+
$ sudo cp ./scripts/extractor.service /etc/systemd/system/
20+
$ edit /usr/local/etc/extractor.yml
21+
$ sudo systemctl daemon-reload && systemctl start extractor
22+
$ sudo systemctl enable extractor

cmd/main.go

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright © 2020 Uzhinskiy Boris
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
package main
15+
16+
import (
17+
"flag"
18+
"log"
19+
"os"
20+
21+
"github.com/uzhinskiy/extractor/modules/config"
22+
"github.com/uzhinskiy/extractor/modules/router"
23+
"github.com/uzhinskiy/extractor/modules/version"
24+
)
25+
26+
var (
27+
configfile string
28+
vBuild string
29+
cnf config.Config
30+
hostname string
31+
)
32+
33+
func init() {
34+
flag.StringVar(&configfile, "config", "main.yml", "Read configuration from this file")
35+
flag.StringVar(&configfile, "f", "main.yml", "Read configuration from this file")
36+
vers := flag.Bool("V", false, "Show version")
37+
flag.Parse()
38+
if *vers {
39+
print("version: ", version.Version, "( ", vBuild, " )\n")
40+
os.Exit(0)
41+
}
42+
43+
hostname, _ = os.Hostname()
44+
log.SetFlags(log.LstdFlags | log.Lshortfile)
45+
log.SetPrefix(hostname + "\tapi.version:" + version.Version + "\t")
46+
47+
log.Println("Bootstrap: build num.", vBuild)
48+
49+
cnf = config.Parse(configfile)
50+
log.Println("Bootstrap: successful parsing config file. Items: ", cnf)
51+
}
52+
53+
func main() {
54+
router.Run(cnf)
55+
}

front/404.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<h1>Not found</h1>

front/assets/css/bootstrap.min.css

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

front/assets/css/bootstrap.min.css.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
40.3 KB
Binary file not shown.

front/assets/js/bootstrap.bundle.min.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

front/assets/js/bootstrap.min.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)