Skip to content

Commit

Permalink
Merge pull request #1 from Swapica/feature/implementation
Browse files Browse the repository at this point in the history
Feature/implementation
  • Loading branch information
slandymani authored May 24, 2023
2 parents 371c92b + 3b538c5 commit 1efff5f
Show file tree
Hide file tree
Showing 1,523 changed files with 515,778 additions and 5 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build and publish a Docker image

on:
push:
tags:
-'*'
- '**'
release:
types: [published]
env:
REGISTRY: docker.io
REP_NAME: swapica/indexer
IMAGE_NAME: swapica/indexer:${{ github.ref_name }}

jobs:
build:
name: Build and publish image
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_LOGIN }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push Docker images
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ env.IMAGE_NAME }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.vscode/
.idea/
config.*.yaml
docs/node_modules
docs/web_deploy
37 changes: 37 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
dist: bionic
addons:
apt:
source:
- docker-bionic
packages:
- docker
services:
- docker
env:
global:
- PROJECT: tokend
- IMAGE_NAME: github.com/Swapica/indexer-svc


script:
- export IMAGE_TAG=$(test -z $TRAVIS_TAG && echo $TRAVIS_COMMIT || echo $TRAVIS_TAG)
- docker build -t $PROJECT/$IMAGE_NAME:$IMAGE_TAG .
before_deploy:
- echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
- echo "$GITLABREG_PASSWORD" | docker login -u "$GITLABREG_USERNAME" --password-stdin
registry.gitlab.com
- docker tag $PROJECT/$IMAGE_NAME:$IMAGE_TAG registry.gitlab.com/$PROJECT/docker-registry/$IMAGE_NAME:$IMAGE_TAG
deploy:
- provider: script
script:
- docker push $PROJECT/$IMAGE_NAME:$IMAGE_TAG
on:
all_branches: true
tags: true
- provider: script
script:
- docker push registry.gitlab.com/$PROJECT/docker-registry/$IMAGE_NAME:$IMAGE_TAG
on:
all_branches: true
tags: false

17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM golang:1.18-alpine as buildbase

RUN apk add git build-base

WORKDIR /go/src/github.com/Swapica/indexer-svc
COPY vendor .
COPY . .

RUN GOOS=linux go build -o /usr/local/bin/indexer-svc /go/src/github.com/Swapica/indexer-svc


FROM alpine:3.9

COPY --from=buildbase /usr/local/bin/indexer-svc /usr/local/bin/indexer-svc
RUN apk add --no-cache ca-certificates

ENTRYPOINT ["indexer-svc"]
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# order-indexer-svc
# indexer-svc

## Description

Expand All @@ -7,8 +7,8 @@ Save orders from a single EVM network to the database for better performance on
## Install

```
git clone github.com/Swapica/order-indexer-svc
cd order-indexer-svc
git clone github.com/Swapica/indexer-svc
cd indexer-svc
go build main.go
export KV_VIPER_FILE=./config.yaml
./main migrate up
Expand Down Expand Up @@ -38,8 +38,8 @@ Make sure that docker installed.


```
docker build -t github.com/Swapica/order-indexer-svc .
docker run -e KV_VIPER_FILE=/config.yaml github.com/Swapica/order-indexer-svc
docker build -t github.com/Swapica/indexer-svc .
docker run -e KV_VIPER_FILE=/config.yaml github.com/Swapica/indexer-svc
```

## Running from Source
Expand Down
19 changes: 19 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
log:
level: debug
disable_sentry: true

collector:
endpoint: "http://order-aggregator/integrations/order-aggregator"
request_timeout: 1s

network:
rpc: "http://rpc-proxy/integrations/rpc-proxy/goerli"
contract: "Swapica address"
chain_id: 5
index_period: 30s # period of contract calls for fetching events, should be > average_block_time
use_websocket: true
ws: "wss://goerli.infura.io/ws/v3/" # required to subscribe to blocks
override_last_block: "8931015"
# optional fields
block_range: 3000 # max difference between start and end block on eth_getLogs call, e.g. for Fuji Ankr RPC it's 3000
request_timeout: 3s
60 changes: 60 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
module github.com/Swapica/indexer-svc

go 1.19

require (
github.com/Swapica/order-aggregator-svc v0.0.0-20230223111550-c21489f844fa
github.com/alecthomas/kingpin v2.2.6+incompatible
github.com/ethereum/go-ethereum v1.10.26
gitlab.com/distributed_lab/figure/v3 v3.1.2
gitlab.com/distributed_lab/json-api-connector v0.2.4
gitlab.com/distributed_lab/kit v1.11.1
gitlab.com/distributed_lab/logan v3.8.1+incompatible
gitlab.com/distributed_lab/running v1.6.0
gitlab.com/tokend/connectors v0.1.9
)

require (
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/getsentry/sentry-go v0.18.0 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/nullstyle/go-xdr v0.0.0-20180726165426-f4c839f75077 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rjeczalik/notify v0.9.1 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.15.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/tklauser/go-sysconf v0.3.5 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
gitlab.com/distributed_lab/figure v2.1.2+incompatible // indirect
gitlab.com/tokend/go v3.15.0+incompatible // indirect
gitlab.com/tokend/keypair v0.0.0-20190412110653-b9d7e0c8b312 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 1efff5f

Please sign in to comment.