Skip to content

Commit

Permalink
CIEDEV-2140: Release Service Scaffolding (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmilovanovicc authored Nov 8, 2023
1 parent 23215b4 commit 5c75715
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
30 changes: 30 additions & 0 deletions cmd/release.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package cmd

import (
"github.com/terrariumcloud/terrarium/internal/release/services/release"

"github.com/spf13/cobra"
)

var releaseServiceCmd = &cobra.Command{
Use: "publish",
Short: "Starts the Terrarium GRPC Release service",
Long: "Runs the Terrarium GRPC Release server.",
Run: runReleaseService,
}

func init() {
rootCmd.AddCommand(releaseServiceCmd)
// TODO: database
//releaseServiceCmd.Flags().StringVarP(&release.ReleaseTableName, "table", "t", release.DefaultReleaseTableName, "Releases table name")
}

func runReleaseService(cmd *cobra.Command, args []string) {
releaseServiceServer := &release.ReleaseService{
// Db: storage.NewDynamoDbClient(awsAccessKey, awsSecretKey, awsRegion),
// Table: release.ReleaseTableName,
// Schema: release.GetModulesSchema(release.ReleaseTableName),
}

startGRPCService("release", releaseServiceServer)
}
21 changes: 21 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,27 @@ services:
- "$AWS_SECRET_ACCESS_KEY"
- "--aws-region"
- "$AWS_DEFAULT_REGION"
release:
build: .
image: terrarium:dev
container_name: terrarium-release
environment:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_DEFAULT_REGION
#- OTEL_EXPORTER_OTLP_ENDPOINT
ports:
- 50007:3001
networks:
- terrarium
command:
- publish
- "--aws-access-key-id"
- "$AWS_ACCESS_KEY_ID"
- "--aws-secret-access-key"
- "$AWS_SECRET_ACCESS_KEY"
- "--aws-region"
- "$AWS_DEFAULT_REGION"
networks:
terrarium:
name: terrarium
24 changes: 24 additions & 0 deletions internal/release/services/release/release.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package release

import (
releaseSvc "github.com/terrariumcloud/terrarium/internal/release/services"
"google.golang.org/grpc"
)

type ReleaseService struct {
releaseSvc.UnimplementedPublisherServer
// Db storage.DynamoDBTableCreator
// Table string
// Schema *dynamodb.CreateTableInput
}

// Registers ReleaseService with grpc server
func (s *ReleaseService) RegisterWithServer(grpcServer grpc.ServiceRegistrar) error {
// if err := storage.InitializeDynamoDb(s.Table, s.Schema, s.Db); err != nil {
// return ReleaseTableInitializationError
// }

releaseSvc.RegisterPublisherServer(grpcServer, s)

return nil
}

0 comments on commit 5c75715

Please sign in to comment.