serverfulfillment

package
v0.0.0-...-aa36cb2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const ServerFulfillmentCheckInterval = 30 * time.Second

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	TeamId                  string
	UserId                  string
	OfferingId              string
	LocationId              string
	StripeCheckoutSessionId string
	// in the future these might be configurable on a per-fulfillment basis
	// e.g. to put a new server into an existing cell
	// or to create a new cell that has custom dns
	CellName  string // defaults to default cell
	DnsZoneId string

	StepServerId              string
	StepPaymentReceived       bool
	StepProviderTransactionId string
	StepProviderServerId      string
	StepServerOnline          bool
	StepServerInstalled       bool
	StepTalosOnline           bool
	StepServerAddedToCell     bool
}

Message is sent as soon as a server is purchased. It takes care of the following: - creating the server object in the db - waiting for payment to be confirmed - ordering the server - waiting for the server to come online - setting up the server (installing Talos) If any of these steps involve waiting, then the logic will re-queue the message with a delay of 30s to check again later.

type MessageHandler

type MessageHandler struct {
	// contains filtered or unexported fields
}

func NewMessageHandler

func NewMessageHandler(opts ...MessageHandlerOption) (*MessageHandler, error)

func (MessageHandler) Handle

func (h MessageHandler) Handle(ctx context.Context, s Message) error

func (MessageHandler) ReQueue

func (h MessageHandler) ReQueue(ctx context.Context, s Message) error

type MessageHandlerOption

type MessageHandlerOption func(*MessageHandler) error

func WithCellStore

func WithCellStore(cellStore store.CellStore) MessageHandlerOption

func WithServerOfferingStore

func WithServerOfferingStore(serverOfferingStore store.ServerOfferingStore) MessageHandlerOption

func WithServerProviderHetzner

func WithServerProviderHetzner(serverProviderHetzner serverprovider.ServerProvider) MessageHandlerOption

func WithServerStore

func WithServerStore(serverStore store.ServerStore) MessageHandlerOption

func WithSshKeyBase64

func WithSshKeyBase64(sshKeyBase64 string) MessageHandlerOption

func WithSshKeyFingerprint

func WithSshKeyFingerprint(sshKeyFingerprint string) MessageHandlerOption

func WithSshKeyPassword

func WithSshKeyPassword(sshKeyPassword string) MessageHandlerOption

func WithStripeCheckoutSession

func WithStripeCheckoutSession(stripeCheckoutSession *session.Client) MessageHandlerOption

func WithTalosCellProvider

func WithTalosCellProvider(talosCellProvider *cellprovider.TalosClusterCellProvider) MessageHandlerOption

func WithTalosProviderHetzner

func WithTalosProviderHetzner(talosProviderHetzner *talosprovider.HetznerProvider) MessageHandlerOption

func WithTeamStore

func WithTeamStore(teamStore store.TeamStore) MessageHandlerOption

func WithUserStore

func WithUserStore(userStore store.UserStore) MessageHandlerOption

type StepBuyServer

type StepBuyServer struct {
	TransactionId *string
}

StepBuyServer buys the server and fills out the transaction ID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL