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
55 changes: 52 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ members = [
"cloud/id",
"cloud/proto",
"cloud/video/api",
"cloud/video/api/db-types",
"cloud/video/api/traits",
"cloud/video/ingest",
"cloud/video/ingest/traits",
Expand Down
32 changes: 32 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,38 @@ generate-mtls-certs:
-out local/mtls/scufflecloud_email_cert.pem \
-copy_extensions copy

# Generate ingest cert signed by root CA
openssl genpkey -out local/mtls/scufflecloud_ingest_key.pem -algorithm ED25519
openssl req -new -key local/mtls/scufflecloud_ingest_key.pem \
-subj "/CN=scufflecloud-ingest-mtls" \
-addext "subjectAltName=DNS:localhost" \
-out local/mtls/scufflecloud_ingest_csr.pem

# Sign ingest cert with root CA
openssl x509 -req \
-in local/mtls/scufflecloud_ingest_csr.pem \
-CA local/mtls/root_cert.pem \
-CAkey local/mtls/root_key.pem \
-CAcreateserial -days 365 \
-out local/mtls/scufflecloud_ingest_cert.pem \
-copy_extensions copy

# Generate video api cert signed by root CA
openssl genpkey -out local/mtls/scufflecloud_video_api_key.pem -algorithm ED25519
openssl req -new -key local/mtls/scufflecloud_video_api_key.pem \
-subj "/CN=scufflecloud-video-api-mtls" \
-addext "subjectAltName=DNS:localhost" \
-out local/mtls/scufflecloud_video_api_csr.pem

# Sign video api cert with root CA
openssl x509 -req \
-in local/mtls/scufflecloud_video_api_csr.pem \
-CA local/mtls/root_cert.pem \
-CAkey local/mtls/root_key.pem \
-CAcreateserial -days 365 \
-out local/mtls/scufflecloud_video_api_cert.pem \
-copy_extensions copy

alias coverage := test
alias sync-rdme := sync-readme

Expand Down
1 change: 1 addition & 0 deletions cargo_targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ _packages = [
"//cloud/video/ingest/traits",
"//cloud/video/api",
"//cloud/video/api/traits",
"//cloud/video/api/db-types",
"//cloud/id",
"//cloud/proto",
"//crates/aac",
Expand Down
4 changes: 2 additions & 2 deletions cloud/core/bin/standalone/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ mod dataloaders;
pub struct Config {
#[default(env!("CARGO_PKG_NAME").to_string())]
pub service_name: String,
#[default(SocketAddr::from(([127, 0, 0, 1], 3001)))]
#[default("[::]:3001".parse().unwrap())]
pub bind: SocketAddr,
#[default = "info"]
pub level: String,
Expand Down Expand Up @@ -291,7 +291,7 @@ impl scuffle_bootstrap::Global for Global {
anyhow::bail!("DATABASE_URL is not set");
};

tracing::info!(db_url = config.db_url, "creating database connection pool");
tracing::info!(db_url = db_url, "creating database connection pool");

let database = bb8::Pool::builder()
.build(diesel_async::pooled_connection::AsyncDieselConnectionManager::new(db_url))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto3";

package scufflecloud.core.v1;
package scufflecloud;

import "google/protobuf/descriptor.proto";
import "tinc/annotations.proto";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ syntax = "proto3";
package scufflecloud.core.v1;

import "google/protobuf/empty.proto";
import "scufflecloud/core/v1/constraints.proto";
import "scufflecloud/constraints.proto";
import "scufflecloud/core/v1/organizations.proto";
import "tinc/annotations.proto";

Expand Down
2 changes: 1 addition & 1 deletion cloud/proto/pb/scufflecloud/core/v1/organizations.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ syntax = "proto3";
package scufflecloud.core.v1;

import "google/protobuf/timestamp.proto";
import "scufflecloud/core/v1/constraints.proto";
import "scufflecloud/constraints.proto";
import "tinc/annotations.proto";

message Organization {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package scufflecloud.core.v1;

import "scufflecloud/core/v1/constraints.proto";
import "scufflecloud/constraints.proto";
import "scufflecloud/core/v1/organizations.proto";
import "tinc/annotations.proto";

Expand Down
2 changes: 1 addition & 1 deletion cloud/proto/pb/scufflecloud/core/v1/sessions.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ syntax = "proto3";
package scufflecloud.core.v1;

import "google/protobuf/timestamp.proto";
import "scufflecloud/core/v1/constraints.proto";
import "scufflecloud/constraints.proto";

message UserSession {
string user_id = 1 [(string_constraint).id = true];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package scufflecloud.core.v1;

import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "scufflecloud/constraints.proto";
import "scufflecloud/core/v1/common.proto";
import "scufflecloud/core/v1/constraints.proto";
import "scufflecloud/core/v1/organizations.proto";
import "scufflecloud/core/v1/sessions.proto";
import "tinc/annotations.proto";
Expand Down
2 changes: 1 addition & 1 deletion cloud/proto/pb/scufflecloud/core/v1/users.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ syntax = "proto3";
package scufflecloud.core.v1;

import "google/protobuf/timestamp.proto";
import "scufflecloud/core/v1/constraints.proto";
import "scufflecloud/constraints.proto";
import "tinc/annotations.proto";

message User {
Expand Down
2 changes: 1 addition & 1 deletion cloud/proto/pb/scufflecloud/core/v1/users_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package scufflecloud.core.v1;

import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "scufflecloud/constraints.proto";
import "scufflecloud/core/v1/common.proto";
import "scufflecloud/core/v1/constraints.proto";
import "scufflecloud/core/v1/users.proto";
import "tinc/annotations.proto";

Expand Down
15 changes: 15 additions & 0 deletions cloud/proto/pb/scufflecloud/video/api/v1/stream.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
syntax = "proto3";

package scufflecloud.video.api.v1;

import "scufflecloud/constraints.proto";

// Represents a video stream.
message Stream {
// The unique identifier of the stream.
string id = 1 [(string_constraint).id = true];
// The ID of the project this stream belongs to.
string project_id = 2 [(string_constraint).id = true];
// The human readable name of the stream.
string name = 3;
}
135 changes: 135 additions & 0 deletions cloud/proto/pb/scufflecloud/video/api/v1/stream_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
syntax = "proto3";

package scufflecloud.video.api.v1;

import "scufflecloud/constraints.proto";
import "scufflecloud/video/api/v1/stream.proto";
import "tinc/annotations.proto";

// A service for managing video streams.
service StreamService {
option (tinc.service).prefix = "/streams";

// Create a new stream.
rpc Create(StreamCreateRequest) returns (StreamCreateResponse) {
option (tinc.method).endpoint = {post: "/"};
}

// Get a stream by ID.
rpc Get(StreamGetRequest) returns (StreamGetResponse) {
option (tinc.method).endpoint = {get: "/{id}"};
}

// Update a stream by ID.
rpc Update(StreamUpdateRequest) returns (StreamUpdateResponse) {
option (tinc.method).endpoint = {patch: "/{id}"};
}

// Delete a stream by ID.
rpc Delete(StreamDeleteRequest) returns (StreamDeleteResponse) {
option (tinc.method).endpoint = {delete: "/{id}"};
}

// List all streams with optional sorting and pagination.
rpc List(StreamListRequest) returns (StreamListResponse) {
option (tinc.method).endpoint = {get: "/"};
}
}

// The request message for `StreamService.Create`.
message StreamCreateRequest {
// The ID of the project to create the stream in.
string project_id = 1 [(string_constraint).id = true];
// The name of the stream. If not provided, a randomly generated name will be used.
optional string name = 2 [(tinc.field).constraint.string = {
min_len: 1
max_len: 255
}];
}

// The response message for `StreamService.Create`.
message StreamCreateResponse {
// The created stream.
Stream stream = 1;
}

// The request message for `StreamService.Get`.
message StreamGetRequest {
// The ID of the stream to retrieve.
string id = 1 [(string_constraint).id = true];
}

// The response message for `StreamService.Get`.
message StreamGetResponse {
// The retrieved stream.
Stream stream = 1;
}

// The request message for `StreamService.Update`.
message StreamUpdateRequest {
// The ID of the stream to update.
string id = 1 [(string_constraint).id = true];
// The new name of the stream. If not provided, the name will remain unchanged.
optional string name = 2 [(tinc.field).constraint.string = {
min_len: 1
max_len: 255
}];
}

// The response message for `StreamService.Update`.
message StreamUpdateResponse {
// The updated stream.
Stream stream = 1;
}

// The request message for `StreamService.Delete`.
message StreamDeleteRequest {
// The ID of the stream to delete.
string id = 1 [(string_constraint).id = true];
}

// The response message for `StreamService.Delete`.
message StreamDeleteResponse {
// The deleted stream.
Stream stream = 1;
}

// The request message for `StreamService.List`.
message StreamListRequest {
// Sorting options for the list of streams.
message Sorting {
// The field to sort by.
enum Field {
STREAM_LIST_SORTING_UNSPECIFIED = 0 [(tinc.variant).visibility = SKIP];
STREAM_LIST_SORTING_NAME = 1;
}

// The order to sort by.
enum Order {
STREAM_LIST_ORDER_UNSPECIFIED = 0 [(tinc.variant).visibility = SKIP];
STREAM_LIST_ORDER_ASC = 1;
STREAM_LIST_ORDER_DESC = 2;
}

// The field to sort by.
Field field = 1;
// The order to sort by.
Order order = 2;
}

// The sorting options.
optional Sorting sorting = 1;
// The maximum number of streams to return. Defaults to 20, minimum is 1, maximum is 100.
optional uint32 limit = 2 [(tinc.field).constraint.uint32 = {
gte: 1
lte: 100
}];
// The offset to start returning streams from. Defaults to 0.
optional uint32 offset = 3;
}

// The response message for `StreamService.List`.
message StreamListResponse {
// The list of streams that the request matched.
repeated Stream streams = 1;
}
Loading
Loading