Skip to content

Commit a3e11be

Browse files
committed
Initial commit
0 parents  commit a3e11be

Some content is hidden

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

59 files changed

+16413
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.github/workflows/actions.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
on:
2+
workflow_dispatch:
3+
4+
jobs:
5+
converge:
6+
name: Converge
7+
runs-on: ubuntu-latest
8+
steps:
9+
10+
- name: Checkout code
11+
uses: actions/checkout@v3
12+
with:
13+
fetch-depth: 0
14+
15+
- name: Install werf
16+
uses: werf/actions/install@v1.2
17+
18+
- name: Log in to registry
19+
# This is where you will update the personal access token to GITHUB_TOKEN
20+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
21+
22+
- name: Run echo
23+
run: |
24+
werf version
25+
docker version
26+
echo $GITHUB_REPOSITORY
27+
echo $GITHUB_SHA
28+
- name: Run Build
29+
run: |
30+
. $(werf ci-env github --as-file)
31+
werf export service --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA

.github/workflows/actions_branch.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
on:
2+
push:
3+
branches:
4+
- 'main'
5+
6+
jobs:
7+
converge:
8+
name: Converge
9+
runs-on: ubuntu-latest
10+
steps:
11+
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Install werf
18+
uses: werf/actions/install@v1.2
19+
20+
- name: Log in to registry
21+
# This is where you will update the personal access token to GITHUB_TOKEN
22+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
23+
24+
- name: Run echo
25+
run: |
26+
werf version
27+
docker version
28+
echo $GITHUB_REPOSITORY
29+
echo $GITHUB_SHA
30+
- name: Run Build
31+
run: |
32+
. $(werf ci-env github --as-file)
33+
werf export service --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA

.github/workflows/code-review.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
on:
2+
pull_request:
3+
4+
permissions:
5+
checks: write
6+
contents: read
7+
pull-requests: write
8+
9+
jobs:
10+
lint:
11+
name: code-review
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
18+
- name: golangci-lint
19+
uses: reviewdog/action-golangci-lint@v2
20+
with:
21+
reporter: github-pr-review
22+
cache: false
23+
golangci_lint_flags: --timeout=2m
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Builds the docs and deploys to GitHub pages
2+
#
3+
# https://github.com/actions/setup-node
4+
# Using https://github.com/marketplace/actions/deploy-to-github-pages
5+
name: Deploy to Github pages
6+
7+
on:
8+
workflow_dispatch:
9+
push:
10+
branches:
11+
- main
12+
- master
13+
14+
jobs:
15+
deploy_pages:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
- uses: actions/setup-node@v3
21+
with:
22+
node-version: '18'
23+
24+
- run: |
25+
cd ./docs
26+
npm install
27+
npm run build
28+
29+
- run: touch docs/.nojekyll
30+
- name: Deploy docs 🚀
31+
uses: JamesIves/github-pages-deploy-action@releases/v3
32+
with:
33+
BRANCH: gh-pages # The branch the action should deploy to.
34+
FOLDER: docs/web_deploy # The folder the action should deploy.

.github/workflows/tag.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
on:
2+
push:
3+
tags:
4+
- 'v[0-9]+.[0-9]+.[0-9]+'
5+
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+'
6+
7+
jobs:
8+
converge:
9+
name: Converge
10+
runs-on: ubuntu-latest
11+
steps:
12+
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Install werf
19+
uses: werf/actions/install@v1.2
20+
21+
- name: Log in to registry
22+
# This is where you will update the personal access token to GITHUB_TOKEN
23+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
24+
25+
- name: Run echo
26+
run: |
27+
werf version
28+
docker version
29+
echo $GITHUB_REPOSITORY
30+
echo $GITHUB_REF_NAME
31+
- name: Run Build
32+
run: |
33+
. $(werf ci-env github --as-file)
34+
werf export service --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_REF_NAME

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.vscode/
2+
.idea/
3+
config.*.yaml
4+
docker-compose.yaml
5+
docs/node_modules
6+
docs/web_deploy
7+
vendor/

