Skip to content

Commit

Permalink
Merge branch 'development' into pre-release
Browse files Browse the repository at this point in the history
  • Loading branch information
anchaj committed Dec 8, 2020
2 parents 8e5321c + 369ebaf commit 7b94456
Show file tree
Hide file tree
Showing 730 changed files with 76,905 additions and 28,989 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Test artifacts

repo/testdata/
./config*

# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
Expand Down Expand Up @@ -35,12 +36,11 @@ dist

# Development environment files
.ackrc
.vscode
.tags*
*.sw?
debug
.vscode
config*
marketplace-go*
config_*

# macOS
.DS_Store
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ linters:
- goconst
- govet
- megacheck
- errcheck
disable:
- goimports
- errcheck
- golint
- prealloc
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ env:
- "PATH=/home/travis/gopath/bin:$PATH"
before_install:
- go get -u github.com/axw/gocov/gocov github.com/mattn/goveralls github.com/tcnksm/ghr
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.15.0
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.23.3
install:
- echo "No external dependencies required. Skipping travis default library dependency setup to use vendors..."
script:
- $GOPATH/bin/golangci-lint run --deadline 10m
- $GOPATH/bin/golangci-lint run --deadline 10m --new-from-rev=
- cd $TRAVIS_BUILD_DIR && go test -i && ./test_compile.sh
- goveralls -coverprofile=coverage.out -service travis-ci
after_success:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN go build --ldflags '-extldflags "-static"' -o /opt/marketplaced /go/src/gith

# Final state - Create image containing nothing but the marketplaced binary and
# some base settings
FROM phoremarketplace/base:v1.0.0
FROM PhoreMarketplace/base:v1.0.0

# Document ports in use
# 4002 - HTTP(s) API
Expand Down
31 changes: 6 additions & 25 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,28 +1,4 @@
FROM golang:1.11
VOLUME /var/lib/openbazaar

RUN wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \
tar xvf Python-3.6.0.tgz && \
cd Python-3.6.0 && \
./configure --enable-optimizations && \
make -j8
RUN apt-get update && apt-get install -yq zlib1g-dev libssl-dev unzip
RUN cd Python-3.6.0 && \
make altinstall && \
ln -s /usr/local/bin/python3.6 /usr/local/bin/python3

COPY ./qa/requirements.txt ./requirements.txt

RUN pip3.6 install --upgrade pip && \
pip3.6 install -r requirements.txt && \
wget https://bitcoin.org/bin/bitcoin-core-0.16.3/bitcoin-0.16.3-x86_64-linux-gnu.tar.gz && \
tar -xvzf bitcoin-0.16.3-x86_64-linux-gnu.tar.gz -C /opt

