Skip to content

Commit

Permalink
Using storm instead of sqlite
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Rana <[email protected]>
  • Loading branch information
vishr committed Apr 7, 2018
1 parent 174eb82 commit 79ad9d6
Show file tree
Hide file tree
Showing 139 changed files with 12,984 additions and 220,330 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
.DS_Store
*.db
build
dist
public
node_modules
_test
.vscode
.idea
*.iml
46 changes: 46 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
build:
main: cmd/armor/main.go
goos:
- darwin
- linux
- windows
goarch:
- amd64
- 386
- arm
- arm64
goarm:
- 6
- 7

nfpm:
formats:
- deb
- rpm
replacements:
amd64: 64-bit
386: 32-bit
vendor: "LabStack"
homepage: "https://armor.labstack.com"
maintainer: "Vishal Rana <[email protected]>"
description: "Uncomplicated, modern HTTP server"
license: "MIT"

archive:
format: tgz
format_overrides:
- goos: windows
format: zip
replacements:
amd64: 64-bit
386: 32-bit
darwin: macos
files:
- README.md
- LICENSE

checksum:
name_template: "{{ .ProjectName }}_checksum.txt"

release:
draft: true
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM frolvlad/alpine-glibc
FROM alpine:3.7

# https://letsencrypt.org
RUN apk add --no-cache ca-certificates

COPY build/armor-*-linux-amd64 /usr/local/bin/armor
COPY dist/linux_amd64/armor /usr/local/bin

ENTRYPOINT ["armor"]
ENTRYPOINT ["armor"]
33 changes: 23 additions & 10 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
name = "github.com/Knetic/govaluate"
version = "3.0.0"

[[constraint]]
name = "github.com/asdine/storm"
version = "2.1.0"

[[constraint]]
name = "github.com/docker/libkv"
version = "0.2.1"
Expand Down Expand Up @@ -65,10 +69,6 @@
branch = "master"
name = "github.com/lib/pq"

[[constraint]]
name = "github.com/mattn/go-sqlite3"
version = "1.6.0"

[[constraint]]
branch = "master"
name = "github.com/mitchellh/go-homedir"
Expand Down
15 changes: 6 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
IMAGE = labstack/armor
VERSION = 0.4.4
VERSION = 0.4.5

clean:
rm -rf build

build: clean
xgo --targets=darwin-10.8/amd64,linux/amd64,linux/arm-6,linux/arm-7,linux/arm64,windows-8.0/amd64 --pkg cmd/armor -out build/armor-$(VERSION) github.com/labstack/armor
publish:
git tag $(VERSION)
git push origin --tags
goreleaser --rm-dist
docker build -t $(IMAGE):$(VERSION) -t $(IMAGE) .

push: build
docker push $(IMAGE):$(VERSION)
docker push $(IMAGE):latest

.PHONY: clean build push
.PHONY: publish
41 changes: 41 additions & 0 deletions admin/ui/build/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
'use strict'
require('./check-versions')()

process.env.NODE_ENV = 'production'

const ora = require('ora')
const rm = require('rimraf')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')

const spinner = ora('building for production...')
spinner.start()

rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
if (err) throw err
webpack(webpackConfig, (err, stats) => {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
chunks: false,
chunkModules: false
}) + '\n\n')

if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'))
process.exit(1)
}

console.log(chalk.cyan(' Build complete.\n'))
console.log(chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.\n' +
' Opening index.html over file:// won\'t work.\n'
))
})
})
54 changes: 54 additions & 0 deletions admin/ui/build/check-versions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
'use strict'
const chalk = require('chalk')
const semver = require('semver')
const packageConfig = require('../package.json')
const shell = require('shelljs')

function exec (cmd) {
return require('child_process').execSync(cmd).toString().trim()
}

const versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
}
]

if (shell.which('npm')) {
versionRequirements.push({
name: 'npm',
currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm
})
}

module.exports = function () {
const warnings = []

for (let i = 0; i < versionRequirements.length; i++) {
const mod = versionRequirements[i]

if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
warnings.push(mod.name + ': ' +
chalk.red(mod.currentVersion) + ' should be ' +
chalk.green(mod.versionRequirement)
)
}
}

if (warnings.length) {
console.log('')
console.log(chalk.yellow('To use this template, you must update following to modules:'))
console.log()

for (let i = 0; i < warnings.length; i++) {
const warning = warnings[i]
console.log(' ' + warning)
}

console.log()
process.exit(1)
}
}
Binary file added admin/ui/build/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 101 additions & 0 deletions admin/ui/build/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
'use strict'
const path = require('path')
const config = require('../config')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const packageConfig = require('../package.json')

exports.assetsPath = function (_path) {
const assetsSubDirectory = process.env.NODE_ENV === 'production'
? config.build.assetsSubDirectory
: config.dev.assetsSubDirectory

return path.posix.join(assetsSubDirectory, _path)
}

exports.cssLoaders = function (options) {
options = options || {}

const cssLoader = {
loader: 'css-loader',
options: {
sourceMap: options.sourceMap
}
}

const postcssLoader = {
loader: 'postcss-loader',
options: {
sourceMap: options.sourceMap
}
}

// generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]

if (loader) {
loaders.push({
loader: loader + '-loader',
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}

// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader'
})
} else {
return ['vue-style-loader'].concat(loaders)
}
}

// https://vue-loader.vuejs.org/en/configurations/extract-css.html
return {
css: generateLoaders(),
postcss: generateLoaders(),
less: generateLoaders('less'),
sass: generateLoaders('sass', { indentedSyntax: true }),
scss: generateLoaders('sass'),
stylus: generateLoaders('stylus'),
styl: generateLoaders('stylus')
}
}

// Generate loaders for standalone style files (outside of .vue)
exports.styleLoaders = function (options) {
const output = []
const loaders = exports.cssLoaders(options)

for (const extension in loaders) {
const loader = loaders[extension]
output.push({
test: new RegExp('\\.' + extension + '$'),
use: loader
})
}

return output
}

exports.createNotifierCallback = () => {
const notifier = require('node-notifier')

return (severity, errors) => {
if (severity !== 'error') return

const error = errors[0]
const filename = error.file && error.file.split('!').pop()

notifier.notify({
title: packageConfig.name,
message: severity + ': ' + error.name,
subtitle: filename || '',
icon: path.join(__dirname, 'logo.png')
})
}
}
Loading

0 comments on commit 79ad9d6

Please sign in to comment.