Skip to content

Commit 7b94456

Browse files
committed
Merge branch 'development' into pre-release
2 parents 8e5321c + 369ebaf commit 7b94456

File tree

730 files changed

+76905
-28989
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

730 files changed

+76905
-28989
lines changed

.gitignore

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Test artifacts
22

33
repo/testdata/
4+
./config*
45

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

3637
# Development environment files
3738
.ackrc
39+
.vscode
3840
.tags*
3941
*.sw?
40-
debug
41-
.vscode
42-
config*
4342
marketplace-go*
43+
config_*
4444

4545
# macOS
4646
.DS_Store

.golangci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ linters:
4848
- goconst
4949
- govet
5050
- megacheck
51+
- errcheck
5152
disable:
5253
- goimports
53-
- errcheck
5454
- golint
5555
- prealloc

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ env:
88
- "PATH=/home/travis/gopath/bin:$PATH"
99
before_install:
1010
- go get -u github.com/axw/gocov/gocov github.com/mattn/goveralls github.com/tcnksm/ghr
11-
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.15.0
11+
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.23.3
1212
install:
1313
- echo "No external dependencies required. Skipping travis default library dependency setup to use vendors..."
1414
script:
15-
- $GOPATH/bin/golangci-lint run --deadline 10m
15+
- $GOPATH/bin/golangci-lint run --deadline 10m --new-from-rev=
1616
- cd $TRAVIS_BUILD_DIR && go test -i && ./test_compile.sh
1717
- goveralls -coverprofile=coverage.out -service travis-ci
1818
after_success:

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ RUN go build --ldflags '-extldflags "-static"' -o /opt/marketplaced /go/src/gith
55

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

1010
# Document ports in use
1111
# 4002 - HTTP(s) API

Dockerfile.dev