.golangci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
linters:
2+
enable:
3+
- asciicheck
4+
- bodyclose
5+
- dogsled
6+
- dupl
7+
- errcheck
8+
- exportloopref
9+
- goconst
10+
- gofmt
11+
- goimports
12+
- revive
13+
- gosimple
14+
- govet
15+
- ineffassign
16+
- misspell
17+
- nakedret
18+
- nolintlint
19+
- prealloc
20+
- staticcheck
21+
- stylecheck
22+
- typecheck
23+
- unconvert
24+
- unused
25+
26+
issues:
27+
max-same-issues: 50
28+
29+
linters-settings:
30+
dogsled:
31+
max-blank-identifiers: 3
32+
golint:
33+
min-confidence: 0
34+
maligned:
35+
suggest-new: true

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM golang:1.22-alpine as buildbase
2+
3+
RUN apk add git build-base
4+
5+
WORKDIR /go/src/github.com/rarimo/airdrop-svc
6+
COPY vendor .
7+
COPY . .
8+
9+
RUN GOOS=linux go build -o /usr/local/bin/airdrop-svc /go/src/github.com/rarimo/airdrop-svc
10+
11+
12+
FROM alpine:3.9
13+
14+
COPY --from=buildbase /usr/local/bin/airdrop-svc /usr/local/bin/airdrop-svc
15+
RUN apk add --no-cache ca-certificates
16+
17+
ENTRYPOINT ["airdrop-svc"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2024 Zero Block Global Foundation
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# airdrop-svc
2+
3+
## Description
4+
5+
Service to manage airdrops for passport ZK-proofs
6+
7+
## Install
8+
9+
```
10+
git clone github.com/rarimo/airdrop-svc
11+
cd airdrop-svc
12+
go build main.go
13+
export KV_VIPER_FILE=./config.yaml
14+
./main migrate up
15+
./main run service
16+
```
17+
18+
## API documentation
19+
20+
[Online docs](https://rarimo.github.io/airdrop-svc/) are available.
21+
22+
All endpoints from docs MUST be publicly accessible.
23+
24+
### Local build
25+
26+
We do use openapi:json standard for API. We use swagger for documenting our API.
27+
28+
To open online documentation, go to [swagger editor](http://localhost:8080/swagger-editor/) here is how you can start it
29+
```
30+
cd docs
31+
npm install
32+
npm run start
33+
```
34+
To build documentation use `npm run build` command,
35+
that will create open-api documentation in `web_deploy` folder.
36+
37+
To generate resources for Go models run `./generate.sh` script in root folder.
38+
use `./generate.sh --help` to see all available options.
39+
40+
Note: if you are using Gitlab for building project `docs/spec/paths` folder must not be
41+
empty, otherwise only `Build and Publish` job will be passed.
42+
43+
## Running from Source
44+
45+
* Run dependencies, based on config example
46+
* Set up environment value with config file path `KV_VIPER_FILE=./config.yaml`
47+
* Provide valid config file
48+
* Launch the service with `migrate up` command to create database schema
49+
* Launch the service with `run service` command
50+
51+
### Database
52+
For services, we do use ***PostgresSQL*** database.
53+
You can [install it locally](https://www.postgresql.org/download/) or use [docker image](https://hub.docker.com/_/postgres/).

config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
log:
2+
level: debug
3+
disable_sentry: true
4+
5+
db:
6+
url: postgres://airdrop:airdrop@localhost:5432/airdrop?sslmode=disable
7+
8+
listener:
9+
addr: localhost:8000
10+
11+
broadcaster:
12+
addr: broadcaster
13+
sender_account: "rarimo15hcd6tv7pe8hk2re7hu0zg0aphqdm2dtjrs0ds"
14+
15+
airdrop:
16+
amount: 100000 # urmo

docs/.DS_Store

6 KB
Binary file not shown.

docs/.redoclyrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
apiTitle: airdrop-svc
3+
splitSpec: true
4+
codeSamples: false
5+
swaggerUI: true
6+
travis: true
7+
repo: tokend/notifications/notifications-router-svc
8+
oasVersion: 1.0.0
9+

0 commit comments

Comments
 (0)