This commit is contained in:
2020-08-28 08:32:54 +10:00
parent bb541c73cf
commit f6ae22345b
29 changed files with 18283 additions and 2 deletions
+7 -1
View File
@@ -22,11 +22,17 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Build and push docker image
- name: Build and push backend docker image
run: |
docker build . --tag docker.pkg.github.com/wahyd4/badger/badger:v0.1.$GITHUB_RUN_NUMBER
docker login docker.pkg.github.com -u wahyd4 -p ${{ secrets.GITHUB_TOKEN }}
docker push docker.pkg.github.com/wahyd4/badger/badger:v0.1.$GITHUB_RUN_NUMBER
- name: Build and push UI docker image
run: |
cd www
docker build . --tag docker.pkg.github.com/wahyd4/badger/ui:v0.1.$GITHUB_RUN_NUMBER
docker login docker.pkg.github.com -u wahyd4 -p ${{ secrets.GITHUB_TOKEN }}
docker push docker.pkg.github.com/wahyd4/badger/ui:v0.1.$GITHUB_RUN_NUMBER
- name: deploy deployment to cluster
uses: wahyd4/kubectl-helm-action@master
+76 -1
View File
@@ -67,6 +67,58 @@ spec:
selector:
app: badger
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: badger-ui
spec:
selector:
matchLabels:
app: badger-ui
replicas: 1
template:
metadata:
labels:
app: badger-ui
spec:
containers:
- name: badger-ui
image: "docker.pkg.github.com/wahyd4/badger/ui:{{IMAGE_VERSION}}"
securityContext:
runAsUser: 1000
imagePullPolicy: Always
ports:
- containerPort: 3000
name: ui-port
protocol: TCP
resources:
requests:
cpu: 50m
memory: 100Mi
limits:
cpu: 100m
memory: 256Mi
imagePullSecrets:
- name: regcred
---
apiVersion: v1
kind: Service
metadata:
name: badger-ui
labels:
app: badger-ui
spec:
type: ClusterIP
ports:
- port: 80
targetPort: ui-port
protocol: TCP
name: ui
selector:
app: badger-ui
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
@@ -94,9 +146,32 @@ spec:
- host: badges.toozhao.com
http:
paths:
- backend:
- path: /
pathType: Prefix
backend:
serviceName: badger-ui
servicePort: 80
- path: /badges
pathType: Prefix
backend:
serviceName: badger
servicePort: 80
- path: /svg
pathType: Prefix
backend:
serviceName: badger
servicePort: 80
- path: /api
pathType: Prefix
backend:
serviceName: badger
servicePort: 80
- path: /ping
pathType: Prefix
backend:
serviceName: badger
servicePort: 80
---
apiVersion: monitoring.coreos.com/v1
+16
View File
@@ -0,0 +1,16 @@
{
"env": {
"test": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
}
}
}
+2
View File
@@ -0,0 +1,2 @@
node_modules
dist
+13
View File
@@ -0,0 +1,13 @@
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
+90
View File
@@ -0,0 +1,90 @@
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
/logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# Nuxt generate
dist
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless
# IDE / Editor
.idea
# Service worker
sw.*
# macOS
.DS_Store
# Vim swap files
*.swp
+22
View File
@@ -0,0 +1,22 @@
FROM node:alpine
WORKDIR /app
# copy the app, note .dockerignore
COPY . /app
RUN adduser -D -u 1000 junv
USER junv
RUN apk update \
&& apk add --no-cache git \
&& npm ci \
&& npm run build \
&& npm run generate
ENV NUXT_HOST=0.0.0.0
EXPOSE 3000
CMD [ "npm", "start" ]
+20
View File
@@ -0,0 +1,20 @@
# www
## Build Setup
```bash
# install dependencies
$ npm install
# serve with hot reload at localhost:3000
$ npm run dev
# build for production and launch server
$ npm run build
$ npm run start
# generate static project
$ npm run generate
```
For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org).
+7
View File
@@ -0,0 +1,7 @@
# ASSETS
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your un-compiled assets such as LESS, SASS, or JavaScript.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked).
+29
View File
@@ -0,0 +1,29 @@
<template>
<svg class="NuxtLogo" width="245" height="180" viewBox="0 0 452 342" xmlns="http://www.w3.org/2000/svg">
<path
d="M139 330l-1-2c-2-4-2-8-1-13H29L189 31l67 121 22-16-67-121c-1-2-9-14-22-14-6 0-15 2-22 15L5 303c-1 3-8 16-2 27 4 6 10 12 24 12h136c-14 0-21-6-24-12z"
fill="#00C58E"
/>
<path
d="M447 304L317 70c-2-2-9-15-22-15-6 0-15 3-22 15l-17 28v54l39-67 129 230h-49a23 23 0 0 1-2 14l-1 1c-6 11-21 12-23 12h76c3 0 17-1 24-12 3-5 5-14-2-26z"
fill="#108775"
/>
<path
d="M376 330v-1l1-2c1-4 2-8 1-12l-4-12-102-178-15-27h-1l-15 27-102 178-4 12a24 24 0 0 0 2 15c4 6 10 12 24 12h190c3 0 18-1 25-12zM256 152l93 163H163l93-163z"
fill="#2F495E"
/>
</svg>
</template>
<style>
.NuxtLogo {
animation: 1s appear;
margin: auto;
}
@keyframes appear {
0% {
opacity: 0;
}
}
</style>
+7
View File
@@ -0,0 +1,7 @@
# COMPONENTS
**This directory is not required, you can delete it if you don't want to use it.**
The components directory contains your Vue.js Components.
_Nuxt.js doesn't supercharge these components._
+18
View File
@@ -0,0 +1,18 @@
---
title: Getting started
description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.'
---
Empower your NuxtJS application with `@nuxtjs/content` module: write in a `content/` directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a **Git-based Headless CMS**.
## Writing content
Learn how to write your `content/`, supporting Markdown, YAML, CSV and JSON: https://content.nuxtjs.org/writing.
## Fetching content
Learn how to fetch your content with `$content`: https://content.nuxtjs.org/fetching.
## Displaying content
Learn how to display your Markdown content with the `<nuxt-content>` component directly in your template: https://content.nuxtjs.org/displaying.
+23
View File
@@ -0,0 +1,23 @@
module.exports = {
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/$1',
'^~/(.*)$': '<rootDir>/$1',
'^vue$': 'vue/dist/vue.common.js'
},
moduleFileExtensions: [
'ts',
'js',
'vue',
'json'
],
transform: {
"^.+\\.ts$": "ts-jest",
'^.+\\.js$': 'babel-jest',
'.*\\.(vue)$': 'vue-jest'
},
collectCoverage: true,
collectCoverageFrom: [
'<rootDir>/components/**/*.vue',
'<rootDir>/pages/**/*.vue'
]
}
+7
View File
@@ -0,0 +1,7 @@
# LAYOUTS
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your Application Layouts.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts).
+50
View File
@@ -0,0 +1,50 @@
<template>
<div>
<b-navbar toggleable="md" type="dark" variant="dark">
<b-navbar-brand href="#">Badges</b-navbar-brand>
<b-navbar-toggle target="nav-collapse"> </b-navbar-toggle>
<b-collapse id="nav-collapse" is-nav hidden>
<!--
<b-navbar-nav>
<b-nav-item href="#">more</b-nav-item>
</b-navbar-nav> -->
<!-- Right aligned nav items -->
<b-navbar-nav class="ml-auto" hidden>
<b-nav-item-dropdown right>
<!-- Using 'button-content' slot -->
<template v-slot:button-content>
<em>User</em>
</template>
<b-dropdown-item href="#">Profile</b-dropdown-item>
<b-dropdown-item href="#">Sign Out</b-dropdown-item>
</b-nav-item-dropdown>
</b-navbar-nav>
</b-collapse>
</b-navbar>
<Nuxt />
</div>
</template>
<style>
html {
font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI",
Roboto, "Helvetica Neue", Arial, sans-serif;
font-size: 16px;
word-spacing: 1px;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
box-sizing: border-box;
}
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
}
</style>
+8
View File
@@ -0,0 +1,8 @@
# MIDDLEWARE
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your application middleware.
Middleware let you define custom functions that can be run before rendering either a page or a group of pages.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware).
+78
View File
@@ -0,0 +1,78 @@
export default {
/*
** Nuxt rendering mode
** See https://nuxtjs.org/api/configuration-mode
*/
mode: 'universal',
/*
** Nuxt target
** See https://nuxtjs.org/api/configuration-target
*/
target: 'static',
/*
** Headers of the page
** See https://nuxtjs.org/api/configuration-head
*/
head: {
title: process.env.npm_package_name || '',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
/*
** Global CSS
*/
css: [
],
/*
** Plugins to load before mounting the App
** https://nuxtjs.org/guide/plugins
*/
plugins: [
],
/*
** Auto import components
** See https://nuxtjs.org/api/configuration-components
*/
components: true,
/*
** Nuxt.js dev-modules
*/
buildModules: [
'@nuxt/typescript-build',
],
/*
** Nuxt.js modules
*/
modules: [
// Doc: https://bootstrap-vue.js.org
'bootstrap-vue/nuxt',
// Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/axios',
'@nuxtjs/pwa',
// Doc: https://github.com/nuxt/content
'@nuxt/content',
],
/*
** Axios module configuration
** See https://axios.nuxtjs.org/options
*/
axios: {},
/*
** Content module configuration
** See https://content.nuxtjs.org/configuration
*/
content: {},
/*
** Build configuration
** See https://nuxtjs.org/api/configuration-build/
*/
build: {
}
}
+17623
View File
File diff suppressed because it is too large Load Diff
+33
View File
@@ -0,0 +1,33 @@
{
"name": "www",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "nuxt-ts",
"build": "nuxt-ts build",
"start": "nuxt-ts start",
"generate": "nuxt-ts generate",
"test": "jest"
},
"dependencies": {
"@nuxt/content": "^1.5.0",
"@nuxt/typescript-runtime": "^1.0.0",
"@nuxtjs/axios": "^5.12.0",
"@nuxtjs/pwa": "^3.0.0-beta.20",
"bootstrap": "^4.5.0",
"bootstrap-vue": "^2.15.0",
"nuxt": "^2.14.0"
},
"devDependencies": {
"@nuxt/types": "^2.14.0",
"@nuxt/typescript-build": "^2.0.2",
"@vue/test-utils": "^1.0.3",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^26.1.0",
"jest": "^26.1.0",
"node-sass": "^4.14.1",
"sass-loader": "^10.0.1",
"ts-jest": "^26.1.3",
"vue-jest": "^3.0.4"
}
}
+6
View File
@@ -0,0 +1,6 @@
# PAGES
This directory contains your Application Views and Routes.
The framework reads all the `*.vue` files inside this directory and creates the router of your application.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing).
+72
View File
@@ -0,0 +1,72 @@
<template>
<div class="container">
<b-container fluid>
<b-row class="row-space">
<b-col md="4" offset-md="4">
<div class="intro">
<img src="report.png" />
</div>
</b-col>
</b-row>
<b-row class="row-space">
<b-col md="2" offset-md="5">
<b-button variant="primary">Generate Badge</b-button>
</b-col>
</b-row>
<b-row class="row-space">
<b-col md="1" offset-md="2">
<img src="https://badges.toozhao.com/badges/mel/green.svg" />
</b-col>
<b-col md="1" offset-md="2">
<img src="https://badges.toozhao.com/badges/mel/blue.svg" />
</b-col>
<b-col md="1" offset-md="2">
<img src="https://badges.toozhao.com/badges/mel/orange.svg" />
</b-col>
</b-row>
<b-row class="row-space">
<b-col md="8" offset-md="2">
<p>Please copy the markdown script from the textarea to your Github readme.md or any other web page you want to monitor.</p>
<b-form-textarea
id="textarea"
v-model="text"
placeholder="![Mel Air Index](https://badges.toozhao.com/badges/mel/green.svg)"
rows="3"
max-rows="6"
></b-form-textarea>
</b-col>
</b-row>
</b-container>
</div>
</template>
<script lang="ts">
import Vue from "vue";
export default Vue.extend({});
</script>
<style lang="scss">
.container {
margin: 0 auto;
min-height: 70vh;
display: flex;
.row-space {
margin-bottom: 10vh;
}
.intro {
img {
max-width: 40vh;
display: flex;
align-items: center;
justify-content: center;
}
}
.badge-md textarea {
width: 100%;
}
}
</style>
+7
View File
@@ -0,0 +1,7 @@
# PLUGINS
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains Javascript plugins that you want to run before mounting the root Vue.js application.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins).
+11
View File
@@ -0,0 +1,11 @@
# STATIC
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your static files.
Each file inside this directory is mapped to `/`.
Thus you'd want to delete this README.md before deploying to production.
Example: `/static/robots.txt` is mapped as `/robots.txt`.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static).
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

