Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .fabrica.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
project:
name: remote-console
module: github.com/OpenCHAMI/remote-console
description: OpenCHAMI remote console service
created: 2026-07-08T18:41:14.860713878Z
features:
validation:
enabled: true
mode: strict
events:
enabled: false
bus_type: memory
conditional:
enabled: true
etag_algorithm: sha256
auth:
enabled: true
storage:
enabled: false
type: file
db_driver: sqlite3
reconciliation:
enabled: false
worker_count: 5
requeue_delay: 5
security:
authn:
enabled: true
authz:
enabled: false
mode: enforce
generation:
handlers: true
storage: false
client: false
openapi: true
events: false
middleware: true
reconciliation: false
2 changes: 1 addition & 1 deletion .github/workflows/integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
go-version-file: go.mod
- name: Build remote-console binary for Dockerfile
run: |
go build -o remote-console ./cmd/remote-console
go build -o remote-console ./cmd/server
- name: Run integration tests
run: |
go test ./test -timeout 20m ./test
4 changes: 2 additions & 2 deletions .github/workflows/unit_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ jobs:
go-version-file: go.mod
- name: Run unit tests
run: |
# Exclude the integration tests
go test ./internal/...
# Exclude Docker-backed integration tests in ./test.
go test ./apis/... ./cmd/... ./internal/... ./pkg/...
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ before:

builds:
- id: remote-console
main: ./cmd/remote-console
main: ./cmd/server
binary: remote-console
goos:
- linux
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ RUN go env -w GO111MODULE=auto

# Copy source files
COPY cmd $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/cmd
COPY apis $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/apis
COPY configs configs
COPY scripts scripts
COPY internal $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/internal
COPY pkg $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/pkg
COPY go.mod $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/go.mod
COPY go.sum $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/go.sum

# Build the image
RUN set -ex && go build -C $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/cmd/remote-console -v -o /usr/local/bin/remote-console
RUN set -ex && go build -C $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/cmd/server -v -o /usr/local/bin/remote-console

### Final Stage ###
FROM ubuntu:24.04 AS final
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile.debug
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.24-bookworm
FROM golang:1.26-bookworm

# Configure go env
ENV GOPATH=/usr/local/golib
Expand All @@ -8,14 +8,16 @@ RUN export CGO_ENABLED=0

# Copy source files
COPY cmd $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/cmd
COPY apis $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/apis
COPY configs configs
COPY scripts scripts
COPY internal $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/internal
COPY pkg $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/pkg
COPY go.mod $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/go.mod
COPY go.sum $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/go.sum

# Build the image
RUN go build -C $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/cmd/remote-console -v \
RUN go build -C $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/cmd/server -v \
-gcflags=all="-N -l" \
-o /usr/local/bin/remote-console

Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ VERSION ?= $(shell git describe --tags --always --abbrev=0)
GOLANGCI_LINT ?= golangci-lint
GO_PACKAGES ?= ./...
TEST_PACKAGES ?= $(GO_PACKAGES)
FABRICA ?= go run github.com/openchami/fabrica/cmd/fabrica
FABRICA_GENERATE_ARGS ?=

.PHONY: all lint test image
.PHONY: all lint test image generate format-generated

all : lint image

Expand All @@ -22,3 +24,11 @@ test:

image:
docker build --pull $(DOCKER_ARGS) --tag '$(NAME):$(VERSION)' .

generate:
$(FABRICA) generate $(FABRICA_GENERATE_ARGS)
$(MAKE) format-generated

format-generated:
@files=$$(find apis cmd/server pkg/resources -name '*.go' -type f 2>/dev/null); \
if [ -n "$$files" ]; then gofmt -w $$files; fi
10 changes: 10 additions & 0 deletions apis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
groups:
- name: remote-console.openchami.io
storageVersion: v1
versions:
- v1
resources:
Console:
path: /remote-console/consoles
operations:
- list
41 changes: 41 additions & 0 deletions apis/remote-console.openchami.io/v1/console_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright © 2026 OpenCHAMI a Series of LF Projects, LLC
//
// SPDX-License-Identifier: MIT

package v1

import "github.com/openchami/fabrica/pkg/fabrica"

// Console represents a console resource
type Console struct {
APIVersion string `json:"apiVersion" yaml:"apiVersion"`
Kind string `json:"kind" yaml:"kind"`
Metadata fabrica.Metadata `json:"metadata" yaml:"metadata"`
Spec ConsoleSpec `json:"spec" yaml:"spec" validate:"required"`
}

// ConsoleSpec defines the desired state of Console
type ConsoleSpec struct {
ConnectionType string `json:"connectionType" yaml:"connectionType"`
ConnectionHost string `json:"connectionHost" yaml:"connectionHost"`
ConnectionPort int `json:"connectionPort" yaml:"connectionPort"`
ConsoleEntryCommand string `json:"consoleEntryCommand,omitempty" yaml:"consoleEntryCommand,omitempty"`
}

// GetKind returns the kind of the resource
func (r *Console) GetKind() string {
return "Console"
}

// GetName returns the name of the resource
func (r *Console) GetName() string {
return r.Metadata.Name
}

// GetUID returns the UID of the resource
func (r *Console) GetUID() string {
return r.Metadata.UID
}

// IsHub marks this as the hub/storage version
func (r *Console) IsHub() {}
10 changes: 10 additions & 0 deletions authz/grouping.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2025-2026 OpenCHAMI a Series of LF Projects, LLC
# Starter grouping policy for Fabrica-generated services.
#
# TokenSmith's authorizer evaluates role subjects directly (role:<name>).
# Use grouping for role inheritance so broader roles automatically include the
# permissions of narrower roles.

g, role:editor, role:viewer
g, role:admin, role:editor
23 changes: 23 additions & 0 deletions authz/model.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2025-2026 OpenCHAMI a Series of LF Projects, LLC
# Starter Casbin model for Fabrica-generated services.
#
# This model matches the default AuthZ classifier output:
# sub = normalized role subject (TokenSmith enforces with role:<name>)
# obj = stable chi route pattern (for example /sensors/{uid})
# act = HTTP method (GET, POST, PUT, PATCH, DELETE)

[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, act

[role_definition]
g = _, _

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
18 changes: 18 additions & 0 deletions authz/policy.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2025-2026 OpenCHAMI a Series of LF Projects, LLC
# Starter policy for Fabrica-generated services.
#
# TokenSmith evaluates the caller's normalized roles using Casbin subjects in the
# form role:<name>. Start simple, then tailor these tuples for your deployment.

# Console
p, role:viewer, /remote-console/consoles, GET
p, role:viewer, /remote-console/consoles/{uid}, GET

p, role:editor, /remote-console/consoles, GET
p, role:editor, /remote-console/consoles/{uid}, GET

p, role:admin, /remote-console/consoles, GET
p, role:admin, /remote-console/consoles/{uid}, GET

# Add deployment-specific tuples below.
52 changes: 0 additions & 52 deletions cmd/remote-console/command.go

This file was deleted.

101 changes: 0 additions & 101 deletions cmd/remote-console/config.go

This file was deleted.

Loading