Skip to content

Commit cba1051

Browse files
committed
refactor: rename server with gateway
1 parent 5e5ce0f commit cba1051

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+78
-77
lines changed

Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@ help: ## Show this help
77
@awk 'BEGIN {FS = ":.*?## "} /^[\/.a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
88
.PHONY: help
99

10-
build: build-mobius ## Build missing studio project
10+
build: build-gateway ## Build missing studio project
1111
.PHONY: build
1212

13-
build-mobius:
14-
sh -c "cd ./mobius && make all"
15-
.PHONY: build-mobius
13+
build-gateway:
14+
sh -c "cd ./gateway && make all"
15+
.PHONY: build-gateway
1616

1717
build-protos: ## Build missing studio protos
1818
sh -c "cd ./protos && make all"
1919
.PHONY: build-protos
2020

21-
clean: clean-mobius ## Clean missing studio
21+
clean: clean-gateway ## Clean missing studio
2222
.PHONY: clean
2323

24-
clean-mobius:
25-
@echo "🧹 Cleaning mobius.."
26-
sh -c "cd ./mobius && make clean"
27-
.PHONY: clean-mobius
24+
clean-gateway:
25+
@echo "🧹 Cleaning gateway.."
26+
sh -c "cd ./gateway && make clean"
27+
.PHONY: clean-gateway
2828

2929
rebuild: clean build ## Rebuild missing studio again
3030
.PHONY: rebuild

docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
services:
2-
mobius:
3-
container_name: mobius
4-
image: mobius
2+
gateway:
3+
container_name: gateway
4+
image: gateway
55
build:
66
context: .
7-
dockerfile: ./docker/Dockerfile.mobius.dev
7+
dockerfile: ./docker/Dockerfile.gateway.dev
88
command: server start
99
environment:
1010
- HOST=0.0.0.0

docker/Dockerfile.mobius.dev

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ FROM golang:1.21-alpine3.18 as builder
22
RUN mkdir /workspace
33

44
WORKDIR /workspace
5-
COPY ./mobius ./mobius
5+
COPY ./gateway ./gateway
66
COPY ./protos ./protos
77
COPY ./worker ./worker
88
COPY ./common ./common
99

1010
COPY ./go.work .
1111
RUN go work sync
1212

13-
WORKDIR /workspace/mobius
14-
RUN cgo_enabled=0 goos=linux go build -o bin/mobius
13+
WORKDIR /workspace/gateway
14+
RUN cgo_enabled=0 goos=linux go build -o bin/gateway
1515

1616

1717
FROM alpine:3.18
18-
COPY --from=builder /workspace/mobius/bin/mobius /usr/bin/
18+
COPY --from=builder /workspace/gateway/bin/gateway /usr/bin/
1919
RUN apk update
2020
RUN apk add ca-certificates
2121

@@ -24,4 +24,4 @@ RUN apk add ca-certificates
2424
# don't work well with musl libc that alpine uses
2525
RUN apk add libc6-compat
2626

27-
ENTRYPOINT ["mobius"]
27+
ENTRYPOINT ["gateway"]
File renamed without changes.
File renamed without changes.

mobius/Makefile renamed to gateway/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ vet:
77
@echo "🧹 Vetting go.mod.."
88
$(GO) vet ./...
99

10-
build: gen vet ## build mobius server
10+
build: gen vet ## build AI Gateway server
1111
scripts/build.sh
1212
.PHONY: build
1313

@@ -20,7 +20,7 @@ gen:
2020
sh -c "cd ../protos && make all"
2121
.PHONY: gen
2222

23-
clean: ## Clean mobius server
23+
clean: ## Clean AI Gateway server
2424
rm -rf bin
2525
.PHONY: clean
2626

mobius/cmd/cli.go renamed to gateway/cmd/cli.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ const Description = `
2020
2121
2222
23-
🌈 Mobius is an open-source, lightweight, high-performance ai studio gateway
23+
🌈 AI gateway is an open-source, lightweight and high-performance gateway
2424
`
2525

2626
func New(cliConfig *Config) *cobra.Command {
2727
cmd := &cobra.Command{
28-
Use: "mobius <command> <subcommand> [flags]",
29-
Short: "🌈 Mobius is an open-source, lightweight, high-performance ai studio gateway",
28+
Use: "gateway <command> <subcommand> [flags]",
29+
Short: "🌈 AI gateway is an open-source, lightweight and high-performance gateway",
3030
Long: heredoc.Doc(Description),
3131
SilenceUsage: true,
3232
SilenceErrors: true,

mobius/cmd/config.go renamed to gateway/cmd/config.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type Config struct {
1616
func LoadConfig() (*Config, error) {
1717
var config Config
1818

19-
cfg := cmdx.SetConfig("mobius")
19+
cfg := cmdx.SetConfig("gateway")
2020
err := cfg.Load(&config)
2121

2222
return &config, err
@@ -27,8 +27,8 @@ func ConfigCommand() *cobra.Command {
2727
Use: "config <command>",
2828
Short: "Manage client configurations",
2929
Example: heredoc.Doc(`
30-
$ mobius config init
31-
$ mobius config list`),
30+
$ gateway config init
31+
$ gateway config list`),
3232
}
3333

3434
cmd.AddCommand(configInitCommand())
@@ -42,13 +42,13 @@ func configInitCommand() *cobra.Command {
4242
Use: "init",
4343
Short: "Initialize a new client configuration",
4444
Example: heredoc.Doc(`
45-
$ mobius config init
45+
$ gateway config init
4646
`),
4747
Annotations: map[string]string{
4848
"group": "core",
4949
},
5050
RunE: func(cmd *cobra.Command, args []string) error {
51-
cfg := cmdx.SetConfig("mobius")
51+
cfg := cmdx.SetConfig("gateway")
5252

5353
if err := cfg.Init(&Config{}); err != nil {
5454
return err
@@ -65,13 +65,13 @@ func configListCommand() *cobra.Command {
6565
Use: "list",
6666
Short: "List client configuration settings",
6767
Example: heredoc.Doc(`
68-
$ mobius config list
68+
$ gateway config list
6969
`),
7070
Annotations: map[string]string{
7171
"group": "core",
7272
},
7373
RunE: func(cmd *cobra.Command, args []string) error {
74-
cfg := cmdx.SetConfig("mobius")
74+
cfg := cmdx.SetConfig("gateway")
7575

7676
data, err := cfg.Read()
7777
if err != nil {

gateway/cmd/errors.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package cmd
2+
3+
import (
4+
"errors"
5+
6+
"github.com/MakeNowJust/heredoc"
7+
)
8+
9+
var (
10+
ErrClientConfigNotFound = errors.New(heredoc.Doc(`
11+
gateway client config not found.
12+
13+
Run "gateway config init" to initialize a new client config or
14+
Run "gateway help environment" for more information.
15+
`))
16+
ErrClientConfigHostNotFound = errors.New(heredoc.Doc(`
17+
gateway client config "host" not found.
18+
19+
Pass gateway server host with "--host" flag or
20+
set host in gateway config.
21+
22+
Run "gateway config <subcommand>" or
23+
"gateway help environment" for more information.
24+
`))
25+
ErrClientNotAuthorized = errors.New(heredoc.Doc(`
26+
gateway auth error. gateway requires an auth header.
27+
28+
Run "gateway help auth" for more information.
29+
`))
30+
)
File renamed without changes.

0 commit comments

Comments
 (0)