+3
View File
@@ -0,0 +1,3 @@
User-agent: *
Disallow: *
Allow: /
+10
View File
@@ -0,0 +1,10 @@
# STORE
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your Vuex Store files.
Vuex Store option is implemented in the Nuxt.js framework.
Creating a file in this directory automatically activates the option in the framework.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store).
+9
View File
@@ -0,0 +1,9 @@
import { mount } from '@vue/test-utils'
import Logo from '@/components/Logo.vue'
describe('Logo', () => {
test('is a Vue instance', () => {
const wrapper = mount(Logo)
expect(wrapper.vm).toBeTruthy()
})
})
+36
View File
@@ -0,0 +1,36 @@
{
"compilerOptions": {
"target": "ES2018",
"module": "ESNext",
"moduleResolution": "Node",
"lib": [
"ESNext",
"ESNext.AsyncIterable",
"DOM"
],
"esModuleInterop": true,
"allowJs": true,
"sourceMap": true,
"strict": true,
"noEmit": true,
"experimentalDecorators": true,
"baseUrl": ".",
"paths": {
"~/*": [
"./*"
],
"@/*": [
"./*"
]
},
"types": [
"@types/node",
"@nuxt/types"
]
},
"exclude": [
"node_modules",
".nuxt",
"dist"
]
}