serverless_hub 0.1.10 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/bin/serverless_hub +17 -0
- data/lib/serverless_hub/handler.rb +2 -0
- data/lib/serverless_hub/templates/.gitignore +52 -0
- data/lib/serverless_hub/templates/Dockerfile +8 -0
- data/lib/serverless_hub/templates/config/serverless.yml +44 -0
- data/lib/serverless_hub/templates/package.json +22 -0
- data/lib/serverless_hub/templates/serverless.js +54 -0
- data/lib/serverless_hub/version.rb +1 -1
- data/serverless_hub.gemspec +3 -2
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78dddd07d3a363073ad81fcdca3e33f85edd52c8cd3d2a9dbe5e689a988285fc
|
4
|
+
data.tar.gz: 92d40764480304a0b80faca2fb9c249e72d8fc4dc041aeff2aeb4f1988a8d294
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1f069e12f40dad8c04f33eb5e2b1398f1b718e48c2d0e0d96ef0f9d56a32057f529417231beaac60496322c59358baf9c7f64d8b1ecfe2fb68019aef6691f0c
|
7
|
+
data.tar.gz: 98af094fbf04b7ccdc24aa275e19c8f5b3b5844ef65c8d2b26833f697e7c0bdeb6f6aa52532d22a6301128914375d0d9e6315dd44941d983913f7b9372d531db
|
data/.gitignore
CHANGED
data/bin/serverless_hub
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'serverless_hub'
|
4
|
+
require 'rails/generators'
|
5
|
+
|
6
|
+
class SLSGenerator < Rails::Generators::Base
|
7
|
+
source_root File.expand_path('../lib/serverless_hub/templates', __dir__)
|
8
|
+
|
9
|
+
def copy
|
10
|
+
directory "./", "./"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
generator = SLSGenerator.new
|
16
|
+
|
17
|
+
generator.copy
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
.DS_Store
|
10
|
+
|
11
|
+
# Ignore all logfiles and tempfiles.
|
12
|
+
/log/*
|
13
|
+
/tmp/*
|
14
|
+
!/log/.keep
|
15
|
+
!/tmp/.keep
|
16
|
+
|
17
|
+
/node_modules
|
18
|
+
/yarn-error.log
|
19
|
+
|
20
|
+
.byebug_history
|
21
|
+
/public/packs
|
22
|
+
/public/packs-test
|
23
|
+
/node_modules
|
24
|
+
|
25
|
+
.byebug_history
|
26
|
+
.idea/*
|
27
|
+
vendor/bundle
|
28
|
+
|
29
|
+
# Ignore general setting
|
30
|
+
.ruby-version
|
31
|
+
.ruby-gemset
|
32
|
+
.env
|
33
|
+
/test/*
|
34
|
+
!/test/mailers
|
35
|
+
/public/packs
|
36
|
+
/public/packs-test
|
37
|
+
yarn-debug.log*
|
38
|
+
.yarn-integrity
|
39
|
+
vendor
|
40
|
+
.serverless
|
41
|
+
lib
|
42
|
+
layer
|
43
|
+
.bundle
|
44
|
+
config.priv.yml
|
45
|
+
node_modules
|
46
|
+
layer
|
47
|
+
node_modules
|
48
|
+
serverless.priv.yml
|
49
|
+
.serverless
|
50
|
+
.byebug_history
|
51
|
+
tmp
|
52
|
+
.env
|
@@ -0,0 +1,44 @@
|
|
1
|
+
service: hello
|
2
|
+
|
3
|
+
custom:
|
4
|
+
settings: ${file(./config/serverless.priv.yml):${self:provider.stage}}
|
5
|
+
|
6
|
+
provider:
|
7
|
+
name: aws
|
8
|
+
runtime: ruby2.5
|
9
|
+
region: ap-southeast-2
|
10
|
+
stage: ${opt:stage, 'dev'}
|
11
|
+
environment:
|
12
|
+
RACK_ENV: production
|
13
|
+
RAILS_ENV: production
|
14
|
+
JWKS_URL: ${env:JWKS_URL, self:custom.settings.jwks_url}
|
15
|
+
DATABASE_URL: ${env:DATABASE_URL, self:custom.settings.database_url}
|
16
|
+
|
17
|
+
package:
|
18
|
+
exclude:
|
19
|
+
- layer/**
|
20
|
+
- node_modules/**
|
21
|
+
- "*.yml"
|
22
|
+
- "*.json"
|
23
|
+
- Dockerfile
|
24
|
+
- db/**
|
25
|
+
- Rakefile
|
26
|
+
- bin/**
|
27
|
+
- log/**
|
28
|
+
- public/**
|
29
|
+
- tmp/**
|
30
|
+
- .gitignore
|
31
|
+
- "*.js"
|
32
|
+
- README.md
|
33
|
+
- config/*.yml
|
34
|
+
- vendor/**
|
35
|
+
|
36
|
+
functions:
|
37
|
+
helloWorld:
|
38
|
+
handler: serverless_hub.ServerlessHub::Handler.call
|
39
|
+
layers:
|
40
|
+
- ${self:custom.layerArn}
|
41
|
+
events:
|
42
|
+
- http:
|
43
|
+
path: hello
|
44
|
+
method: get
|
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"name": "hello_world",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "##",
|
5
|
+
"private": true,
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8
|
+
},
|
9
|
+
"repository": {
|
10
|
+
"type": "git",
|
11
|
+
"url": "git@gitlab.devhub.co:DevHubCo/hello_world.git"
|
12
|
+
},
|
13
|
+
"author": "",
|
14
|
+
"license": "ISC",
|
15
|
+
"devDependencies": {
|
16
|
+
"optimist": "^0.6.1",
|
17
|
+
"serverless-domain-manager": "^3.1.0",
|
18
|
+
"serverless-offline": "^4.10.0",
|
19
|
+
"serverless-plugin-warmup": "^4.4.3-rc.1",
|
20
|
+
"yaml-boost": "^1.9.17"
|
21
|
+
}
|
22
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
const path = require("path")
|
2
|
+
const optimist = require('optimist')
|
3
|
+
const yaml = require("yaml-boost")
|
4
|
+
|
5
|
+
const config = yaml.load(path.join(__dirname, "config/serverless.yml"), optimist.argv)
|
6
|
+
const stage = optimist.argv.stage ? optimist.argv.stage : "dev"
|
7
|
+
|
8
|
+
const layerName = config.service.charAt(0).toUpperCase() + config.service.slice(1) + stage.charAt(0).toUpperCase() + stage.slice(1)
|
9
|
+
const layerStackName = config.service + "-layer-" + stage
|
10
|
+
|
11
|
+
let targetConfig
|
12
|
+
|
13
|
+
if(optimist.argv["stack"] == "layer") {
|
14
|
+
let layers = {}
|
15
|
+
|
16
|
+
layers[layerName] = {
|
17
|
+
path: "layer",
|
18
|
+
description: "Ruby project layer",
|
19
|
+
compatibleRuntimes: ["ruby2.5"]
|
20
|
+
}
|
21
|
+
delete config.provider.environment
|
22
|
+
|
23
|
+
targetConfig = {
|
24
|
+
service: config.service + "-layer",
|
25
|
+
provider: config.provider,
|
26
|
+
layers: layers,
|
27
|
+
package: {
|
28
|
+
include: ["layer/**"]
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
} else {
|
33
|
+
let layerArn = `\${cf:${layerStackName}.` + `${layerName}LambdaLayerQualifiedArn}`.replace(/-/g, 'Dash')
|
34
|
+
|
35
|
+
if(config.custom) {
|
36
|
+
config.custom["layerArn"] = layerArn
|
37
|
+
} else {
|
38
|
+
config.custom = {
|
39
|
+
layerArn: layerArn
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
targetConfig = config
|
44
|
+
}
|
45
|
+
|
46
|
+
if(process.env.CI){
|
47
|
+
if(targetConfig.custom) {
|
48
|
+
delete targetConfig.custom.settings
|
49
|
+
}
|
50
|
+
} else {
|
51
|
+
targetConfig.provider["profile"] = "devhub-" + stage
|
52
|
+
}
|
53
|
+
|
54
|
+
module.exports = targetConfig
|
data/serverless_hub.gemspec
CHANGED
@@ -31,8 +31,9 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
32
32
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
33
33
|
end
|
34
|
-
spec.bindir = "
|
35
|
-
spec.executables = spec.files.grep(%r{^
|
34
|
+
spec.bindir = "bin"
|
35
|
+
# spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
36
|
+
spec.executables = ['serverless_hub']
|
36
37
|
spec.require_paths = ["lib"]
|
37
38
|
|
38
39
|
spec.add_development_dependency "bundler", "~> 2.0.2"
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serverless_hub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Will
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2019-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
@@ -117,7 +117,8 @@ dependencies:
|
|
117
117
|
description: Write a longer description or delete this line.
|
118
118
|
email:
|
119
119
|
- will@devhub.co
|
120
|
-
executables:
|
120
|
+
executables:
|
121
|
+
- serverless_hub
|
121
122
|
extensions: []
|
122
123
|
extra_rdoc_files: []
|
123
124
|
files:
|
@@ -131,10 +132,16 @@ files:
|
|
131
132
|
- README.md
|
132
133
|
- Rakefile
|
133
134
|
- bin/console
|
135
|
+
- bin/serverless_hub
|
134
136
|
- bin/setup
|
135
137
|
- lib/serverless_hub.rb
|
136
138
|
- lib/serverless_hub/authorizer.rb
|
137
139
|
- lib/serverless_hub/handler.rb
|
140
|
+
- lib/serverless_hub/templates/.gitignore
|
141
|
+
- lib/serverless_hub/templates/Dockerfile
|
142
|
+
- lib/serverless_hub/templates/config/serverless.yml
|
143
|
+
- lib/serverless_hub/templates/package.json
|
144
|
+
- lib/serverless_hub/templates/serverless.js
|
138
145
|
- lib/serverless_hub/version.rb
|
139
146
|
- serverless_hub.gemspec
|
140
147
|
homepage: https://goolge.com.au
|