Skip to content

Commit

Permalink
refactor: remove unnecessary sections from resource definitions
Browse files Browse the repository at this point in the history
- Remove the section "Custom resource definitions"
- Remove the section "Versions CRD"
- Remove the section "Configuration CRD"
- Remove the section "Liveness check"

Signed-off-by: jdupas22 <[email protected]>
  • Loading branch information
jdupas22 committed Jul 6, 2023
1 parent aeea5e8 commit a1602f8
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 138 deletions.
138 changes: 0 additions & 138 deletions docs/docs/deployment/cloudprem/cluster-config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,150 +74,12 @@ Using Temporal is only required for stacks using the flows service. It can be om

The recommended way to spin up a Temporal deployment is through Temporal Cloud, or by using the official Temporal helm [chart](https://github.com/temporalio/helm-charts).

## Custom resource definitions

Two CRDs will be used by the Formance Operator to provision resources in our cluster: the configuration CRD, and the versions CRD.

### Versions CRD

The "Versions" CRD defines the versions that we want to deploy this allows the operator to provision the created stacks with a fixed set of versions for each stack service.

```yaml
# versions.crd.yml
apiVersion: stack.formance.com/v1beta3
kind: Versions
metadata:
name: default
spec:
auth: latest
control: latest
gateway: latest
ledger: latest
orchestration: latest
payments: latest
search: latest
wallets: latest
webhooks: latest
```

:::tip
Thanks to this CRD, you can also deploy a custom version of a service, including one you've modified yourself.
:::

Saving the CRD is as simple as running the following command:

```bash
kubectl apply -f versions.crd.yml
```

### Configuration CRD

The "Configuration" CRD defines the configuration of our application. This includes configuration settings such as listening ports, environment variables, and secrets.

```yaml
# configuration.crd.yaml
apiVersion: stack.formance.com/v1beta3
kind: Configuration
metadata:
name: stacks
spec:
broker:
nats:
url: NATS_URL
ingress:
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web
light: true
services:
auth:
postgres:
disableSSLMode: true
host: POSTGRESQL_HOST
port: POSTGRESQL_PORT
username: POSTGRESQL_USERNAME
password: POSTGRESQL_PASSWORD
control: {}
ledger:
postgres:
disableSSLMode: true
host: POSTGRESQL_HOST
port: POSTGRESQL_PORT
username: POSTGRESQL_USERNAME
password: POSTGRESQL_PASSWORD
orchestration:
postgres:
disableSSLMode: true
host: POSTGRESQL_HOST
port: POSTGRESQL_PORT
username: POSTGRESQL_USERNAME
password: POSTGRESQL_PASSWORD
payments:
encryptionKey: DEFAULT_ENCRYPTION_KEY
postgres:
disableSSLMode: true
host: POSTGRESQL_HOST
port: POSTGRESQL_PORT
username: POSTGRESQL_USERNAME
password: POSTGRESQL_PASSWORD
search:
batching:
count: 50
period: 1s
elasticSearch:
host: ELASTICSEARCH_URL
pathPrefix: ''
port: 443
scheme: https
tls: {}
wallets:
debug: false
dev: false
webhooks:
debug: false
dev: false
postgres:
disableSSLMode: true
host: POSTGRESQL_HOST
port: POSTGRESQL_PORT
username: POSTGRESQL_USERNAME
password: POSTGRESQL_PASSWORD
temporal:
address: TEMPORAL_ADDRESS
namespace: TEMPORAL_NAMESPACE
tls:
crt: TEMPORAL_TLS_CERT
key: TEMPORAL_TLS_KEY
```

Before saving the CRD, make sure to replace the following values with your own:

- `NATS_URL`: The URL of your NATS instance
- `POSTGRESQL_HOST`: The host of your PostgreSQL instance
- `POSTGRESQL_PORT`: The port of your PostgreSQL instance
- `POSTGRESQL_USERNAME`: The username of your PostgreSQL instance
- `POSTGRESQL_PASSWORD`: The password of your PostgreSQL instance
- `DEFAULT_ENCRYPTION_KEY`: The encryption key to use for the payments service
- `ELASTICSEARCH_URL`: The URL of your Elasticsearch instance

And the following values if you want to use Temporal:
- `TEMPORAL_ADDRESS`: The address of your Temporal instance
- `TEMPORAL_NAMESPACE`: The namespace of your Temporal instance
- `TEMPORAL_TLS_CERT`: The TLS certificate of your Temporal instance
- `TEMPORAL_TLS_KEY`: The TLS key of your Temporal instance

Saving the CRD is then simply done by running the following command:

```bash
kubectl apply -f configuration.crd.yml
```

## Summary

Before moving on to the next step, make sure that you have:

- Set up an ingress controller, with SSL enabled
- Installed cert-manager (or had it already installed)
- Deployed the required stateful dependencies
- Created the versions and configuration CRDs

With these steps completed, we can now move on to creating our very own Formance Cloud private region and deploying the Formance Operator.
137 changes: 137 additions & 0 deletions docs/docs/deployment/cloudprem/operator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,143 @@ helm upgrade --install regions oci://ghcr.io/formancehq/helm/regions \
--values region.values.yaml
```

## Custom resource definitions

Two CRDs will be used by the Formance Operator to provision resources in our cluster: the configuration CRD, and the versions CRD.

### Versions CRD

The "Versions" CRD defines the versions that we want to deploy this allows the operator to provision the created stacks with a fixed set of versions for each stack service.

```yaml
# versions.crd.yml
apiVersion: stack.formance.com/v1beta3
kind: Versions
metadata:
name: default
spec:
auth: latest
control: latest
gateway: latest
ledger: latest
orchestration: latest
payments: latest
search: latest
wallets: latest
webhooks: latest
```

:::tip
Thanks to this CRD, you can also deploy a custom version of a service, including one you've modified yourself.
:::

Saving the CRD is as simple as running the following command:

```bash
kubectl apply -f versions.crd.yml
```

### Configuration CRD

The "Configuration" CRD defines the configuration of our application. This includes configuration settings such as listening ports, environment variables, and secrets.

```yaml
# configuration.crd.yaml
apiVersion: stack.formance.com/v1beta3
kind: Configuration
metadata:
name: stacks
spec:
broker:
nats:
url: NATS_URL
ingress:
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web
light: true
services:
auth:
postgres:
disableSSLMode: true
host: POSTGRESQL_HOST
port: POSTGRESQL_PORT
username: POSTGRESQL_USERNAME
password: POSTGRESQL_PASSWORD
control: {}
ledger:
postgres:
disableSSLMode: true
host: POSTGRESQL_HOST
port: POSTGRESQL_PORT
username: POSTGRESQL_USERNAME
password: POSTGRESQL_PASSWORD
orchestration:
postgres:
disableSSLMode: true
host: POSTGRESQL_HOST
port: POSTGRESQL_PORT
username: POSTGRESQL_USERNAME
password: POSTGRESQL_PASSWORD
payments:
encryptionKey: DEFAULT_ENCRYPTION_KEY
postgres:
disableSSLMode: true
host: POSTGRESQL_HOST
port: POSTGRESQL_PORT
username: POSTGRESQL_USERNAME
password: POSTGRESQL_PASSWORD
search:
batching:
count: 50
period: 1s
elasticSearch:
host: ELASTICSEARCH_URL
pathPrefix: ''
port: 443
scheme: https
tls: {}
wallets:
debug: false
dev: false
webhooks:
debug: false
dev: false
postgres:
disableSSLMode: true
host: POSTGRESQL_HOST
port: POSTGRESQL_PORT
username: POSTGRESQL_USERNAME
password: POSTGRESQL_PASSWORD
temporal:
address: TEMPORAL_ADDRESS
namespace: TEMPORAL_NAMESPACE
tls:
crt: TEMPORAL_TLS_CERT
key: TEMPORAL_TLS_KEY
```

Before saving the CRD, make sure to replace the following values with your own:

- `NATS_URL`: The URL of your NATS instance
- `POSTGRESQL_HOST`: The host of your PostgreSQL instance
- `POSTGRESQL_PORT`: The port of your PostgreSQL instance
- `POSTGRESQL_USERNAME`: The username of your PostgreSQL instance
- `POSTGRESQL_PASSWORD`: The password of your PostgreSQL instance
- `DEFAULT_ENCRYPTION_KEY`: The encryption key to use for the payments service
- `ELASTICSEARCH_URL`: The URL of your Elasticsearch instance

And the following values if you want to use Temporal:
- `TEMPORAL_ADDRESS`: The address of your Temporal instance
- `TEMPORAL_NAMESPACE`: The namespace of your Temporal instance
- `TEMPORAL_TLS_CERT`: The TLS certificate of your Temporal instance
- `TEMPORAL_TLS_KEY`: The TLS key of your Temporal instance

Saving the CRD is then simply done by running the following command:

```bash
kubectl apply -f configuration.crd.yml
```

## Liveness check

We now have a private region running on our cluster let's check that it is active, and that it has successfully bind itself to the Formance Cloud control plane. We can do so by inspecting the region with fctl:
Expand Down

0 comments on commit a1602f8

Please sign in to comment.