RUN wget https://github.com/google/protobuf/releases/download/v3.6.0/protoc-3.6.0-linux-x86_64.zip && \
unzip ./protoc-3.6.0-linux-x86_64.zip -x readme.txt && \
mv ./include/* /usr/local/include/ && \
mv ./bin/protoc /usr/local/bin/ && \
rm -rf ./include ./bin
FROM phoremarketplace/server-qa:0.10

WORKDIR /go/src/github.com/phoreproject/pm-go
RUN go get -u github.com/gogo/protobuf/proto \
Expand All @@ -31,6 +7,11 @@ RUN go get -u github.com/gogo/protobuf/proto \
github.com/derekparker/delve/cmd/dlv \
github.com/tools/godep

RUN cd /go/src/github.com/golang/protobuf && \
git checkout tags/v1.2.0 -b v1.2.0 && \
cd protoc-gen-go && \
go install

RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.15.0

WORKDIR /go/src/github.com/phoreproject/pm-go
Expand Down
37 changes: 15 additions & 22 deletions Godeps/Godeps.json

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

90 changes: 76 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
.DEFAULT_GOAL := help

##
## Global ENV vars
##

GIT_SHA ?= $(shell git rev-parse --short=8 HEAD)
GIT_TAG ?= $(shell git describe --tags --abbrev=0)

##
## Helpful Help
##

.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'


##
## Building
##

ios_framework:
gomobile bind -target=ios github.com/phoreproject/pm-go/mobile
.PHONY: ios_framework
ios_framework: ## Build iOS Framework for mobile
gomobile bind -target=ios/arm64,ios/amd64 -iosversion=10 -ldflags="-s -w" github.com/phoreproject/pm-go/mobile

android_framework:
gomobile bind -target=android github.com/phoreproject/pm-go/mobile
.PHONY: android_framework
android_framework: ## Build Android Framework for mobile
gomobile bind -target=android/arm,android/arm64,android/amd64 -ldflags="-s -w" github.com/phoreproject/pm-go/mobile

##
## Protobuf compilation
Expand All @@ -17,20 +37,62 @@ P_ANY = Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any
PKGMAP = $(P_TIMESTAMP),$(P_ANY)

.PHONY: protos
protos:
protos: ## Build go files for proto definitions
cd pb/protos && PATH=$(PATH):$(GOPATH)/bin protoc --go_out=$(PKGMAP):.. *.proto


##
## Testing
##
MARKETPLACED_NAME ?= marketplaced-$(GIT_SHA)
BITCOIND_PATH ?= .

.PHONY: marketplaced
marketplaced: ## Build daemon
$(info "Building Marketplace daemon...")
go build -o ./$(MARKETPLACED_NAME) .

.PHONY: qa_test
qa_test: marketplaced ## Run QA test suite against current working copy
$(info "Running QA... (marketplaced: ../$(MARKETPLACED_NAME) bitcoind: $(BITCOIND_PATH)/bin/bitcoind)")
(cd qa && ./runtests.sh ../$(MARKETPLACED_NAME) $(BITCOIND_PATH)/bin/bitcoind)

.PHONY: qa_eth_test
qa_eth_test: openbazaard ## Run ETH-based QA test suite against current working copy
$(info "Running ETH QA... (openbazaard: ../$(OPENBAZAARD_NAME))")
(cd qa && ./runtests_eth.sh ../$(OPENBAZAARD_NAME))

##
## Docker
##
DOCKER_PROFILE ?= openbazaar
DOCKER_VERSION ?= $(shell git describe --tags --abbrev=0)
DOCKER_IMAGE_NAME ?= $(DOCKER_PROFILE)/server:$(DOCKER_VERSION)
PUBLIC_DOCKER_REGISTRY ?= PhoreMarketplace
QA_DEV_TAG ?= 0.10

DOCKER_SERVER_IMAGE_NAME ?= $(PUBLIC_DOCKER_REGISTRY)/server:$(GIT_TAG)
DOCKER_QA_IMAGE_NAME ?= $(PUBLIC_DOCKER_REGISTRY)/server-qa:$(QA_DEV_TAG)
DOCKER_DEV_IMAGE_NAME ?= $(PUBLIC_DOCKER_REGISTRY)/server-dev:$(QA_DEV_TAG)


.PHONY: docker_build
docker_build: ## Build container for daemon
docker build -t $(DOCKER_SERVER_IMAGE_NAME) .

.PHONY: docker_push
docker_push: docker ## Push container for daemon
docker push $(DOCKER_SERVER_IMAGE_NAME)

.PHONY: qa_docker_build
qa_docker_build: ## Build container with QA test dependencies included
docker build -t $(DOCKER_QA_IMAGE_NAME) -f ./Dockerfile.qa .

.PHONY: qa_docker_push
qa_docker_push: qa_docker_build ## Push container for daemon QA test environment
docker push $(DOCKER_QA_IMAGE_NAME)

.PHONY: docker
docker:
docker build -t $(DOCKER_IMAGE_NAME) .
.PHONY: dev_docker_build
dev_docker: ## Build container with dev dependencies included
docker build -t $(DOCKER_DEV_IMAGE_NAME) -f ./Dockerfile.dev .

.PHONY: push_docker
push_docker:
docker push $(DOCKER_IMAGE_NAME)
.PHONY: dev_docker_push
dev_docker_push: dev_docker_build ## Push container for daemon dev environment
docker push $(DOCKER_DEV_IMAGE_NAME)
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ The easiest way to run the server is to download a pre-built binary. You can fin

To build from source you will need to have Go installed and properly configured. Detailed instructions for installing Go and marketplace-go on each operating system can be found in the [docs package](https://github.com/phoreproject/pm-go/tree/master/docs).

### Run via Docker image

You can also use our Docker Hub image to run openbazaar-go. `latest` points to the latest release, but you can run any other version by matching the release tag to the Docker image tag.

```
docker run -it openbazaar/server:latest [OPTIONS] start [start-OPTIONS]
```

## Dependency Management

We use [Godeps](https://github.com/tools/godep) with vendored third-party packages.
Expand Down Expand Up @@ -68,29 +76,23 @@ Help Options:
-p, --password= the encryption password if the database is encrypted
-t, --testnet use the test network
-r, --regtest run in regression test mode
-l, --loglevel= set the logging level [debug, info, notice, warning, error, critical]
(default: debug)
-l, --loglevel= set the logging level [debug, info, notice, warning, error, critical] (default: debug)
-f, --nologfiles save logs on disk
-a, --allowip= only allow API connections from these IPs
-s, --stun use stun on µTP IPv4
-d, --datadir= specify the data directory to be used
-c, --authcookie= turn on API authentication and use this specific cookie
-u, --useragent= add a custom user-agent field
-v, --verbose print openbazaar logs to stdout
--torpassword= Set the tor control password. This will override the tor password in
the config.
--tor Automatically configure the daemon to run as a Tor hidden service and
use Tor exclusively. Requires Tor to be running.
--dualstack Automatically configure the daemon to run as a Tor hidden service IN
ADDITION to using the clear internet. Requires Tor to be running.
WARNING: this mode is not private
--torpassword= Set the tor control password. This will override the tor password in the config.
--tor Automatically configure the daemon to run as a Tor hidden service and use Tor exclusively. Requires
Tor to be running.
--dualstack Automatically configure the daemon to run as a Tor hidden service IN ADDITION to using the clear
internet. Requires Tor to be running. WARNING: this mode is not private
--disablewallet disable the wallet functionality of the node
--disableexchangerates disable the exchange rate service to prevent api queries
--storage= set the outgoing message storage option [self-hosted, dropbox]
(default=self-hosted)
--bitcoincash use a Bitcoin Cash wallet in a dedicated data directory
--zcash= use a ZCash wallet in a dedicated data directory. To use this you must
pass in the location of the zcashd binary.
--storage= set the outgoing message storage option [self-hosted, dropbox] default=self-hosted
--forcekeypurge repair test for issue OpenBazaar/openbazaar-go#1593; use as instructed only
```

## Documentation
Expand Down
16 changes: 16 additions & 0 deletions api/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ func post(i *jsonAPIHandler, path string, w http.ResponseWriter, r *http.Request
i.POSTShutdown(w, r)
case strings.HasPrefix(path, "/ob/estimatetotal"):
i.POSTEstimateTotal(w, r)
case strings.HasPrefix(path, "/ob/checkoutbreakdown"):
i.POSTCheckoutBreakdown(w, r)
case strings.HasPrefix(path, "/ob/fetchratings"):
i.POSTFetchRatings(w, r)
case strings.HasPrefix(path, "/ob/sales"):
Expand All @@ -113,6 +115,14 @@ func post(i *jsonAPIHandler, path string, w http.ResponseWriter, r *http.Request
i.POSTPost(w, r)
case strings.HasPrefix(path, "/ob/bulkupdatecurrency"):
i.POSTBulkUpdateCurrency(w, r)
case strings.HasPrefix(path, "/ob/bulkupdatetermsandconditions"):
i.POSTBulkUpdateTerms(w, r)
case strings.HasPrefix(path, "/ob/bulkupdaterefundpolicy"):
i.POSTBulkUpdateRefundPolicy(w, r)
case strings.HasPrefix(path, "/ob/bulkupdatereturnpolicy"):
i.POSTBulkUpdateRefundPolicy(w, r)
case strings.HasPrefix(path, "/ob/bulkupdateshippingoptions"):
i.POSTBulkUpdateShippingDetails(w, r)
case strings.HasPrefix(path, "/ob/resendordermessage"):
i.POSTResendOrderMessage(w, r)
case strings.HasPrefix(path, "/manage/initwallet"):
Expand All @@ -121,6 +131,10 @@ func post(i *jsonAPIHandler, path string, w http.ResponseWriter, r *http.Request
i.POSTUnlockWallet(w, r)
case strings.HasPrefix(path, "/manage/lockwallet"):
i.POSTLockWallet(w, r)
case strings.HasPrefix(path, "/ob/hashmessage"):
i.POSTHashMessage(w, r)
case strings.HasPrefix(path, "/ob/bulkupdateprices"):
i.POSTBulkUpdatePrices(w, r)
default:
ErrorResponse(w, http.StatusNotFound, "Not Found")
}
Expand All @@ -135,6 +149,8 @@ func get(i *jsonAPIHandler, path string, w http.ResponseWriter, r *http.Request)
i.GETPeers(w, r)
case strings.HasPrefix(path, "/ob/config"):
i.GETConfig(w, r)
case strings.HasPrefix(path, "/wallet/currencies"):
i.GETWalletCurrencyDictionary(w, r)
case strings.HasPrefix(path, "/wallet/address"):
i.GETAddress(w, r)
case strings.HasPrefix(path, "/wallet/mnemonic"):
Expand Down
Loading

0 comments on commit 7b94456

Please sign in to comment.