Updated text with more detail

Built sample service over RediOps API
pull/1/head
meerkat 2022-09-11 23:16:45 +10:00
parent cc14c03928
commit 630851c3c1
30 changed files with 1485 additions and 1578 deletions

7
.gitignore vendored
View File

@ -13,3 +13,10 @@
# Dependency directories (remove the comment below to include it)
# vendor/
# Generated code from OpenAPI
examples/src/powershell/microservice/api/rediops-service-server.gen.go
examples/src/powershell/microservice/api/rediops-service-types.gen.go
examples/src/powershell/microservice/data/*
examples/src/powershell/microservice/config/devops.json

View File

@ -1,66 +1,83 @@
{
"unique_id": "d2429b4f-394b-498b-88ff-33ce28751188",
"version": "0.0.1",
"created_on": "2022-08-07T13:43:21Z",
"updated_on": "2022-08-07T13:43:21Z",
"organisation": "Meerkat Manor",
"name": "Web site",
"created_on": "2022-03-04T15:43:21Z",
"updated_on": "2022-03-04T15:43:21Z",
"organisation": "Meerkat Manor Tech College",
"name": "Microservce and web site",
"asset": {
"id": "AID07828923",
"name": "website",
"url": ""
},
"owner": {
"email": "meerkat@merebox.com",
"web": "https://www.merebox.com",
"matrix":"@devops:merebox.com"
"email": "devops@meerkatmanor-tech.org",
"web": "meerkatmanor-tech.org",
"slack": "",
"twitter": "",
"matrix": "@devops:meerkat-manor.org"
},
"guide": "https://github.com/meerkat-manor/rediOps/blob/main/guide/overview.md",
"repository": {
"guide": "https://github.com/meerkat-manor/rediOps",
"source-engine": "Git",
"source": "https://github.com/meerkat-manor/rediOps.git",
"artefact": ""
"guide": "https://github.com/meerkat-manor/rediOps/blob/main/guide/repository.md",
"artefact": {
"category": "ARTEFACT",
"name": "docker",
"url": ""
},
"source": {
"category": "SOURCE",
"name": "git",
"url": "https://github.com/meerkat-manor/rediOps"
}
},
"dependency": {
"guide": "https://github.com/meerkat-manor/rediOps/blob/main/guide/dependency.md",
"apis": [],
"tools": []
},
"build": {
"guide": "https://github.com/meerkat-manor/rediOps/blob/main/guide/build.md",
"engine": "JENKINS"
},
"test": {
"guide": "https://github.com/meerkat-manor/rediOps/blob/main/guide/test.md",
"engine": "UNITTEST"
},
"api" : [
{
"engine": "GIT",
"url": "/specification/rediops.json"
},
{
"engine": "GIT",
"url": "/specification/rediops.yaml"
},
{
"engine": "REST",
"url": "/api/v0/docs/rediops.json"
}
"apis": [
],
"health": {
"guide": "https://github.com/meerkat-manor/rediOps/blob/main/guide/health.md",
"api" :[
{"url": "/health", "status": 200, "response": ""}
"tools": [
]
},
"build": [
{
"guide": "https://github.com/meerkat-manor/rediOps/blob/main/guide/build.md",
"engine": {
"category": "UNINSTALL",
"name": "some text",
"url": "some text"
},
"config": "some text",
"script": "some text"
}
],
"test": [
{
"guide": "https://github.com/meerkat-manor/rediOps/blob/main/guide/test.md",
"engine": {
"category": "SOURCE",
"name": "some text",
"url": "some text"
},
"config": "some text",
"script": "some text"
}
],
"health": {
"guide": "https://github.com/meerkat-manor/rediOps/blob/main/guide/health.md",
"api": [
{
"url": "/health",
"status": 200,
"response": "OK"
}
]
},
"install": {
"guide": "https://github.com/meerkat-manor/rediOps/blob/main/guide/install.md",
"engine": "COMMAND",
"engine": {
"category": "COMMAND",
"name": "bash"
},
"playbook": "",
"commands": {
"pre": [
@ -70,27 +87,52 @@
]
}
},
"refresh": {
"guide": "https://github.com/meerkat-manor/rediOps/blob/main/guide/refresh.md",
"engine": "COMMAND",
"engine": {
"category": "COMMAND",
"name": "bash"
},
"playbook": "",
"commands": {
"pre": [],
"pre": [
],
"script": "/deploy/refresh.sh",
"post": []
"post": [
]
}
},
"uninstall": {
"guide": "https://github.com/meerkat-manor/rediOps/blob/main/guide/uninstall.md",
"engine": "ANSIBLE",
"engine": {
"category": "COMMAND",
"name": "bash"
},
"playbook": "",
"commands": {
"pre": [],
"pre": [
],
"script": "/deploy/decommission.sh",
"post": []
"post": [
]
}
},
"apis": [
{
"guide": "https://github.com/meerkat-manor/rediOps/blob/main/guide/api.md",
"engine": {
"category": "API",
"name": "openapi",
"url": "/specification/rediops.json"
}
},
{
"guide": "https://github.com/meerkat-manor/rediOps/blob/main/guide/api.md",
"engine": {
"category": "API",
"name": "openapi",
"url": "/specification/rediops.yaml"
}
}
]
}

View File

@ -1,13 +1,16 @@
# rediOps
Rediscover DevOps is about standardising how to find information about the code, specifically for use in the DevOps pipeline and
for engineers to locate relavant information about the code and its capability and DevOps process.
Rediscover DevOps (rediOps) is about standardising how to find information about the code, specifically
for use in the DevOps pipeline and for engineers to locate relavant information about the code and
its capability and DevOps process.
The information resides with the code in the code repository, commonly Git, and is human readable and also understood by tools.
The information resides with the code in the code repository, commonly Git, and is human readable
and also understood by tools.
RediOps takes the lead from the the **.well-known** folder approach used in web pages for source.
RediOps takes the lead from the the [**.well-known** folder](https://en.wikipedia.org/wiki/Well-known_URI)
approach used in web servers.
That is the creation of a folder named ".well-known" and to create a file by the name of
**"devops.json"** within the folder in source. This will allow tools to retrieve the file if it exists
**"devops.json"** within the folder. This will allow tools to retrieve the file if it exists
and to use the information for activities such as:
* build
@ -25,25 +28,33 @@ for other files or actions to perform.
## Specification
The specification for the **devops.json** is defined as an OpenAPI document allowing the publishing
of the information also as a REST service if so required - though this is not mandatory - and
the "devops.json" file is expected to exist before the code is deployed.
The specification for the **devops.json** is defined as an [OpenAPI document](specification/rediops.json).
The use of OpenAPI to define the details specification provides a format and protocol that can be understood
by tools and engineers. There a few aspects of the specifications that cannot be documented in OpenAPI.
by tools and engineers.
Using a OpenAPI specification provides clarity on definition. Tools can also generate a
REST service if so required - though this is not mandatory - and
the "devops.json" file is expected to exist before the code is deployed.
If you do publish the information as a REST service then you should consider protecting access to
the data, especially if it contains data that may expose internal structures.
**Note:** The specification does not capture credentials or runtime environment information.
## Audience
To read more see [overview](guide/overview.md) or
go to [tutorial](tutorial/readme.md) or
[examples](examples/readme.md)
If your organisation already has standrad automation tools and pipeline process, then you may not find the RediOps
and the specifications that useful.
## Audience
You may find the specification useful if:
1. You are a small developer with custom tools or simple requirements
2. Your organisation has many different tools for different repositories and you need to document which tool goes with what
1. You don't have a standard and make assumptions about meta data file names in your Git repository
2. You are a small developer with custom tools or simple requirements
3. Your organisation has many different tools for different repositories and you need to document which tool goes with what
If your organisation already has standard automation tools and pipeline process, then you may not find the rediOps
and the specifications that useful. If the specification is not relevant in its entirety, maybe you find the
concept or portions useful for adaptation in your organisation.

25
examples/readme.md 100644
View File

@ -0,0 +1,25 @@
# Examples
The examples provided are opinionated and may not be a fit for you.
The code is not optimised and is only intended to present
more concrete examples of various use cases.
## Refresh an executing docker image
Build a static web server and refresh the existing
executing static web server.
* Code is located at [deploy.ps1](src/powershell/static/deploy.ps1)
* Tutorial is located at [staticweb](../guide/tutorial/staticweb.md)
## Generate Go web service code
Using a OpenAPI specification for a service, this example
generates the server and type code. The example uses the **rediops.json** definition itself
to generate the server code.
* Code is located at [deploy.ps1](src/powershell/microsservice/deploy.ps1)
* Tutorial is located at [microservice](../guide/tutorial/microservice.md)

View File

@ -0,0 +1,214 @@
package api
import (
"net/http"
"sync"
"os"
"io/ioutil"
"log"
"encoding/json"
"github.com/labstack/echo/v4"
)
type Rediops struct {
Lock sync.Mutex
ConfigFilename string
DataFolder string
ConfigFolder string
}
func NewRediops(configFolder string, configFilename string, dataFolder string) *Rediops {
return &Rediops{
ConfigFolder: configFolder,
ConfigFilename: configFilename,
DataFolder: dataFolder,
}
}
// A common error payload returned
// when the response code is not 2xx
type ErrorModel struct {
// Error description, that shuld be less technical
// and more user orientated where possible
Message *string `json:"message,omitempty"`
Resolution *string `json:"resolution,omitempty"`
// Status code as a string
Status *string `json:"status,omitempty"`
// Numerical value of the status code
StatusCode *int `json:"statusCode,omitempty"`
// Technical information for the error.
//
// This must not contain sensitive information
Technical *string `json:"technical,omitempty"`
}
func sendGeneralError(ctx echo.Context, code int, message string) error {
var s = ""
genErr := ErrorModel{
Message: &message,
Status: &s,
StatusCode: &code,
}
err := ctx.JSON(code, genErr)
return err
}
func (ro *Rediops) GetHealth(ctx echo.Context) error {
ro.Lock.Lock()
defer ro.Lock.Unlock()
var item = HealthResponse {
Status: "OK",
Message: "Service available",
}
return ctx.JSON(http.StatusOK, item)
}
// Fetch the DevOps information
// (GET /.well-known/devops)
func (ro *Rediops) GetWellKnownDevopsJson(ctx echo.Context) error {
// Check if the corresponding file exists
fileName := ro.ConfigFolder + "/devops.json"
if _, err := os.Stat(fileName); err == nil {
var item = DevopsModel {}
content, err := ioutil.ReadFile(fileName)
if err != nil {
log.Fatal("Error when opening file: ", err)
return sendGeneralError(ctx, http.StatusInternalServerError ,
"Internal server error")
}
err = json.Unmarshal(content, &item)
if err != nil {
log.Fatal("Error during Unmarshal(): ", err)
return sendGeneralError(ctx, http.StatusInternalServerError ,
"Internal server error")
}
return ctx.JSON(http.StatusOK, item)
}
return sendGeneralError(ctx, http.StatusNotFound,
"devops.json not found")
}
// List matching captured resources
// (GET /devops/)
func (ro *Rediops) GetDevops(ctx echo.Context, params GetDevopsParams) error {
var ilist = []DevopsbriefModel {}
// Check if the corresponding folder exists
if _, err := os.Stat(ro.DataFolder); err == nil {
files, err := ioutil.ReadDir(ro.DataFolder)
if err != nil {
log.Fatal(err)
}
for _, file := range files {
if (!file.IsDir()) {
content, err := ioutil.ReadFile(ro.DataFolder + "/"+ file.Name())
if err != nil {
log.Printf("Error when opening file: %s", err)
return sendGeneralError(ctx, http.StatusInternalServerError ,
"Internal server error")
}
var item = DevopsModel {}
err = json.Unmarshal(content, &item)
if err != nil {
log.Printf("Error during Unmarshal(): %s", err)
return sendGeneralError(ctx, http.StatusInternalServerError ,
"Internal server error")
}
var brief = DevopsbriefModel {
Name: item.Name,
Version: item.Version,
}
brief.UniqueId = *item.UniqueId
brief.Guide = *item.Guide
brief.Self = "/devops/"+brief.UniqueId
ilist = append(ilist, brief)
}
}
return ctx.JSON(http.StatusOK, ilist)
}
return sendGeneralError(ctx, http.StatusNotFound,
"Not found")
}
// (DELETE /devops/{id})
func (ro *Rediops) DeleteDevopsId(ctx echo.Context, id string) error {
return sendGeneralError(ctx, http.StatusNotFound,
"Not supported")
}
// Fetch the Devops resource
// (GET /devops/{id})
func (ro *Rediops) GetDevopsId(ctx echo.Context, id string) error {
// Check if the corresponding file exists
fileName := ro.DataFolder + "/"+ id + ".json"
if _, err := os.Stat(fileName); err == nil {
var item = DevopsModel {}
content, err := ioutil.ReadFile(fileName)
if err != nil {
log.Printf("Error when opening file: %s", err)
return sendGeneralError(ctx, http.StatusInternalServerError ,
"Internal server error")
}
err = json.Unmarshal(content, &item)
if err != nil {
log.Printf("Error during Unmarshal(): %s", err)
return sendGeneralError(ctx, http.StatusInternalServerError ,
"Internal server error")
}
return ctx.JSON(http.StatusOK, item)
}
return sendGeneralError(ctx, http.StatusNotFound,
(id + " not found"))
}
// Update the DevOps resource
// (POST /devops/{id})
func (ro *Rediops) PostDevopsId(ctx echo.Context, id string) error {
return sendGeneralError(ctx, http.StatusNotFound,
"Not supported")
}

View File

@ -0,0 +1 @@
package: rediops

View File

@ -0,0 +1,5 @@
package: api
generate:
echo-server: true
embedded-spec: true
output: api/rediops-service-server.gen.go

View File

@ -0,0 +1,4 @@
package: api
generate:
models: true
output: api/rediops-service-types.gen.go

View File

@ -0,0 +1,31 @@
module merebox.com/rediops
go 1.18
require (
github.com/deepmap/oapi-codegen v1.11.0
github.com/getkin/kin-openapi v0.94.0
github.com/labstack/echo/v4 v4.9.0
)
require (
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/swag v0.21.1 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/labstack/gommon v0.3.1 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.1 // indirect
golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9 // indirect
golang.org/x/net v0.0.0-20220513224357-95641704303c // indirect
golang.org/x/sys v0.0.0-20220513210249-45d2b4557a2a // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220411224347-583f2d630306 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

View File

@ -0,0 +1,179 @@
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0-20210816181553-5444fa50b93d/go.mod h1:tmAIfUFEirG/Y8jhZ9M+h36obRZAk/1fcSpXwAVlfqE=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
github.com/deepmap/oapi-codegen v1.11.0 h1:f/X2NdIkaBKsSdpeuwLnY/vDI0AtPUrmB5LMgc7YD+A=
github.com/deepmap/oapi-codegen v1.11.0/go.mod h1:k+ujhoQGxmQYBZBbxhOZNZf4j08qv5mC+OH+fFTnKxM=
github.com/getkin/kin-openapi v0.94.0 h1:bAxg2vxgnHHHoeefVdmGbR+oxtJlcv5HsJJa3qmAHuo=
github.com/getkin/kin-openapi v0.94.0/go.mod h1:LWZfzOd7PRy8GJ1dJ6mCU6tNdSfOwRac1BUPam4aw6Q=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U=
github.com/go-chi/chi/v5 v5.0.7/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.21.1 h1:wm0rhTb5z7qpJRHBdPOMuY4QjVUMbF6/kwoYeRAOrKU=
github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
github.com/go-playground/validator/v10 v10.11.0/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU=
github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/labstack/echo/v4 v4.7.2/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20Ltm0OvSks=
github.com/labstack/echo/v4 v4.9.0 h1:wPOF1CE6gvt/kmbMR4dGzWvHMPT+sAEUJOwOTtvITVY=
github.com/labstack/echo/v4 v4.9.0/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20Ltm0OvSks=
github.com/labstack/gommon v0.3.1 h1:OomWaJXm7xR6L1HmEtGyQf26TEn7V6X88mktX9kee9o=
github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
github.com/lestrrat-go/backoff/v2 v2.0.8/go.mod h1:rHP/q/r9aT27n24JQLa7JhSQZCKBBOiM/uP402WwN8Y=
github.com/lestrrat-go/blackmagic v1.0.0/go.mod h1:TNgH//0vYSs8VXDCfkZLgIrVTTXQELZffUV0tz3MtdQ=
github.com/lestrrat-go/blackmagic v1.0.1/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU=
github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E=
github.com/lestrrat-go/iter v1.0.1/go.mod h1:zIdgO1mRKhn8l9vrZJZz9TUMMFbQbLeTsbqPDrJ/OJc=
github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4=
github.com/lestrrat-go/jwx v1.2.24/go.mod h1:zoNuZymNl5lgdcu6P7K6ie2QRll5HVfF4xwxBBK1NxY=
github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/matryer/moq v0.2.7/go.mod h1:kITsx543GOENm48TUAQyJ9+SAvFSr7iGQXPoth/VUBk=
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9 h1:NUzdAbFtCJSXU20AOXgeqaUwg8Ypg4MPYmL+d+rsB5c=
golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220513224357-95641704303c h1:nF9mHSvoKBLkQNQhJZNsc66z2UzAMUbLGjC95CF3pU0=
golang.org/x/net v0.0.0-20220513224357-95641704303c/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220513210249-45d2b4557a2a h1:N2T1jUrTQE9Re6TFF5PhvEHXHCguynGhKjWVsIUt5cY=
golang.org/x/sys v0.0.0-20220513210249-45d2b4557a2a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20220411224347-583f2d630306 h1:+gHMid33q6pen7kv9xvT+JRinntgeXO2AeZVd0AWD3w=
golang.org/x/time v0.0.0-20220411224347-583f2d630306/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -0,0 +1,68 @@
package main
import (
"flag"
"fmt"
"os"
"strings"
"github.com/deepmap/oapi-codegen/pkg/middleware"
"github.com/labstack/echo/v4"
echomiddleware "github.com/labstack/echo/v4/middleware"
"merebox.com/rediops/api"
)
func main() {
var port = flag.Int("port", 8075, "Port for HTTP server micro service")
var dataFolder = flag.String("data", "./data", "Data folder")
var staticFolder = flag.String("static", "./static", "Static folder")
var configFolder = flag.String("configuration", "./config", "Configuration folder")
flag.Parse()
swagger, err := api.GetSwagger()
if err != nil {
fmt.Fprintf(os.Stderr, "Error loading swagger spec\n: %s", err)
os.Exit(1)
}
// Clear out the servers array in the swagger spec, that skips validating
// that server names match. We don't know how this thing will be run.
swagger.Servers = nil
// Create an instance of our handler which satisfies the generated interface
configFilename := *configFolder + "/rediops.yaml"
var ro = api.NewRediops(*configFolder, configFilename, *dataFolder)
e := echo.New()
// Log all requests
e.Use(echomiddleware.Logger())
// Use our validation middleware to check all requests against the
// OpenAPI schema.
var options middleware.Options
// Skip static assets such as HTML, Images, CSS, etc
options.Skipper = func(c echo.Context) bool {
if (strings.HasSuffix(c.Request().URL.Path, ".html") || strings.HasSuffix(c.Request().URL.Path, ".json")) {
return true
}
if (strings.HasSuffix(c.Request().URL.Path, ".ico")) {
return true
}
if (c.Request().URL.Path =="/") {
return true
}
if strings.HasPrefix(c.Request().URL.Path, "/assets/") {
return true
}
return false
}
e.Use(middleware.OapiRequestValidatorWithOptions(swagger, &options))
api.RegisterHandlers(e, ro)
e.Static("/", *staticFolder)
// And we serve HTTP until the world ends.
e.Logger.Fatal(e.Start(fmt.Sprintf("0.0.0.0:%d", *port)))
}

View File

@ -0,0 +1,54 @@
param (
[string] $baseFolder,
[string] $specFile
)
if (!(Test-Path $baseFolder)) {
Write-Host "The base folder '$baseFolder' not found" -ForegroundColor Red
return
}
$wellFile = $baseFolder + "/.well-known/devops.json"
$devops = Get-Content $wellFile | ConvertFrom-JSON
if ($specFile -eq "") {
$devops.apis | ForEach-Object {
if ($_.engine.url.endswith(".json") -and ($_.engine.category -eq "API") -and ($_.engine.name -eq "openapi")) {
$specFile = $baseFolder + $_.engine.url
}
}
}
if (!(Test-Path $specFile -PathType Leaf)) {
Write-Host "The specification file '$specFile' not found" -ForegroundColor Red
return
}
Write-Host "Using specification file '$specFile' " -ForegroundColor White
$opapiCodeGen = $env:USERPROFILE + "/go/pkg/mod/github.com/deepmap/oapi-codegen@v1.11.0/cmd/oapi-codegen/oapi-codegen.go"
if (!(Test-Path $opapiCodeGen -PathType Leaf)) {
Write-Host "The codse generator '$opapiCodeGen' not found" -ForegroundColor Red
return
}
Write-Host "Commencing code generation" -ForegroundColor White
go env -w GOOS=windows
go env -w GOARCH=386
go get gopkg.in/yaml.v2
go get github.com/deepmap/oapi-codegen/pkg/codegen
go get github.com/deepmap/oapi-codegen/pkg/util
go get github.com/deepmap/oapi-codegen/pkg/types@v1.11.0
$configFile = "./config/types.cfg.yaml"
go run $opapiCodeGen --config $configFile $specFile
$configFile = "./config/server.cfg.yaml"
go run $opapiCodeGen --config $configFile $specFile
go mod tidy
$buildCode = "./rediops.go"
go build $buildCode
Write-Host "Code generation completed" -ForegroundColor Green

View File

@ -0,0 +1,2 @@

27
guide/api.md 100644
View File

@ -0,0 +1,27 @@
# API
The **api** section of the **devops.json** is used to locate the API
specification for the component. The specification is commonly in
OpenAPI format.
The information can be used to:
* Review the capabilities expose bu the service
* Call the service if included in the specification
* Generate code, eithers server based or client code
Multiple versions can be published and it is up to the consumer
to determine which version to use. For example both
a YAML and JSON versions of the OpenApi specification can be published.
Like all sections, there is guide reference which can give further information
on how the section can be used.
## Engine
The engine identifies the accessor for the API.
The two accessors to consider are:
* GIT : this is the git location of the file within the repository
* REST : A REST / Web based access to the API specification

View File

@ -1 +1,9 @@
# Build
The **build** section of the **devops.json** is used to build the component.
The build action can be
Like all sections, there is guide reference which can give further information
on how the section can be used.

View File

@ -1,6 +1,6 @@
# Dependency
The dependency section is for defining any downstream APIs. An API can be:
The **dependency** section of the **devops.json** is for defining any downstream APIs. An API can be:
* ODBC or JDBC connection
* REST
@ -13,6 +13,9 @@ For each dependency you can define the:
2. Protocol: The protocol that connects to the downstream component
3. URL: The resource location. This has different meanings for each protocol
Like all sections, there is guide reference which can give further information
on how the section can be used.
## OBC or JDBC
The URL is the connection string, minus user and password information. With credentials

2
guide/docker.md 100644
View File

@ -0,0 +1,2 @@
# Docker and Containers

View File

@ -1,7 +1,10 @@
# Health
The health section is to enable the discovery of any health services published by
The **health** section of the **devops.json** is to enable the discovery of any health services published by
the component. This specifies the name(s) of the health service
**Note:** A health service should also be described in the OpenAPI document, which will
provide more details.
Like all sections, there is guide reference which can give further information
on how the section can be used.

View File

@ -1,6 +1,6 @@
# Install
The install section is to enable the discovery of the functions
The **install** section of the **devops.json** is to enable the discovery of the functions
to use when a install of the component is required.
The definition does not include details about the server or infrastructure
@ -11,6 +11,9 @@ The same instructions for installation can be used for both non-production
and production installation if the environment attributes are
soft coded.
Like all sections, there is guide reference which can give further information
on how the section can be used.
## Engine
The engine identifies the processor for the refresh.

View File

@ -1,2 +1,52 @@
# Overview
The objective is to produce a specification that can be stored with the source code and can be used
to locate files used by the DevOps process.
## Background
Existing DevOps tools make assumptions or are configured as webhooks, which are outside of the
source code. By capturing the assumptions with the code, there is less risk of errors or
missed processes.
## Design
The approach with the specification is to create a file in a specified format in
**.well-known/devops.json** location within your source. The format has placeholders for various
activities of DevOps.
The specification does not mandate the tools to use but provides a location
in the json where configuration files and other files are located in
the source folder structure.
This allows the source code to be portable and the resource
to be rebuilt using the same tools and process.
## Automation
### Using the DevOps.json file
Depending on your tools, there are various ways to get the benefits
provided by the DevOps.json file.
The simplest case is if you have a simple setup and don't require
complex tool, is to define a simple bash script file in source
and name that source file as the install or refresh script.
This bash script's location is then saved to devops.json
See [Tutorials](tutorial/readme.md) for some ideas.
## Generating the DevOps.json file
If you want consistency you can generate the devops.json file
from a template and prefill the data based on your organisations
preferred DevOps tools.
If you tools change or you import projects from other organisations
or Open Source then the values can be changed per project without
impacting existing projects.

View File

@ -1,8 +1,11 @@
# Refresh
The refresh section is to enable the discovery of the functions
The **refresh** section of the **devops.json** is to enable the discovery of the functions
to use when a refresh of the component is required.
Like all sections, there is guide reference which can give further information
on how the section can be used.
## Engine
The engine identifies the processor for the refresh.

View File

View File

@ -1,6 +1,9 @@
# Test
Like all sections, there is guide reference which can give further information
on how the section can be used.
## Regression

View File

@ -0,0 +1,2 @@
# CoreDNS project

View File

@ -0,0 +1,6 @@
# Microservice project
This is a tutorial demonstrating the build and deploying a Microservice.

View File

@ -0,0 +1,12 @@
# Tutorials
This directory contains various tutorials demonstrating use
cases for the **.well-known/devsops.json**
* [CoreDNS](coredns.md) - deploying and refreshing a DNS instance
* [Static web site](staticweb.md) - deploying or refreshing a static web site
built using Go and Docker
* [Microservice](microservice.md) - deploying or refreshing a micro service
built using Go and Docker

View File

@ -0,0 +1,9 @@
# Docker project
This is a tutorial demonstrating the build and deploying a Docker image.
There are many commercial and open source tools that provide a similar capability
and this is not intended to replace those tools if yo have them already
in everyday use.

View File

@ -1,12 +1,15 @@
# Uninstall
The uninstall section is to enable the discovery of the functions
The **uninstall** section of the **devops.json** is to enable the discovery of the functions
to use when a decommisison of the component is required.
The definition does not include details about the server or infrastructure
as these can vary. This is definition works similar to the Ansible
inventory and playbooks.
Like all sections, there is guide reference which can give further information
on how the section can be used.
## Engine
The engine identifies the processor for the refresh.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff