Skip to content

Commit

Permalink
Merge pull request #8 from FINRAOS/go-rewrite
Browse files Browse the repository at this point in the history
Go rewrite
  • Loading branch information
kood1 committed Oct 14, 2017
2 parents 53cbc1d + bd4ed7a commit 62a64f1
Show file tree
Hide file tree
Showing 810 changed files with 467,708 additions and 594 deletions.
20 changes: 20 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2
jobs:
build:
docker:
- image: circleci/golang:1.9.1
working_directory: /go/src/github.com/FINRAOS/yum-nginx-api
steps:
- setup_remote_docker
- run: git clone https://github.com/FINRAOS/yum-nginx-api.git -b $CIRCLE_BRANCH .
- run:
shell: /bin/bash
command: |
cd yum-nginx-api
make build
make docker
- run:
shell: /bin/bash
command: |
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker push finraos/yum-nginx-api:latest
67 changes: 13 additions & 54 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,58 +1,17 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
# Binaries for programs and plugins
*.exe
*.dll
*.so
*.dylib

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/
# Test binary, build with `go test -c`
*.test

# PyBuilder
target/
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

nohup.out
.vscode
yumapi*
repodata
*.rpm
*.sqlite
18 changes: 6 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
FROM centos:7
MAINTAINER Tim Marcinowski <marshyski@gmail.com>

USER root

RUN yum -y update
RUN yum install -y epel-release gcc createrepo python-setuptools python-devel
RUN yum install -y python-pip supervisor
RUN pip install --upgrade pip
ADD ./requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt
RUN yum remove -y gcc && yum clean all
ADD . /opt/yum-nginx-api
ADD supervisor/yumapi.ini /etc/supervisord.d/yumapi.ini
RUN yum install -y createrepo && yum clean all
RUN mkdir -p /repo
ADD ./yumapi.yaml /
ADD ./yumapi /

EXPOSE 8888
EXPOSE 8080

CMD ["supervisord", "-n", "-c", "/etc/supervisord.conf"]
CMD ["/yumapi"]
129 changes: 129 additions & 0 deletions Gopkg.lock

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

30 changes: 30 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

# 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"


[[constraint]]
name = "github.com/go-ozzo/ozzo-routing"
version = "2.1.3"

[[constraint]]
name = "github.com/h2non/filetype"
version = "1.0.3"
45 changes: 45 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
PACKAGE_NAME:='yumapi'
BUILT_ON:=$(shell date)
COMMIT_HASH:=$(shell git log -n 1 --pretty=format:"%H")
PACKAGES:=$(shell go list ./... | sed -n '1!p' | grep -v /vendor/)
LDFLAGS:='-X "main.builtOn=$(BUILT_ON)" -X "main.commitHash=$(COMMIT_HASH)"'

default: docker

test:
echo "mode: count" > coverage-all.out
$(foreach pkg,$(PACKAGES), \
go test -p=1 -cover -covermode=count -coverprofile=coverage.out ${pkg}; \
tail -n +2 coverage.out >> coverage-all.out;)

cover: test
go tool cover -html=coverage-all.out

run: config
go run -ldflags $(LDFLAGS) *.go

# Cross-compile from OS X to Linux using xgo
cc:
xgo --targets=linux/amd64 -ldflags $(LDFLAGS) -out $(PACKAGE_NAME) .
mv -f yumapi-* yumapi

# Build on Linux
build:
CGO_ENABLED="1" go build -ldflags $(LDFLAGS) -o $(PACKAGE_NAME) .

clean:
rm -rf yumapi* coverage.out coverage-all.out repodata *.rpm *.sqlite

config:
printf "upload_dir: .\ndev_mode: true" > yumapi.yaml

docker:
printf "upload_dir: /repo\n" > yumapi.yaml
docker build -t finraos/yum-nginx-api:latest .

# Run just API without NGINX
drun:
docker run -d -p 8080:8080 --name yumapi finraos/yum-nginx-api

compose:
docker-compose up

0 comments on commit 62a64f1

Please sign in to comment.