Skip to content

Commit

Permalink
Merge branch 'create-keygen-service' into 'dev'
Browse files Browse the repository at this point in the history
init project

Closes #1

See merge request ergo/rosen-bridge/keygen-service!1
  • Loading branch information
vorujack committed May 28, 2024
2 parents e7df3ae + 1a55b56 commit e7f889c
Show file tree
Hide file tree
Showing 40 changed files with 12,234 additions and 74 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@rosen-bridge/changeset-formatter",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "dev",
"updateInternalDependencies": "patch",
"ignore": []
}
2 changes: 2 additions & 0 deletions .changeset/small-ducks-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
22 changes: 22 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.idea
node_modules
.nyc_output
coverage
dir
build
dist
logs
tests
docker*
Dockerfile
.dockerignore
.env
.git*
.eslintignore
README.md
.husky
.lintstagedrc.js
.mocharc.json
.prettierrc.json
vitest.config.ts
peer-dialer*.json
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
docker
13 changes: 13 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"root": true,
"env": {
"node": true
},
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
]
}
64 changes: 64 additions & 0 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build and Push Docker Image

on:
release:
types: [published]
push:
branches:
- dev

jobs:
build:
name: Build and Push Docker Image
runs-on: ubuntu-latest

steps:
- name: Checkout the Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download Release From tss-api
uses: dsaltares/[email protected]
with:
repo: 'rosen-bridge/tss-api'
version: 'latest'
regex: true
file: 'rosenTss-linux-*'
target: './bin/'

- name: Move the Files
run: |
mv ./docker/production.yaml ./config/
mv ./docker/custom-environment-variables.yaml ./config/
7z x ./bin/rosenTss-linux-* -obin/ && rm -rf ./bin/*.zip
mv ./bin/rosenTss-* ./bin/rosenTss
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: ${{ vars.PLATFORM_LIST || 'linux/amd64' }}

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

- name: Login to Docker Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: rosen-bridge
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Metadata action
uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/rosen-bridge/keygen-service

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: ${{ vars.PLATFORM_LIST || 'linux/amd64' }}
push: true
tags: ${{ steps.meta.outputs.tags }}
21 changes: 21 additions & 0 deletions .github/workflows/mirroring.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Mirroring

on:
push:
branches:
- master
- dev
tags:
- '*'

jobs:
git-sync:
runs-on: ubuntu-latest
steps:
- name: git-sync
uses: wei/git-sync@v3
with:
source_repo: ${GITHUB_REPOSITORY}
source_branch: ${{github.ref_name}}
destination_repo: 'https://${{ secrets.DESTINATION_USER }}:${{ secrets.DESTINATION_TOKEN }}@${{ secrets.DESTINATION_SERVER }}/ergo/${GITHUB_REPOSITORY}.git'
destination_branch: ${{github.ref_name}}
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
yarn.lock
.idea
.vscode
node_modules
.nyc_output
coverage
dir
build
dist
logs
peer-dialer*.json
bin
config/rosen/
config/thresholds.json
config/production.yaml
config/local*.yaml
.env
.DS_Store
49 changes: 49 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
image: node:20.11

stages:
- installation
- type_check
- lint
- changeset

installation:
stage: installation
cache:
key: $CI_COMMIT_REF_NAME
policy: push
paths:
- node_modules
script:
- npm ci

type_check:
stage: type_check
cache:
key: $CI_COMMIT_REF_NAME
policy: pull
paths:
- node_modules
script:
- npm run type-check

lint:
stage: lint
cache:
key: $CI_COMMIT_REF_NAME
policy: pull
paths:
- node_modules
script:
- npm run lint

changeset:
stage: changeset
cache:
key: $CI_COMMIT_REF_NAME
policy: pull
paths:
- node_modules
before_script:
- git fetch origin dev
script:
- npx changeset status --since=origin/dev
15 changes: 15 additions & 0 deletions .gitlab/issue_templates/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
**Issue Description:**

<TBD / N/A>

**Solution:**

<TBD / N/A>

**Acceptance Conditions:**

<TBD / N/A>

**Requierd Unit Tests:**

<TBD / N/A>
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
5 changes: 5 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
'*.ts': () => 'tsc --noEmit',
'*.{js,ts}': 'eslint --fix',
'*': 'prettier --ignore-unknown --write',
};
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.11.0
3 changes: 3 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM node:18.12

LABEL maintainer="rosen-bridge team <[email protected]>"
LABEL description="Docker image for the keygen-service owned by rosen-bridge organization."
LABEL org.label-schema.vcs-url="https://github.com/rosen-bridge/keygen-service"

RUN adduser --disabled-password --home /app --uid 8080 --gecos "ErgoPlatform" ergo && \
install -m 0740 -o ergo -g ergo -d /app/peer-dialer /app/logs /app/tss-api/logs /app/tss-api/home \
&& chown -R ergo:ergo /app/ && umask 0077
USER ergo

WORKDIR /app
COPY --chmod=700 --chown=ergo:ergo package*.json ./
ADD --chmod=700 --chown=ergo:ergo ./patches/ ./patches/
RUN npm ci
COPY --chmod=700 --chown=ergo:ergo . .
RUN npm run build

ENV NODE_ENV=production
ENV SERVICE_PORT=8080
ENV TSS_HOME_ADDRESS="/app/tss-api/home"
ENV TSS_LOG_ADDRESS="/app/tss-api/logs"

EXPOSE 8080

ENTRYPOINT ["npm", "run", "start"]
Loading

0 comments on commit e7f889c

Please sign in to comment.