+6-25
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,4 @@
1-
FROM golang:1.11
2-
VOLUME /var/lib/openbazaar
3-
4-
RUN wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \
5-
tar xvf Python-3.6.0.tgz && \
6-
cd Python-3.6.0 && \
7-
./configure --enable-optimizations && \
8-
make -j8
9-
RUN apt-get update && apt-get install -yq zlib1g-dev libssl-dev unzip
10-
RUN cd Python-3.6.0 && \
11-
make altinstall && \
12-
ln -s /usr/local/bin/python3.6 /usr/local/bin/python3
13-
14-
COPY ./qa/requirements.txt ./requirements.txt
15-
16-
RUN pip3.6 install --upgrade pip && \
17-
pip3.6 install -r requirements.txt && \
18-
wget https://bitcoin.org/bin/bitcoin-core-0.16.3/bitcoin-0.16.3-x86_64-linux-gnu.tar.gz && \
19-
tar -xvzf bitcoin-0.16.3-x86_64-linux-gnu.tar.gz -C /opt
20-
21-
RUN wget https://github.com/google/protobuf/releases/download/v3.6.0/protoc-3.6.0-linux-x86_64.zip && \
22-
unzip ./protoc-3.6.0-linux-x86_64.zip -x readme.txt && \
23-
mv ./include/* /usr/local/include/ && \
24-
mv ./bin/protoc /usr/local/bin/ && \
25-
rm -rf ./include ./bin
1+
FROM phoremarketplace/server-qa:0.10
262

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

10+
RUN cd /go/src/github.com/golang/protobuf && \
11+
git checkout tags/v1.2.0 -b v1.2.0 && \
12+
cd protoc-gen-go && \
13+
go install
14+
3415
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.15.0
3516

3617
WORKDIR /go/src/github.com/phoreproject/pm-go

Godeps/Godeps.json

+15-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

+76-14
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
1+
.DEFAULT_GOAL := help
2+
3+
##
4+
## Global ENV vars
5+
##
6+
7+
GIT_SHA ?= $(shell git rev-parse --short=8 HEAD)
8+
GIT_TAG ?= $(shell git describe --tags --abbrev=0)
9+
10+
##
11+
## Helpful Help
12+
##
13+
14+
.PHONY: help
15+
help:
16+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
17+
18+
119
##
220
## Building
321
##
422

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

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

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

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

43+
44+
##
45+
## Testing
46+
##
47+
MARKETPLACED_NAME ?= marketplaced-$(GIT_SHA)
48+
BITCOIND_PATH ?= .
49+
50+
.PHONY: marketplaced
51+
marketplaced: ## Build daemon
52+
$(info "Building Marketplace daemon...")
53+
go build -o ./$(MARKETPLACED_NAME) .
54+
55+
.PHONY: qa_test
56+
qa_test: marketplaced ## Run QA test suite against current working copy
57+
$(info "Running QA... (marketplaced: ../$(MARKETPLACED_NAME) bitcoind: $(BITCOIND_PATH)/bin/bitcoind)")
58+
(cd qa && ./runtests.sh ../$(MARKETPLACED_NAME) $(BITCOIND_PATH)/bin/bitcoind)
59+
60+
.PHONY: qa_eth_test
61+
qa_eth_test: openbazaard ## Run ETH-based QA test suite against current working copy
62+
$(info "Running ETH QA... (openbazaard: ../$(OPENBAZAARD_NAME))")
63+
(cd qa && ./runtests_eth.sh ../$(OPENBAZAARD_NAME))
64+
2365
##
2466
## Docker
2567
##
26-
DOCKER_PROFILE ?= openbazaar
27-
DOCKER_VERSION ?= $(shell git describe --tags --abbrev=0)
28-
DOCKER_IMAGE_NAME ?= $(DOCKER_PROFILE)/server:$(DOCKER_VERSION)
68+
PUBLIC_DOCKER_REGISTRY ?= PhoreMarketplace
69+
QA_DEV_TAG ?= 0.10
70+
71+
DOCKER_SERVER_IMAGE_NAME ?= $(PUBLIC_DOCKER_REGISTRY)/server:$(GIT_TAG)
72+
DOCKER_QA_IMAGE_NAME ?= $(PUBLIC_DOCKER_REGISTRY)/server-qa:$(QA_DEV_TAG)
73+
DOCKER_DEV_IMAGE_NAME ?= $(PUBLIC_DOCKER_REGISTRY)/server-dev:$(QA_DEV_TAG)
74+
75+
76+
.PHONY: docker_build
77+
docker_build: ## Build container for daemon
78+
docker build -t $(DOCKER_SERVER_IMAGE_NAME) .
79+
80+
.PHONY: docker_push
81+
docker_push: docker ## Push container for daemon
82+
docker push $(DOCKER_SERVER_IMAGE_NAME)
83+
84+
.PHONY: qa_docker_build
85+
qa_docker_build: ## Build container with QA test dependencies included
86+
docker build -t $(DOCKER_QA_IMAGE_NAME) -f ./Dockerfile.qa .
87+
88+
.PHONY: qa_docker_push
89+
qa_docker_push: qa_docker_build ## Push container for daemon QA test environment
90+
docker push $(DOCKER_QA_IMAGE_NAME)
2991

30-
.PHONY: docker
31-
docker:
32-
docker build -t $(DOCKER_IMAGE_NAME) .
92+
.PHONY: dev_docker_build
93+
dev_docker: ## Build container with dev dependencies included
94+
docker build -t $(DOCKER_DEV_IMAGE_NAME) -f ./Dockerfile.dev .
3395

34-
.PHONY: push_docker
35-
push_docker:
36-
docker push $(DOCKER_IMAGE_NAME)
96+
.PHONY: dev_docker_push
97+
dev_docker_push: dev_docker_build ## Push container for daemon dev environment
98+
docker push $(DOCKER_DEV_IMAGE_NAME)

README.md

+16-14
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ The easiest way to run the server is to download a pre-built binary. You can fin
3434

3535
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).
3636

37+
### Run via Docker image
38+
39+
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.
40+
41+
```
42+
docker run -it openbazaar/server:latest [OPTIONS] start [start-OPTIONS]
43+
```
44+
3745
## Dependency Management
3846

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

9698
## Documentation

api/endpoints.go

+16
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ func post(i *jsonAPIHandler, path string, w http.ResponseWriter, r *http.Request
9191
i.POSTShutdown(w, r)
9292
case strings.HasPrefix(path, "/ob/estimatetotal"):
9393
i.POSTEstimateTotal(w, r)
94+
case strings.HasPrefix(path, "/ob/checkoutbreakdown"):
95+
i.POSTCheckoutBreakdown(w, r)
9496
case strings.HasPrefix(path, "/ob/fetchratings"):
9597
i.POSTFetchRatings(w, r)
9698
case strings.HasPrefix(path, "/ob/sales"):
@@ -113,6 +115,14 @@ func post(i *jsonAPIHandler, path string, w http.ResponseWriter, r *http.Request
113115
i.POSTPost(w, r)
114116
case strings.HasPrefix(path, "/ob/bulkupdatecurrency"):
115117
i.POSTBulkUpdateCurrency(w, r)
118+
case strings.HasPrefix(path, "/ob/bulkupdatetermsandconditions"):
119+
i.POSTBulkUpdateTerms(w, r)
120+
case strings.HasPrefix(path, "/ob/bulkupdaterefundpolicy"):
121+
i.POSTBulkUpdateRefundPolicy(w, r)
122+
case strings.HasPrefix(path, "/ob/bulkupdatereturnpolicy"):
123+
i.POSTBulkUpdateRefundPolicy(w, r)
124+
case strings.HasPrefix(path, "/ob/bulkupdateshippingoptions"):
125+
i.POSTBulkUpdateShippingDetails(w, r)
116126
case strings.HasPrefix(path, "/ob/resendordermessage"):
117127
i.POSTResendOrderMessage(w, r)
118128
case strings.HasPrefix(path, "/manage/initwallet"):
@@ -121,6 +131,10 @@ func post(i *jsonAPIHandler, path string, w http.ResponseWriter, r *http.Request
121131
i.POSTUnlockWallet(w, r)
122132
case strings.HasPrefix(path, "/manage/lockwallet"):
123133
i.POSTLockWallet(w, r)
134+
case strings.HasPrefix(path, "/ob/hashmessage"):
135+
i.POSTHashMessage(w, r)
136+
case strings.HasPrefix(path, "/ob/bulkupdateprices"):
137+
i.POSTBulkUpdatePrices(w, r)
124138
default:
125139
ErrorResponse(w, http.StatusNotFound, "Not Found")
126140
}
@@ -135,6 +149,8 @@ func get(i *jsonAPIHandler, path string, w http.ResponseWriter, r *http.Request)
135149
i.GETPeers(w, r)
136150
case strings.HasPrefix(path, "/ob/config"):
137151
i.GETConfig(w, r)
152+
case strings.HasPrefix(path, "/wallet/currencies"):
153+
i.GETWalletCurrencyDictionary(w, r)
138154
case strings.HasPrefix(path, "/wallet/address"):
139155
i.GETAddress(w, r)
140156
case strings.HasPrefix(path, "/wallet/mnemonic"):

0 commit comments

Comments
 (0)