Skip to content

Commit 808a12a

Browse files
authored
chore: wire up doc and helm charts with README and main entrypoint (#24)
1 parent 64c964e commit 808a12a

File tree

18 files changed

+125
-484
lines changed

18 files changed

+125
-484
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.vscode/
22
dist/
33
genprotos/
4-
localconfig/
54
coverage.out
65
internal/mock_*.go

README.md

+40-15
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,67 @@
11
# access-controller
22

3+
[![Latest Release](https://img.shields.io/github/v/release/authorizer-tech/access-controller)](https://github.com/authorizer-tech/access-controller/releases/latest)
34
[![Go Report Card](https://goreportcard.com/badge/github.com/authorizer-tech/access-controller)](https://goreportcard.com/report/github.com/authorizer-tech/access-controller)
5+
[![Slack](https://img.shields.io/badge/slack-%23authorizer--tech-green)](https://authorizer-tech.slack.com)
46

57
An implementation of a distributed access-control server that is based on [Google Zanzibar](https://research.google/pubs/pub48190/) - "Google's Consistent, Global Authorization System".
68

79
An instance of an `access-controller` is similar to the `aclserver` implementation called out in the paper. A cluster of access-controllers implement the functional equivalent of the Zanzibar `aclserver` cluster.
810

911
# Getting Started
12+
If you want to setup an instance of the Authorizer platform as a whole, browse the API References, or just brush up on the concepts and design of the platform, take a look at the [official platform documentation](https://authorizer-tech.github.io/docs/overview/introduction). If you're only interested in running the access-controller then continue on.
1013

11-
## Start a Local Cluster
14+
## Setup a Cluster
1215
An access-controller server supports single node or multi-node (clustered) topologies. Instructions for running the server with these topologies are outlined below.
1316

1417
To gain the benefits of the distributed query model that the access-controller implements, it is recommend to run a large cluster. Doing so will help distribute query load across more nodes within the cluster. The underlying cluster membership list is based on Hashicorp's [`memberlist`](https://github.com/hashicorp/memberlist)
1518

1619
> a library that manages cluster membership and member failure detection using a gossip based protocol.
1720
18-
A cluster should be able to suport hundreds of nodes. If you find otherwise, please submit an issue.
21+
A cluster should be able to suport hundreds of nodes. If you find otherwise, please [submit an issue](https://github.com/authorizer-tech/access-controller/issues/new).
1922

20-
### Binary
23+
### Docker Compose
24+
[`docker-compose.yml`](./docker/docker-compose.yml) provides an example of how to setup a multi-node cluster using Docker and is a great way to get started quickly.
25+
26+
```console
27+
$ docker compose -f docker/docker-compose.yml up
28+
```
29+
30+
### Kubernetes (Recommended)
31+
Take a look at our [official Helm chart](https://authorizer-tech.github.io/helm-charts/access-controller).
32+
33+
### Pre-compiled Binaries
34+
Download the [latest release](https://github.com/authorizer-tech/access-controller/releases/latest) and extract it.
35+
36+
#### Pre-requisites
37+
To run an access-controller you must have a running CockroachDB database. Take a look at setting up [CockroachDB with Docker](https://www.cockroachlabs.com/docs/stable/start-a-local-cluster-in-docker-mac.html).
2138

2239
#### Single Node
23-
```bash
24-
$ ./access-controller
40+
```console
41+
$ ./bin/access-controller
2542
```
2643

2744
#### Multi-node
28-
Start a multi-node cluster by starting multiple independent servers and use the `--join` flag
45+
Start a multi-node cluster by starting multiple independent servers and use the `-join` flag
2946
to join the node to an existing cluster.
3047

31-
```bash
32-
$ ./access-controller --node-port 7946 --grpc-port 50052
33-
$ ./access-controller --node-port 7947 --grpc-port 50053 --join 127.0.0.1:7946
34-
$ ./access-controller --node-port 7948 --grpc-port 50054 --join 127.0.0.1:7947
48+
```console
49+
$ ./bin/access-controller -node-port 7946 -grpc-port 50052
50+
$ ./bin/access-controller -node-port 7947 -grpc-port 50053 -join 127.0.0.1:7946
51+
$ ./bin/access-controller -node-port 7948 -grpc-port 50054 -join 127.0.0.1:7947
3552
```
3653

37-
### Kubernetes
38-
A [Helm chart](./helm/access-controller) is included in this repository to provision an access-controller cluster in Kubernetes.
54+
## Next Steps...
55+
Take a look at the examples of how to:
56+
* [Add a Namespace Configuration](https://authorizer-tech.github.io/docs/getting-started/add-namespace-config)
57+
* [Write a Relation Tuple](https://authorizer-tech.github.io/docs/getting-started/write-relation-tuple)
58+
* [Check a Subject's Access](https://authorizer-tech.github.io/docs/getting-started/check-access)
59+
60+
Don't hesitate to browse the official [Documentation](https://authorizer-tech.github.io/docs/overview/introduction), [API Reference](https://authorizer-tech.github.io/docs/api-reference/overview) and [Examples](https://authorizer-tech.github.io/docs/overview/examples/examples-intro).
61+
62+
# Community
63+
The access-controller is an open-source project and we value and welcome new contributors and members
64+
of the community. Here are ways to get in touch with the community:
3965

40-
```bash
41-
helm install access-controller ./helm/access-controller
42-
```
66+
* Slack: [#authorizer-tech](https://authorizer-tech.slack.com)
67+
* Issue Tracker: [GitHub Issues](https://github.com/authorizer-tech/access-controller/issues)

api/openapiv2/authorizer/accesscontroller/v1alpha1/namespace_service.swagger.json

-9
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@
4040
"in": "query",
4141
"required": false,
4242
"type": "string"
43-
},
44-
{
45-
"name": "snaptoken",
46-
"in": "query",
47-
"required": false,
48-
"type": "string"
4943
}
5044
],
5145
"tags": [
@@ -175,9 +169,6 @@
175169
},
176170
"config": {
177171
"$ref": "#/definitions/v1alpha1NamespaceConfig"
178-
},
179-
"snaptoken": {
180-
"type": "string"
181172
}
182173
},
183174
"description": "The response for a NamespaceConfigService.ReadConfig rpc."

api/protos/authorizer/accesscontroller/v1alpha1/namespace_service.proto

-2
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,12 @@ message WriteConfigResponse {
4545
// The request for a NamespaceConfigService.ReadConfig rpc.
4646
message ReadConfigRequest {
4747
string namespace = 1;
48-
string snaptoken = 2;
4948
}
5049

5150
// The response for a NamespaceConfigService.ReadConfig rpc.
5251
message ReadConfigResponse {
5352
string namespace = 1;
5453
NamespaceConfig config = 2;
55-
string snaptoken = 3;
5654
}
5755

5856
message NamespaceConfig {

cmd/access-controller/main.go

+23-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type config struct {
5050
Enabled bool
5151
}
5252

53-
Postgres struct {
53+
CockroachDB struct {
5454
Host string
5555
Port int
5656
Database string
@@ -75,12 +75,31 @@ func main() {
7575

7676
pgUsername := viper.GetString("POSTGRES_USERNAME")
7777
pgPassword := viper.GetString("POSTGRES_PASSWORD")
78+
79+
dbHost := cfg.CockroachDB.Host
80+
if dbHost == "" {
81+
dbHost = "localhost"
82+
log.Warn("The database host was not configured. Defaulting to 'localhost'")
83+
}
84+
85+
dbPort := cfg.CockroachDB.Port
86+
if dbPort == 0 {
87+
dbPort = 26257
88+
log.Warn("The database port was not configured. Defaulting to '26257'")
89+
}
90+
91+
dbName := cfg.CockroachDB.Database
92+
if dbName == "" {
93+
dbName = "postgres"
94+
log.Warn("The database name was not configured. Defaulting to 'postgres'")
95+
}
96+
7897
dsn := fmt.Sprintf("postgresql://%s:%s@%s:%d/%s?sslmode=disable",
7998
pgUsername,
8099
pgPassword,
81-
cfg.Postgres.Host,
82-
cfg.Postgres.Port,
83-
cfg.Postgres.Database,
100+
dbHost,
101+
dbPort,
102+
dbName,
84103
)
85104

86105
db, err := sql.Open("postgres", dsn)

docker/config.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
grpcGateway:
2+
enabled: true
3+
4+
cockroachdb:
5+
host: cockroachdb
6+
port: 26257
7+
database: postgres

docker/docker-compose.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
version: "3.9"
2+
services:
3+
access-controller0:
4+
image: gcr.io/authorizer-tech/access-controller:latest
5+
ports:
6+
- "50052:50052"
7+
- "8082:8082"
8+
command: access-controller -config /etc/config/config.yaml
9+
volumes:
10+
- "${PWD}/docker:/etc/config"
11+
depends_on:
12+
- cockroachdb
13+
14+
access-controller1:
15+
image: gcr.io/authorizer-tech/access-controller:latest
16+
ports:
17+
- "50053:50053"
18+
- "8083:8083"
19+
command: access-controller -config /etc/config/config.yaml -grpc-port 50053 -http-port 8083 -node-port 7947 -join access-controller0:7946
20+
volumes:
21+
- "${PWD}/docker:/etc/config"
22+
depends_on:
23+
- access-controller0
24+
25+
access-controller2:
26+
image: gcr.io/authorizer-tech/access-controller:latest
27+
ports:
28+
- "50054:50054"
29+
- "8084:8084"
30+
command: access-controller -config /etc/config/config.yaml -grpc-port 50054 -http-port 8084 -node-port 7948 -join access-controller0:7946,access-controller1:7947
31+
volumes:
32+
- "${PWD}/docker:/etc/config"
33+
depends_on:
34+
- access-controller1
35+
36+
cockroachdb:
37+
image: cockroachdb/cockroach:v21.1.1
38+
ports:
39+
- "26257:26257"
40+
- "8080:8080"
41+
command: start-single-node --insecure
42+
volumes:
43+
- "cockroach_data:/cockroach/cockroach-data"
44+
45+
volumes:
46+
cockroach_data:
47+
driver: local

helm/access-controller/.helmignore

-23
This file was deleted.

helm/access-controller/Chart.yaml

-6
This file was deleted.

helm/access-controller/templates/_helpers.tpl

-69
This file was deleted.

helm/access-controller/templates/configmap.yaml

-14
This file was deleted.

helm/access-controller/templates/hpa.yaml

-28
This file was deleted.

0 commit comments

Comments
 (0)