-
Notifications
You must be signed in to change notification settings - Fork 4
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 4402246
Showing
117 changed files
with
27,612 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,20 @@ | ||
FROM node:lts as builder | ||
|
||
ARG BUILD_BRANCH_ENV_PREFIX | ||
|
||
WORKDIR /app | ||
COPY . . | ||
# Two steps to copy .env.branch only if no .env exists | ||
# (it is needed to support docker-compose with local env and kubernetes prod build at the same time) | ||
# 1. just copy | ||
COPY .env${BUILD_BRANCH_ENV_PREFIX} .env | ||
# 2. overwrite .env back if it exists (dummy package.json to ensure COPY not to fail) | ||
COPY package.json .en[v] ./ | ||
RUN npm ci && npm run production | ||
|
||
FROM nginx:stable-alpine | ||
RUN rm -rf /usr/share/nginx/html | ||
COPY --from=builder /app/dist /usr/share/nginx/html | ||
COPY --from=builder /app/.docker/vhost.conf /etc/nginx/conf.d/default.conf | ||
EXPOSE 80 | ||
CMD ["nginx", "-g", "daemon off;"] |
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,34 @@ | ||
server { | ||
root /usr/share/nginx/html; | ||
error_page 404 /404.html; | ||
|
||
# request /exist/index.html, serve /exist/index.html, location HTML | ||
# request /notexist/index.html, serve /200.html, location HTML | ||
# request /exist, serve /exist/indext.html, location ROOT | ||
# request /notexist, serve /200.html, location HTML | ||
# request /, serve /index.html, location ROOT | ||
|
||
# ROOT | ||
# handles existent / with /index.html, /asd with /asd/index.html | ||
# rewrite unexistent /asd/asd with /200.html and move to html location | ||
# non html files should be handled in last location, otherwise they will get no-cache header | ||
location / { | ||
try_files $uri $uri/index.html /200.html; | ||
add_header Cache-Control "no-cache"; | ||
# add_header x-root "root" always; | ||
} | ||
|
||
# HTML | ||
location ~* \.html$ { | ||
try_files $uri /200.html; | ||
add_header Cache-Control "no-cache"; | ||
# add_header x-html "html" always; | ||
} | ||
|
||
# FILES | ||
# allow 404 errors for files with non-html extension | ||
location ~* "\.\w{2,6}$" { | ||
try_files $uri =404; | ||
# add_header x-full-static "full-static" always; | ||
} | ||
} |
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 @@ | ||
# dependencies | ||
node_modules/ | ||
|
||
*.log | ||
|
||
# Nuxt build | ||
.nuxt | ||
|
||
tmp |
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,13 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[{.babelrc,.stylelintrc,.eslintrc*,jest.config,*.json,*.jsb3,*.jsb2,*.bowerrc,*.yaml,*.yml}] | ||
indent_size = 2 |
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,24 @@ | ||
### MAINNET | ||
APP_ENV=mainnet | ||
APP_ACCOUNTS_API_URL=https://my.minter.network/api/v1/ | ||
APP_GATE_API_URL=https://gate-api.minter.network/api/v2/ | ||
APP_EXPLORER_HOST=https://explorer.minter.network | ||
APP_EXPLORER_API_URL=https://explorer-api.minter.network/api/v2/ | ||
APP_EXPLORER_RTM_URL=wss://explorer-rtm.minter.network/connection/websocket | ||
APP_EXPLORER_STATIC_HOST=https://explorer-static.minter.network | ||
APP_HUB_API_URL=https://hub-api.minter.network/ | ||
|
||
### TESTNET | ||
#APP_ENV=testnet | ||
#APP_ACCOUNTS_API_URL=https://my.beta.minter.network/api/v1/ | ||
#APP_GATE_API_URL=https://gate.minter.network/api/v1/ | ||
#APP_EXPLORER_HOST=https://testnet.explorer.minter.network | ||
#APP_EXPLORER_API_URL=https://explorer-api.testnet.minter.network/api/v1/ | ||
#APP_EXPLORER_RTM_URL=wss://explorer-rtm.testnet.minter.network/connection/websocket | ||
|
||
### TESTNET BOT | ||
#APP_BOT_WALLET_API_URL= | ||
#APP_BOT_WALLET_ENCRYPTED= | ||
#APP_BOT_WALLET_PASSWORD= | ||
|
||
WEB_PORT_FOR_DOCKER_COMPOSE=5010 |
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,8 @@ | ||
APP_ENV=testnet | ||
APP_ACCOUNTS_API_URL=https://my.beta.minter.network/api/v1/ | ||
APP_GATE_API_URL=https://gate-api.taconet.minter.network/api/v2/ | ||
APP_EXPLORER_HOST=https://explorer.taconet.minter.network | ||
APP_EXPLORER_API_URL=https://explorer-api.taconet.minter.network/api/v2/ | ||
APP_EXPLORER_RTM_URL=wss://explorer-rtm.taconet.minter.network/connection/websocket | ||
APP_EXPLORER_STATIC_HOST=https://explorer-static.taconet.minter.network | ||
APP_HUB_API_URL=https://hub-api.dl-dev.ru/ |
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,8 @@ | ||
APP_ENV=testnet | ||
APP_ACCOUNTS_API_URL=https://my.beta.minter.network/api/v1/ | ||
APP_GATE_API_URL=https://gate-api.testnet.minter.network/api/v2/ | ||
APP_EXPLORER_HOST=https://explorer.testnet.minter.network | ||
APP_EXPLORER_API_URL=https://explorer-api.testnet.minter.network/api/v2/ | ||
APP_EXPLORER_RTM_URL=wss://explorer-rtm.testnet.minter.network/connection/websocket | ||
APP_EXPLORER_STATIC_HOST=https://explorer-static.testnet.minter.network | ||
APP_HUB_API_URL=https://hub-api.dl-dev.ru/ |
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,33 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
browser: true, | ||
node: true, | ||
}, | ||
parserOptions: { | ||
parser: 'babel-eslint', | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention | ||
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules. | ||
'plugin:vue/essential', | ||
], | ||
// required to lint *.vue files | ||
plugins: [ | ||
'vue', | ||
], | ||
// add your custom rules here | ||
rules: { | ||
'arrow-parens': ["error", "always"], | ||
'no-unused-vars': 0, | ||
'no-undef': 0, | ||
'no-console': 0, | ||
'no-empty': 0, | ||
'comma-dangle': ["error", "always-multiline"], | ||
'comma-spacing': ["error", { "before": false, "after": true }], | ||
'semi': ["error", "always"], | ||
'semi-spacing': "error", | ||
'space-before-function-paren': ["error", "never"], | ||
}, | ||
}; |
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,93 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ master, dev, testnet ] | ||
env: | ||
PRODUCTION_BRANCH: "master" | ||
INGRESS_DOMAIN_master: "honee.app" | ||
INGRESS_DOMAIN_dev: "honee.dev" | ||
INGRESS_DOMAIN_testnet: "honee.kubernetes.icu" | ||
KUBE_NAMESPACE_master: "honee" | ||
KUBE_NAMESPACE_dev: "default" | ||
KUBE_NAMESPACE_testnet: "testnet" | ||
jobs: | ||
ci: | ||
name: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: set env BUILD_BRANCH | ||
run: echo "BUILD_BRANCH=$(echo $GITHUB_REF | sed 's:refs/heads/::')" >> $GITHUB_ENV | ||
|
||
- name: set branch prefix env to be used during docker build, .e.g. "refs/heads/testnet" => ".testnet" | ||
run: echo "BUILD_BRANCH_ENV_PREFIX=$(echo .$BUILD_BRANCH)" >> $GITHUB_ENV | ||
|
||
- name: set env PROJECT_NAME | ||
run: echo "PROJECT_NAME=$(echo $GITHUB_REPOSITORY | sed "s:MinterTeam/::")" >> $GITHUB_ENV | ||
|
||
- name: set env INGRESS_DOMAIN | ||
env: | ||
INGRESS_DOMAIN_KEY: INGRESS_DOMAIN_${{ env.BUILD_BRANCH }} | ||
run: echo "INGRESS_DOMAIN=$(echo ${!INGRESS_DOMAIN_KEY})" >> $GITHUB_ENV | ||
|
||
- name: set env KUBE_NAMESPACE | ||
env: | ||
KUBE_NAMESPACE_KEY: KUBE_NAMESPACE_${{ env.BUILD_BRANCH }} | ||
run: echo "KUBE_NAMESPACE=$(echo ${!KUBE_NAMESPACE_KEY})" >> $GITHUB_ENV | ||
|
||
- uses: actions/checkout@v2 | ||
- name: build and push docker image | ||
uses: opspresso/[email protected] | ||
env: | ||
USERNAME: ${{ secrets.MINTER_REGISTRY_USERNAME }} | ||
PASSWORD: ${{ secrets.MINTER_REGISTRY_PASSWORD }} | ||
REGISTRY: "registry.minter.network" | ||
IMAGE_NAME: ${{ env.PROJECT_NAME }} | ||
LATEST: "true" | ||
TAG_NAME: ${{ github.sha }} | ||
DOCKERFILE: ".docker/Dockerfile" | ||
DOCKER_BUILD_ARGS: --build-arg BUILD_BRANCH_ENV_PREFIX | ||
|
||
# - name: DigitalOcean Kubernetes | ||
# if: env.BUILD_BRANCH == env.PRODUCTION_BRANCH | ||
# uses: matootie/[email protected] | ||
# with: | ||
# personalAccessToken: ${{ secrets.DIGITALOCEAN_TOKEN }} | ||
# clusterName: k8s-prod-do | ||
# | ||
# - name: Install helm | ||
# if: env.BUILD_BRANCH == env.PRODUCTION_BRANCH | ||
# run: wget https://get.helm.sh/helm-v3.3.4-linux-amd64.tar.gz &> /dev/null && tar xvzf helm-v3.3.4-linux-amd64.tar.gz && chmod 777 linux-amd64/helm && ./linux-amd64/helm ls -n ${{ env.KUBE_NAMESPACE }} | ||
# | ||
# - name: Deploy to DO | ||
# if: env.BUILD_BRANCH == env.PRODUCTION_BRANCH | ||
# env: | ||
# TAG_NAME: ${{ github.sha }} | ||
# run: ./linux-amd64/helm upgrade -n ${{ env.KUBE_NAMESPACE }} -i $PROJECT_NAME chart/ --atomic --timeout 100s --set image.tag=$TAG_NAME --set ingress.domain=$INGRESS_DOMAIN --set ingress.tlsname=$INGRESS_DOMAIN | ||
|
||
- name: deploy to production cluster | ||
if: env.BUILD_BRANCH == env.PRODUCTION_BRANCH | ||
uses: wahyd4/[email protected] | ||
env: | ||
KUBE_CONFIG_DATA: ${{ secrets.KUBE_PROD_CONFIG_DATA }} | ||
TAG_NAME: ${{ github.sha }} | ||
with: | ||
args: helm upgrade -n $KUBE_NAMESPACE -i $PROJECT_NAME chart/ --atomic --timeout 100s --set image.tag=$TAG_NAME --set ingress.domain=$INGRESS_DOMAIN --set ingress.tlsname=$INGRESS_DOMAIN | ||
|
||
- name: deploy to staging cluster | ||
if: env.BUILD_BRANCH != env.PRODUCTION_BRANCH | ||
uses: wahyd4/kubectl-helm-action@master | ||
env: | ||
KUBE_CONFIG_DATA: ${{ secrets.KUBE_STAGE_CONFIG_DATA }} | ||
TAG_NAME: ${{ github.sha }} | ||
with: | ||
args: helm upgrade -n $KUBE_NAMESPACE -i ${{ env.PROJECT_NAME }} chart/ --atomic --timeout 100s --set image.tag=$TAG_NAME --set ingress.domain=$INGRESS_DOMAIN --set ingress.tlsname=$INGRESS_DOMAIN --set ingress.issuer=letsencrypt-http --set ingress.clusterissuer="" | ||
|
||
- name: notification | ||
if: cancelled() == false | ||
uses: xinthink/[email protected] | ||
with: | ||
botToken: ${{ secrets.TELEGRAM_CI_TOKEN }} | ||
chatId: ${{ secrets.TELEGRAM_CI_TO }} | ||
jobStatus: ${{ job.status }} | ||
skipSuccess: 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,20 @@ | ||
/assets/css/onsen.css | ||
/static/css/ | ||
/static/img/ | ||
/tmp/ | ||
/.env | ||
sw.* | ||
|
||
|
||
|
||
# dependencies | ||
node_modules | ||
|
||
# logs | ||
npm-debug.log | ||
|
||
# Nuxt build | ||
.nuxt | ||
|
||
# Nuxt generate | ||
dist |
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,43 @@ | ||
# Honee | ||
|
||
[honee.app](https://honee.app) | ||
|
||
## Install | ||
|
||
- clone the repo | ||
- ensure latest stable Node.js and NPM are installed | ||
- install node_modules `npm ci` | ||
- copy .env.master `cp .env.master .env` | ||
- set correct .env variables | ||
- build `npm run production` | ||
- now you have static assets in the `./dist/` folder, you have to distribute them with some web server like Nginx (or run `npm run start`, but it's not recommended for production) | ||
|
||
|
||
## Deployment script | ||
|
||
Build in Nuxt SPA mode | ||
``` | ||
npm ci && npm run production | ||
``` | ||
Root folder: `./dist/` | ||
|
||
|
||
|
||
### Nuxt build cheatsheet | ||
|
||
``` bash | ||
# install dependencies | ||
$ npm install # Or yarn install | ||
|
||
# serve with hot reload at localhost:3000 | ||
$ npm run dev | ||
|
||
# build for production and launch server | ||
$ npm run build | ||
$ npm start | ||
|
||
# generate static project | ||
$ npm run generate | ||
``` | ||
|
||
For detailed explanation on how things work, checkout the [Nuxt.js docs](https://github.com/nuxt/nuxt.js). |
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,26 @@ | ||
import MinterOrg from 'minter-js-org'; | ||
import {ACCOUNTS_API_URL} from "~/assets/variables"; | ||
|
||
const minterOrg = new MinterOrg({ | ||
baseURL: ACCOUNTS_API_URL, | ||
}); | ||
|
||
const TOKEN_KEY = 'auth-token'; | ||
const initialToken = typeof localStorage !== 'undefined' ? JSON.parse(localStorage.getItem(TOKEN_KEY)) : false; | ||
|
||
|
||
|
||
export default minterOrg; | ||
|
||
/** | ||
* @param {TokenData} tokenData | ||
*/ | ||
export function setAuthToken(tokenData) { | ||
minterOrg.setAuthToken(tokenData); | ||
localStorage.setItem(TOKEN_KEY, JSON.stringify(tokenData)); | ||
} | ||
|
||
export function resetAuthToken() { | ||
minterOrg.resetAuthToken(); | ||
localStorage.removeItem(TOKEN_KEY); | ||
} |
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,29 @@ | ||
import axios from 'axios'; | ||
import {cacheAdapterEnhancer, Cache} from 'axios-extensions'; | ||
import {CHAINIK_API_URL} from "~/assets/variables"; | ||
import addToCamelInterceptor from '~/assets/to-camel.js'; | ||
|
||
const instance = axios.create({ | ||
baseURL: CHAINIK_API_URL, | ||
adapter: cacheAdapterEnhancer(axios.defaults.adapter, { enabledByDefault: false}), | ||
}); | ||
addToCamelInterceptor(instance); | ||
|
||
// 10 min cache | ||
const coinsCache = new Cache({maxAge: 10 * 60 * 1000}); | ||
/** | ||
* @return {Promise<Object.<number, string|null>>} | ||
*/ | ||
export function getCoinIconList() { | ||
return instance.get('coins.json', { | ||
cache: coinsCache, | ||
}) | ||
.then((response) => { | ||
const coins = response.data; | ||
let iconMap = {}; | ||
coins.forEach((coin) => { | ||
iconMap[coin.id] = coin.icon; | ||
}); | ||
return iconMap; | ||
}); | ||
} |
Oops, something went wrong.