-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cf4d152
Showing
69 changed files
with
12,365 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- 'master' | ||
- 'main' | ||
|
||
env: | ||
CI_JOB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
jobs: | ||
converge: | ||
name: Converge | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install werf | ||
uses: werf/actions/[email protected] | ||
|
||
- name: Log in to registry | ||
# This is where you will update the personal access token to GITHUB_TOKEN | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | ||
|
||
- name: Run echo | ||
run: | | ||
werf version | ||
docker version | ||
echo $GITHUB_REPOSITORY | ||
echo $GITHUB_SHA | ||
- name: Run Build | ||
run: | | ||
. $(werf ci-env github --as-file) | ||
werf export service --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
on: | ||
pull_request: | ||
|
||
permissions: | ||
checks: write | ||
contents: read | ||
pull-requests: write | ||
|
||
jobs: | ||
lint: | ||
name: code-review | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: golangci-lint | ||
uses: reviewdog/action-golangci-lint@v2 | ||
with: | ||
reporter: github-pr-review | ||
cache: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
|
||
env: | ||
CI_JOB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
jobs: | ||
converge: | ||
name: Converge | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install werf | ||
uses: werf/actions/[email protected] | ||
|
||
- name: Log in to registry | ||
# This is where you will update the personal access token to GITHUB_TOKEN | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | ||
|
||
- name: Run echo | ||
run: | | ||
werf version | ||
docker version | ||
echo $GITHUB_REPOSITORY | ||
echo $GITHUB_REF_NAME | ||
- name: Run Build | ||
run: | | ||
. $(werf ci-env github --as-file) | ||
werf export service --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_REF_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.vscode/ | ||
.idea/ | ||
config.*.yaml | ||
docs/node_modules | ||
docs/web_deploy | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
linters: | ||
enable: | ||
- asciicheck | ||
- bodyclose | ||
- dogsled | ||
- dupl | ||
- errcheck | ||
- exportloopref | ||
- goconst | ||
- gofmt | ||
- goimports | ||
- revive | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- nakedret | ||
- nolintlint | ||
- prealloc | ||
- staticcheck | ||
- stylecheck | ||
- typecheck | ||
- unconvert | ||
- unused | ||
|
||
issues: | ||
max-same-issues: 50 | ||
|
||
linters-settings: | ||
dogsled: | ||
max-blank-identifiers: 3 | ||
golint: | ||
min-confidence: 0 | ||
maligned: | ||
suggest-new: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM golang:1.20-alpine as buildbase | ||
|
||
RUN apk add git build-base | ||
|
||
WORKDIR /go/src/github.com/rarimo/forms-svc | ||
COPY vendor . | ||
COPY . . | ||
|
||
RUN GOOS=linux go build -o /usr/local/bin/forms-svc /go/src/github.com/rarimo/forms-svc | ||
|
||
|
||
FROM alpine:3.9 | ||
|
||
COPY --from=buildbase /usr/local/bin/forms-svc /usr/local/bin/forms-svc | ||
RUN apk add --no-cache ca-certificates | ||
|
||
ENTRYPOINT ["forms-svc"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# forms-svc | ||
|
||
## Description | ||
|
||
[//]: # (TODO: add description) | ||
|
||
## Install | ||
|
||
``` | ||
git clone github.com/rarimo/forms-svc | ||
cd forms-svc | ||
go build main.go | ||
export KV_VIPER_FILE=./config.yaml | ||
./main migrate up | ||
./main run service | ||
``` | ||
|
||
## Documentation | ||
|
||
We do use openapi:json standard for API. We use swagger for documenting our API. | ||
|
||
To open online documentation, go to [swagger editor](http://localhost:8080/swagger-editor/) here is how you can start it | ||
``` | ||
cd docs | ||
npm install | ||
npm start | ||
``` | ||
To build documentation use `npm run build` command, | ||
that will create open-api documentation in `web_deploy` folder. | ||
|
||
To generate resources for Go models run `./generate.sh` script in root folder. | ||
use `./generate.sh --help` to see all available options. | ||
|
||
Note: if you are using Gitlab for building project `docs/spec/paths` folder must not be | ||
empty, otherwise only `Build and Publish` job will be passed. | ||
|
||
## Running from docker | ||
|
||
Make sure that docker installed. | ||
|
||
use `docker run ` with `-p 8080:80` to expose port 80 to 8080 | ||
|
||
``` | ||
docker build -t github.com/rarimo/forms-svc . | ||
docker run -e KV_VIPER_FILE=/config.yaml github.com/rarimo/forms-svc | ||
``` | ||
|
||
## Running from Source | ||
|
||
* Set up environment value with config file path `KV_VIPER_FILE=./config.yaml` | ||
* Provide valid config file | ||
* Launch the service with `migrate up` command to create database schema | ||
* Launch the service with `run service` command | ||
|
||
|
||
### Database | ||
For services, we do use ***PostgresSQL*** database. | ||
You can [install it locally](https://www.postgresql.org/download/) or use [docker image](https://hub.docker.com/_/postgres/). | ||
|
||
|
||
### Third-party services | ||
|
||
|
||
## Contact | ||
|
||
Responsible | ||
The primary contact for this project is [//]: # (TODO: place link to your telegram and email) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
log: | ||
level: debug | ||
disable_sentry: true | ||
|
||
db: | ||
url: postgres://forms:[email protected]:5440/forms?sslmode=disable | ||
|
||
listener: | ||
addr: :8000 | ||
|
||
forms: | ||
cooldown: 60m | ||
period: 1m | ||
min_abnormal_period: 1m | ||
max_abnormal_period: 10m | ||
url: forms:forms@tcp(127.0.0.1:5441)/forms | ||
|
||
auth: | ||
addr: http://127.0.0.1:5000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
apiTitle: forms-svc | ||
splitSpec: true | ||
codeSamples: false | ||
swaggerUI: true | ||
travis: true | ||
repo: tokend/notifications/notifications-router-svc | ||
oasVersion: 1.0.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Distributed Lab | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.