From 56321c3f0746a1735985746499a07c9b5dcaab76 Mon Sep 17 00:00:00 2001
From: Clivern
Date: Sun, 17 Jan 2021 20:11:35 +0100
Subject: [PATCH] init
---
.goreleaser.yml | 2 +-
Dockerfile | 8 +--
Makefile | 4 +-
README.md | 88 +++++++++++++++---------------
bin/release.sh | 4 +-
cmd/root.go | 4 +-
cmd/server.go | 10 ++--
cmd/version.go | 2 +-
config.dist.yml | 36 ++++++------
config.prod.yml | 53 +++++++++++++-----
core/component/README.md | 2 +-
core/controller/auth.go | 2 +-
core/controller/context.go | 6 +-
core/controller/home.go | 2 +-
core/middleware/correlation.go | 2 +-
core/module/auth_method.go | 4 +-
core/module/database.go | 4 +-
core/module/key_based_auth_data.go | 4 +-
core/util/helpers_test.go | 2 +-
deployment/docker/.gitkeep | 0
deployment/k8s/.gitkeep | 0
deployment/linux/install.sh | 26 ++++-----
deployment/linux/upgrade.sh | 16 +++---
walnut.go => drifter.go | 2 +-
go.mod | 2 +-
25 files changed, 154 insertions(+), 131 deletions(-)
create mode 100644 deployment/docker/.gitkeep
create mode 100644 deployment/k8s/.gitkeep
rename walnut.go => drifter.go (91%)
diff --git a/.goreleaser.yml b/.goreleaser.yml
index ba13340..13549fd 100644
--- a/.goreleaser.yml
+++ b/.goreleaser.yml
@@ -37,4 +37,4 @@ checksum:
name_template: checksums.txt
snapshot:
name_template: "{{ .Tag }}-next"
-project_name: walnut
+project_name: drifter
diff --git a/Dockerfile b/Dockerfile
index 19c23c3..2f9b412 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,6 @@
FROM golang:1.16.6
-ARG WALNUT_VERSION=0.1.0
+ARG DRIFTER_VERSION=0.1.0
ENV GO111MODULE=on
@@ -11,7 +11,7 @@ RUN apt-get update
WORKDIR /app
-RUN curl -sL https://github.com/Clivern/Walnut/releases/download/v${WALNUT_VERSION}/walrus_${WALNUT_VERSION}_Linux_x86_64.tar.gz | tar xz
+RUN curl -sL https://github.com/Clivern/Drifter/releases/download/v${DRIFTER_VERSION}/walrus_${DRIFTER_VERSION}_Linux_x86_64.tar.gz | tar xz
RUN rm LICENSE
RUN rm README.md
@@ -22,6 +22,6 @@ EXPOSE 8000
VOLUME /app/configs
VOLUME /app/var
-RUN ./walnut version
+RUN ./drifter version
-CMD ["./walnut", "server", "-c", "/app/configs/config.dist.yml"]
\ No newline at end of file
+CMD ["./drifter", "server", "-c", "/app/configs/config.dist.yml"]
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 8429af3..4465f9d 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ pkgs = ./...
help: Makefile
@echo
- @echo " Choose a command run in Walnut:"
+ @echo " Choose a command run in Drifter:"
@echo
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo
@@ -121,7 +121,7 @@ package:
.PHONY: run
run:
@echo ">> ============= Run API Server ============= <<"
- $(GO) run walnut.go server -c config.dist.yml
+ $(GO) run drifter.go server -c config.dist.yml
## ci: Run all CI tests.
diff --git a/README.md b/README.md
index a1668af..4a8369f 100644
--- a/README.md
+++ b/README.md
@@ -1,31 +1,31 @@
-
Walnut
+ Drifter
A Lightweight Cloud Native API Gateway.
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
-
+
-Walnut is Cloud Native API Gateway that control who accesses your API whether from customer or other internal services. It also collect metrics about service calls count, latency, success rate and much more. here is some of the key features:
+Drifter is Cloud Native API Gateway that control who accesses your API whether from customer or other internal services. It also collect metrics about service calls count, latency, success rate and much more. here is some of the key features:
- Manage service to service Authentication and Authorization.
- Manage user to service Authentication and Authorization.
@@ -44,12 +44,12 @@ Walnut is Cloud Native API Gateway that control who accesses your API whether fr
#### Linux Deployment
-Download [the latest walnut binary](https://github.com/Clivern/Walnut/releases). Make it executable from everywhere.
+Download [the latest drifter binary](https://github.com/Clivern/Drifter/releases). Make it executable from everywhere.
```zsh
-$ export WALNUT_LATEST_VERSION=$(curl --silent "https://api.github.com/repos/Clivern/Walnut/releases/latest" | jq '.tag_name' | sed -E 's/.*"([^"]+)".*/\1/' | tr -d v)
+$ export DRIFTER_LATEST_VERSION=$(curl --silent "https://api.github.com/repos/Clivern/Drifter/releases/latest" | jq '.tag_name' | sed -E 's/.*"([^"]+)".*/\1/' | tr -d v)
-$ curl -sL https://github.com/Clivern/Walnut/releases/download/v{$WALNUT_LATEST_VERSION}/walnut_{$WALNUT_LATEST_VERSION}_Linux_x86_64.tar.gz | tar xz
+$ curl -sL https://github.com/Clivern/Drifter/releases/download/v{$DRIFTER_LATEST_VERSION}/drifter_{$DRIFTER_LATEST_VERSION}_Linux_x86_64.tar.gz | tar xz
```
Then install `etcd` cluster or a single node! please [refer to etcd docs](https://etcd.io/docs/v3.5/) or bin directory inside this repository.
@@ -60,88 +60,88 @@ Create the configs file `config.yml` from `config.dist.yml`. Something like the
# App configs
app:
# App name
- name: ${WALNUT_APP_NAME:-walnut}
+ name: ${DRIFTER_APP_NAME:-drifter}
# Env mode (dev or prod)
- mode: ${WALNUT_APP_MODE:-dev}
+ mode: ${DRIFTER_APP_MODE:-dev}
# HTTP port
- port: ${WALNUT_API_PORT:-8000}
+ port: ${DRIFTER_API_PORT:-8000}
# Hostname
- hostname: ${WALNUT_API_HOSTNAME:-127.0.0.1}
+ hostname: ${DRIFTER_API_HOSTNAME:-127.0.0.1}
# TLS configs
tls:
- status: ${WALNUT_API_TLS_STATUS:-off}
- pemPath: ${WALNUT_API_TLS_PEMPATH:-cert/server.pem}
- keyPath: ${WALNUT_API_TLS_KEYPATH:-cert/server.key}
+ status: ${DRIFTER_API_TLS_STATUS:-off}
+ pemPath: ${DRIFTER_API_TLS_PEMPATH:-cert/server.pem}
+ keyPath: ${DRIFTER_API_TLS_KEYPATH:-cert/server.key}
# API Configs
api:
- key: ${WALNUT_API_KEY:-6c68b836-6f8e-465e-b59f-89c1db53afca}
+ key: ${DRIFTER_API_KEY:-6c68b836-6f8e-465e-b59f-89c1db53afca}
# Async Workers
workers:
# Queue max capacity
- buffer: ${WALNUT_WORKERS_CHAN_CAPACITY:-5000}
+ buffer: ${DRIFTER_WORKERS_CHAN_CAPACITY:-5000}
# Number of concurrent workers
- count: ${WALNUT_WORKERS_COUNT:-4}
+ count: ${DRIFTER_WORKERS_COUNT:-4}
- # Runtime, Requests/Response and Walnut Metrics
+ # Runtime, Requests/Response and Drifter Metrics
metrics:
prometheus:
# Route for the metrics endpoint
- endpoint: ${WALNUT_METRICS_PROM_ENDPOINT:-/metrics}
+ endpoint: ${DRIFTER_METRICS_PROM_ENDPOINT:-/metrics}
# Components Configs
component:
# Tracing Component
tracing:
# Status on or off
- status: ${WALNUT_TRACING_STATUS:-on}
+ status: ${DRIFTER_TRACING_STATUS:-on}
# Tracing driver, jaeger supported so far
- driver: ${WALNUT_TRACING_DRIVER:-jaeger}
+ driver: ${DRIFTER_TRACING_DRIVER:-jaeger}
# Tracing backend URL
- collectorEndpoint: ${WALNUT_TRACING_ENDPOINT:-http://jaeger.local:14268/api/traces}
+ collectorEndpoint: ${DRIFTER_TRACING_ENDPOINT:-http://jaeger.local:14268/api/traces}
# Batch Size
- queueSize: ${WALNUT_TRACING_QUEUE_SIZE:-20}
+ queueSize: ${DRIFTER_TRACING_QUEUE_SIZE:-20}
# Profiler Component
profiler:
# Profiler Status
- status: ${WALNUT_PROFILER_STATUS:-on}
+ status: ${DRIFTER_PROFILER_STATUS:-on}
# Profiler Driver
- driver: ${WALNUT_PROFILER_DRIVER:-log}
+ driver: ${DRIFTER_PROFILER_DRIVER:-log}
# Log configs
log:
# Log level, it can be debug, info, warn, error, panic, fatal
- level: ${WALNUT_LOG_LEVEL:-info}
- # Output can be stdout or abs path to log file /var/logs/walnut.log
- output: ${WALNUT_LOG_OUTPUT:-stdout}
+ level: ${DRIFTER_LOG_LEVEL:-info}
+ # Output can be stdout or abs path to log file /var/logs/drifter.log
+ output: ${DRIFTER_LOG_OUTPUT:-stdout}
# Format can be json
- format: ${WALNUT_LOG_FORMAT:-json}
+ format: ${DRIFTER_LOG_FORMAT:-json}
```
-The run the `walnut` with `systemd`
+The run the `drifter` with `systemd`
```zsh
-$ walnut server -c /path/to/config.yml
+$ drifter server -c /path/to/config.yml
```
## Versioning
-For transparency into our release cycle and in striving to maintain backward compatibility, Walnut is maintained under the [Semantic Versioning guidelines](https://semver.org/) and release process is predictable and business-friendly.
+For transparency into our release cycle and in striving to maintain backward compatibility, Drifter is maintained under the [Semantic Versioning guidelines](https://semver.org/) and release process is predictable and business-friendly.
-See the [Releases section of our GitHub project](https://github.com/clivern/walnut/releases) for changelogs for each release version of Walnut. It contains summaries of the most noteworthy changes made in each release.
+See the [Releases section of our GitHub project](https://github.com/clivern/drifter/releases) for changelogs for each release version of Drifter. It contains summaries of the most noteworthy changes made in each release.
## Bug tracker
-If you have any suggestions, bug reports, or annoyances please report them to our issue tracker at https://github.com/clivern/walnut/issues
+If you have any suggestions, bug reports, or annoyances please report them to our issue tracker at https://github.com/clivern/drifter/issues
## Security Issues
-If you discover a security vulnerability within Walnut, please send an email to [hello@clivern.com](mailto:hello@clivern.com)
+If you discover a security vulnerability within Drifter, please send an email to [hello@clivern.com](mailto:hello@clivern.com)
## Contributing
@@ -153,4 +153,4 @@ We are an open source, community-driven project so please feel free to join us.
© 2021, Clivern. Released under [MIT License](https://opensource.org/licenses/mit-license.php).
-**Walnut** is authored and maintained by [@clivern](http://github.com/clivern).
+**Drifter** is authored and maintained by [@clivern](http://github.com/clivern).
diff --git a/bin/release.sh b/bin/release.sh
index 85b4242..0f62dbc 100755
--- a/bin/release.sh
+++ b/bin/release.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# Fetch latest version
-export LATEST_VERSION=$(curl --silent "https://api.github.com/repos/clivern/walnut/releases/latest" | jq '.tag_name' | sed -E 's/.*"([^"]+)".*/\1/')
+export LATEST_VERSION=$(curl --silent "https://api.github.com/repos/clivern/drifter/releases/latest" | jq '.tag_name' | sed -E 's/.*"([^"]+)".*/\1/')
# Update go checksum database (sum.golang.org) immediately after release
-curl --silent https://sum.golang.org/lookup/github.com/clivern/walnut@{$LATEST_VERSION}
+curl --silent https://sum.golang.org/lookup/github.com/clivern/drifter@{$LATEST_VERSION}
diff --git a/cmd/root.go b/cmd/root.go
index ca8e0ee..85c76e0 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -14,11 +14,11 @@ import (
var config string
var rootCmd = &cobra.Command{
- Use: "walnut",
+ Use: "drifter",
Short: `🐺 A Lightweight Cloud Native API Gateway
If you have any suggestions, bug reports, or annoyances please report
-them to our issue tracker at `,
+them to our issue tracker at `,
}
// Execute runs cmd tool
diff --git a/cmd/server.go b/cmd/server.go
index d370bb9..97d5d69 100644
--- a/cmd/server.go
+++ b/cmd/server.go
@@ -16,9 +16,9 @@ import (
"strings"
"time"
- "github.com/clivern/walnut/core/component"
- "github.com/clivern/walnut/core/controller"
- "github.com/clivern/walnut/core/module"
+ "github.com/clivern/drifter/core/component"
+ "github.com/clivern/drifter/core/controller"
+ "github.com/clivern/drifter/core/module"
"github.com/drone/envsubst"
"github.com/labstack/echo-contrib/prometheus"
@@ -31,7 +31,7 @@ import (
var serverCmd = &cobra.Command{
Use: "server",
- Short: "Start walnut server",
+ Short: "Start drifter server",
Run: func(cmd *cobra.Command, args []string) {
configUnparsed, err := ioutil.ReadFile(config)
@@ -145,7 +145,7 @@ var serverCmd = &cobra.Command{
e.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
- cc := &controller.WalnutContext{Context: c}
+ cc := &controller.DrifterContext{Context: c}
return next(cc)
}
})
diff --git a/cmd/version.go b/cmd/version.go
index d178117..57c6000 100644
--- a/cmd/version.go
+++ b/cmd/version.go
@@ -27,7 +27,7 @@ var versionCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(
fmt.Sprintf(
- `Current Walnut Version %v Commit %v, Built @%v By %v.`,
+ `Current Drifter Version %v Commit %v, Built @%v By %v.`,
Version,
Commit,
Date,
diff --git a/config.dist.yml b/config.dist.yml
index b1ad7a1..69ad63e 100644
--- a/config.dist.yml
+++ b/config.dist.yml
@@ -1,31 +1,31 @@
# App configs
app:
# App name
- name: ${WALNUT_APP_NAME:-walnut}
+ name: ${DRIFTER_APP_NAME:-drifter}
# Env mode (dev or prod)
- mode: ${WALNUT_APP_MODE:-dev}
+ mode: ${DRIFTER_APP_MODE:-dev}
# HTTP port
- port: ${WALNUT_API_PORT:-8000}
+ port: ${DRIFTER_API_PORT:-8000}
# Hostname
- hostname: ${WALNUT_API_HOSTNAME:-127.0.0.1}
+ hostname: ${DRIFTER_API_HOSTNAME:-127.0.0.1}
# TLS configs
tls:
- status: ${WALNUT_API_TLS_STATUS:-off}
- crt_path: ${WALNUT_API_TLS_PEMPATH:-cert/server.crt}
- key_path: ${WALNUT_API_TLS_KEYPATH:-cert/server.key}
+ status: ${DRIFTER_API_TLS_STATUS:-off}
+ crt_path: ${DRIFTER_API_TLS_PEMPATH:-cert/server.crt}
+ key_path: ${DRIFTER_API_TLS_KEYPATH:-cert/server.key}
# Global timeout
- timeout: ${WALNUT_API_TIMEOUT:-50}
+ timeout: ${DRIFTER_API_TIMEOUT:-50}
# API Configs
api:
- key: ${WALNUT_API_KEY:-6c68b836-6f8e-465e-b59f-89c1db53afca}
+ key: ${DRIFTER_API_KEY:-6c68b836-6f8e-465e-b59f-89c1db53afca}
- # Runtime, Requests/Response and Walnut Metrics
+ # Runtime, Requests/Response and Drifter Metrics
metrics:
prometheus:
# Route for the metrics endpoint
- endpoint: ${WALNUT_METRICS_PROM_ENDPOINT:-/_metrics}
+ endpoint: ${DRIFTER_METRICS_PROM_ENDPOINT:-/_metrics}
# Application Database
database:
@@ -36,7 +36,7 @@ app:
# Database Port
port: ${BEETLE_DATABASE_MYSQL_PORT:-3306}
# Database Name
- name: ${BEETLE_DATABASE_MYSQL_DATABASE:-walnut.db}
+ name: ${BEETLE_DATABASE_MYSQL_DATABASE:-drifter.db}
# Database Username
username: ${BEETLE_DATABASE_MYSQL_USERNAME:-root}
# Database Password
@@ -47,7 +47,7 @@ app:
- name: orders
active: true
proxy:
- listen_path: "/orders/v2/*path"
+ listen_path: "/orders/v2/*"
upstreams:
balancing: roundrobin
targets:
@@ -58,7 +58,7 @@ app:
status: off
methods:
-
- uuid: 6c68b836-6f8e-465e-b59f-89c1db53afca
+ id: 1
rate_limit:
status: off
@@ -68,8 +68,8 @@ app:
# Log configs
log:
# Log level, it can be debug, info, warn, error, panic, fatal
- level: ${WALNUT_LOG_LEVEL:-info}
- # Output can be stdout or abs path to log file /var/logs/walnut.log
- output: ${WALNUT_LOG_OUTPUT:-stdout}
+ level: ${DRIFTER_LOG_LEVEL:-info}
+ # Output can be stdout or abs path to log file /var/logs/drifter.log
+ output: ${DRIFTER_LOG_OUTPUT:-stdout}
# Format can be json
- format: ${WALNUT_LOG_FORMAT:-json}
+ format: ${DRIFTER_LOG_FORMAT:-json}
diff --git a/config.prod.yml b/config.prod.yml
index 3f14124..7daf00c 100644
--- a/config.prod.yml
+++ b/config.prod.yml
@@ -1,28 +1,28 @@
# App configs
app:
# App name
- name: ${WALNUT_APP_NAME:-walnut}
+ name: ${DRIFTER_APP_NAME:-drifter}
# Env mode (dev or prod)
- mode: ${WALNUT_APP_MODE:-prod}
+ mode: ${DRIFTER_APP_MODE:-prod}
# HTTP port
- port: ${WALNUT_API_PORT:-80}
+ port: ${DRIFTER_API_PORT:-80}
# Hostname
- hostname: ${WALNUT_API_HOSTNAME:-127.0.0.1}
+ hostname: ${DRIFTER_API_HOSTNAME:-127.0.0.1}
# TLS configs
tls:
- status: ${WALNUT_API_TLS_STATUS:-off}
- crt_path: ${WALNUT_API_TLS_PEMPATH:-cert/server.crt}
- key_path: ${WALNUT_API_TLS_KEYPATH:-cert/server.key}
+ status: ${DRIFTER_API_TLS_STATUS:-off}
+ crt_path: ${DRIFTER_API_TLS_PEMPATH:-cert/server.crt}
+ key_path: ${DRIFTER_API_TLS_KEYPATH:-cert/server.key}
# API Configs
api:
- key: ${WALNUT_API_KEY:-6c68b836-6f8e-465e-b59f-89c1db53afca}
+ key: ${DRIFTER_API_KEY:-6c68b836-6f8e-465e-b59f-89c1db53afca}
- # Runtime, Requests/Response and Walnut Metrics
+ # Runtime, Requests/Response and Drifter Metrics
metrics:
prometheus:
# Route for the metrics endpoint
- endpoint: ${WALNUT_METRICS_PROM_ENDPOINT:-/_metrics}
+ endpoint: ${DRIFTER_METRICS_PROM_ENDPOINT:-/_metrics}
# Application Database
database:
@@ -33,17 +33,40 @@ app:
# Database Port
port: ${BEETLE_DATABASE_MYSQL_PORT:-3306}
# Database Name
- name: ${BEETLE_DATABASE_MYSQL_DATABASE:-walnut.db}
+ name: ${BEETLE_DATABASE_MYSQL_DATABASE:-drifter.db}
# Database Username
username: ${BEETLE_DATABASE_MYSQL_USERNAME:-root}
# Database Password
password: ${BEETLE_DATABASE_MYSQL_PASSWORD:-root}
+ # Endpoints Configs
+ endpoints:
+ - name: orders
+ active: true
+ proxy:
+ listen_path: "/orders/v2/*"
+ upstreams:
+ balancing: roundrobin
+ targets:
+ - target: http://www.mocky.io/v2/595625d22900008702cd71e8
+ methods:
+ - GET
+ authentication:
+ status: off
+ methods:
+ -
+ id: 1
+ rate_limit:
+ status: off
+
+ circuit_breaker:
+ status: off
+
# Log configs
log:
# Log level, it can be debug, info, warn, error, panic, fatal
- level: ${WALNUT_LOG_LEVEL:-info}
- # Output can be stdout or abs path to log file /var/logs/walnut.log
- output: ${WALNUT_LOG_OUTPUT:-stdout}
+ level: ${DRIFTER_LOG_LEVEL:-info}
+ # Output can be stdout or abs path to log file /var/logs/drifter.log
+ output: ${DRIFTER_LOG_OUTPUT:-stdout}
# Format can be json
- format: ${WALNUT_LOG_FORMAT:-json}
+ format: ${DRIFTER_LOG_FORMAT:-json}
diff --git a/core/component/README.md b/core/component/README.md
index 81883aa..f873492 100644
--- a/core/component/README.md
+++ b/core/component/README.md
@@ -9,7 +9,7 @@ import (
"net/http"
"time"
- "github.com/clivern/walnut/core/component"
+ "github.com/clivern/drifter/core/component"
)
var cb *component.CircuitBreaker
diff --git a/core/controller/auth.go b/core/controller/auth.go
index f36623d..c05af14 100644
--- a/core/controller/auth.go
+++ b/core/controller/auth.go
@@ -8,7 +8,7 @@ import (
"net/http"
"strconv"
- "github.com/clivern/walnut/core/module"
+ "github.com/clivern/drifter/core/module"
"github.com/labstack/echo/v4"
log "github.com/sirupsen/logrus"
diff --git a/core/controller/context.go b/core/controller/context.go
index 04498d6..9dd9c5a 100644
--- a/core/controller/context.go
+++ b/core/controller/context.go
@@ -8,12 +8,12 @@ import (
"github.com/labstack/echo/v4"
)
-// WalnutContext type
-type WalnutContext struct {
+// DrifterContext type
+type DrifterContext struct {
echo.Context
}
// Foo returns foo
-func (c *WalnutContext) Foo() string {
+func (c *DrifterContext) Foo() string {
return "foo"
}
diff --git a/core/controller/home.go b/core/controller/home.go
index 9cdcc7d..ba942f9 100644
--- a/core/controller/home.go
+++ b/core/controller/home.go
@@ -5,7 +5,7 @@
package controller
import (
- "github.com/clivern/walnut/core/component"
+ "github.com/clivern/drifter/core/component"
"github.com/labstack/echo/v4"
)
diff --git a/core/middleware/correlation.go b/core/middleware/correlation.go
index 31040c8..f5e7136 100644
--- a/core/middleware/correlation.go
+++ b/core/middleware/correlation.go
@@ -7,7 +7,7 @@ package middleware
import (
"strings"
- "github.com/clivern/walnut/core/component"
+ "github.com/clivern/drifter/core/component"
"github.com/labstack/echo/v4"
)
diff --git a/core/module/auth_method.go b/core/module/auth_method.go
index 5eae734..0dfd04b 100644
--- a/core/module/auth_method.go
+++ b/core/module/auth_method.go
@@ -5,8 +5,8 @@
package module
import (
- "github.com/clivern/walnut/core/migration"
- "github.com/clivern/walnut/core/model"
+ "github.com/clivern/drifter/core/migration"
+ "github.com/clivern/drifter/core/model"
)
// CreateAuthMethod creates a new entity
diff --git a/core/module/database.go b/core/module/database.go
index c8d62d0..933a53a 100644
--- a/core/module/database.go
+++ b/core/module/database.go
@@ -8,8 +8,8 @@ import (
"fmt"
"time"
- "github.com/clivern/walnut/core/migration"
- "github.com/clivern/walnut/core/model"
+ "github.com/clivern/drifter/core/migration"
+ "github.com/clivern/drifter/core/model"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/mysql"
diff --git a/core/module/key_based_auth_data.go b/core/module/key_based_auth_data.go
index ba37410..dbd380b 100644
--- a/core/module/key_based_auth_data.go
+++ b/core/module/key_based_auth_data.go
@@ -5,8 +5,8 @@
package module
import (
- "github.com/clivern/walnut/core/migration"
- "github.com/clivern/walnut/core/model"
+ "github.com/clivern/drifter/core/migration"
+ "github.com/clivern/drifter/core/model"
)
// CreateKeyBasedAuthData creates a new entity
diff --git a/core/util/helpers_test.go b/core/util/helpers_test.go
index 7890bc8..43f9339 100644
--- a/core/util/helpers_test.go
+++ b/core/util/helpers_test.go
@@ -8,7 +8,7 @@ import (
"fmt"
"testing"
- "github.com/clivern/walnut/pkg"
+ "github.com/clivern/drifter/pkg"
"github.com/franela/goblin"
)
diff --git a/deployment/docker/.gitkeep b/deployment/docker/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/deployment/k8s/.gitkeep b/deployment/k8s/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/deployment/linux/install.sh b/deployment/linux/install.sh
index aea4c5a..90b169b 100644
--- a/deployment/linux/install.sh
+++ b/deployment/linux/install.sh
@@ -68,39 +68,39 @@ WantedBy=multi-user.target" > /etc/systemd/system/etcd.service
echo "etcd installation done!"
}
-function walnut {
- echo "Installing walnut ..."
+function drifter {
+ echo "Installing drifter ..."
apt-get install jq -y
- mkdir -p /etc/walnut/storage
+ mkdir -p /etc/drifter/storage
- cd /etc/walnut
+ cd /etc/drifter
- WALNUT_LATEST_VERSION=$(curl --silent "https://api.github.com/repos/Clivern/Walnut/releases/latest" | jq '.tag_name' | sed -E 's/.*"([^"]+)".*/\1/' | tr -d v)
+ DRIFTER_LATEST_VERSION=$(curl --silent "https://api.github.com/repos/Clivern/Drifter/releases/latest" | jq '.tag_name' | sed -E 's/.*"([^"]+)".*/\1/' | tr -d v)
- curl -sL https://github.com/Clivern/Walnut/releases/download/v{$WALNUT_LATEST_VERSION}/walnut_{$WALNUT_LATEST_VERSION}_Linux_x86_64.tar.gz | tar xz
+ curl -sL https://github.com/Clivern/Drifter/releases/download/v{$DRIFTER_LATEST_VERSION}/drifter_{$DRIFTER_LATEST_VERSION}_Linux_x86_64.tar.gz | tar xz
echo "[Unit]
-Description=Walnut
-Documentation=https://github.com/clivern/walnut
+Description=Drifter
+Documentation=https://github.com/clivern/drifter
[Service]
-ExecStart=/etc/walnut/walnut api -c /etc/walnut/config.prod.yml
+ExecStart=/etc/drifter/drifter api -c /etc/drifter/config.prod.yml
Restart=on-failure
RestartSec=2
[Install]
-WantedBy=multi-user.target" > /etc/systemd/system/walnut.service
+WantedBy=multi-user.target" > /etc/systemd/system/drifter.service
systemctl daemon-reload
- systemctl start walnut.service
+ systemctl start drifter.service
- echo "walnut installation done!"
+ echo "drifter installation done!"
}
docker
docker_compose
etcd
-walnut
+drifter
diff --git a/deployment/linux/upgrade.sh b/deployment/linux/upgrade.sh
index 66348d2..fe74d78 100644
--- a/deployment/linux/upgrade.sh
+++ b/deployment/linux/upgrade.sh
@@ -1,21 +1,21 @@
#!/bin/bash
-function walnut {
- echo "Upgrade walnut ..."
+function drifter {
+ echo "Upgrade drifter ..."
- cd /etc/walnut
+ cd /etc/drifter
mv config.prod.yml config.back.yml
- WALNUT_LATEST_VERSION=$(curl --silent "https://api.github.com/repos/Clivern/Walnut/releases/latest" | jq '.tag_name' | sed -E 's/.*"([^"]+)".*/\1/' | tr -d v)
+ DRIFTER_LATEST_VERSION=$(curl --silent "https://api.github.com/repos/Clivern/Drifter/releases/latest" | jq '.tag_name' | sed -E 's/.*"([^"]+)".*/\1/' | tr -d v)
- curl -sL https://github.com/Clivern/Walnut/releases/download/v{$WALNUT_LATEST_VERSION}/walnut_{$WALNUT_LATEST_VERSION}_Linux_x86_64.tar.gz | tar xz
+ curl -sL https://github.com/Clivern/Drifter/releases/download/v{$DRIFTER_LATEST_VERSION}/drifter_{$DRIFTER_LATEST_VERSION}_Linux_x86_64.tar.gz | tar xz
rm config.prod.yml
mv config.back.yml config.prod.yml
- systemctl restart walnut
+ systemctl restart drifter
- echo "walnut upgrade done!"
+ echo "drifter upgrade done!"
}
-walnut
+drifter
diff --git a/walnut.go b/drifter.go
similarity index 91%
rename from walnut.go
rename to drifter.go
index dec8942..3ed2e37 100644
--- a/walnut.go
+++ b/drifter.go
@@ -5,7 +5,7 @@
package main
import (
- "github.com/clivern/walnut/cmd"
+ "github.com/clivern/drifter/cmd"
)
var (
diff --git a/go.mod b/go.mod
index 9ab4174..2492366 100644
--- a/go.mod
+++ b/go.mod
@@ -1,4 +1,4 @@
-module github.com/clivern/walnut
+module github.com/clivern/drifter
go 1.16