Skip to main content
Version: Weekly Build

Managed Services

Every service offered through the Managed Services section is configured as an individual Managed Service Provider in the codesphere.managedServices array in config.yaml. The configuration follows a specific schema.

Managed Service Providers can be external to Codesphere (an external API is called), but there are also built-in Managed Services, where the provider runs within Codesphere. With the current release there is one such provider, for PostgreSQL.

Codesphere comes with a set of preconfigured providers. To enable any of them, specify name and version:

# /etc/codesphere/config.yaml
codesphere:
# ... other configuration
managedServices:
- name: postgres
schemaVersion: v1
- name: babelfish
schemaVersion: v1
- name: s3
schemaVersion: v1
- name: virtualK8sV1
schemaVersion: v1

If you use any of those providers, ensure the respective backend is also enabled in the managedServiceBackends section:

# /etc/codesphere/config.yaml
managedServicesBackends:
postgres: # This single backend serves both postgres and babelfish
enabled: true
barmanCloudPlugin: # Needs to be enabled for database backups to work
enabled: true
s3:
enabled: true
k8sBackend:
enabled: true

Override properties

It is possible to override properties of the preconfigured providers. Here is an example of the PostgreSQL Managed Service Provider with partial overrides. We override the plans array to just have one single big plan.

# /etc/codesphere/config.yaml
codesphere:
# ... other configuration
managedServices:
- name: postgres
schemaVersion: v1
plans:
- id: 0
description: Only one big plan
name: Big
parameters:
storage:
pricedAs: storage-mb
schema:
description: Storage (MB)
type: integer
default: 1000000
readOnly: false
cpu:
pricedAs: cpu-tenths
schema:
description: CPU Tenths
type: number
default: 50
readOnly: true
memory:
pricedAs: ram-mb
schema:
description: Memory (MB)
type: integer
default: 8000
readOnly: true
# ... other providers

Here you can find the full configuration of the PostgreSQL Managed Service Provider:

Full example: the PostgreSQL Managed Service Provider
# /etc/codesphere/config.yaml
codesphere:
managedServices:
- name: postgres
schemaVersion: v1
backend:
api:
endpoint: "http://ms-backend-postgres.postgres-operator:3000/api/v1/postgres"
author: Codesphere
category: Database
displayName: PostgreSQL
# Set to true to allow only one non-deleted service per team for this provider version.
# teamSingleton: true
iconUrl: /ide/assets/managed-services/postgresql.svg
configSchema:
type: object
properties:
version:
type: string
description: Version of the Postgres DB. Includes pre-installed extensions compatible with this version. Extension versions are managed and cannot be customized.
enum:
- '17.6'
- '16.10'
default: '17.6'
readOnly: false
userName:
type: string
default: app
pattern: '^(?!postgres$)'
databaseName:
type: string
default: app
required: []
additionalProperties: false
detailsSchema:
type: object
properties:
port:
type: integer
hostname:
type: string
dsn:
type: string
ready:
type: boolean
required:
- port
- hostname
- dsn
- ready
additionalProperties: false
secretsSchema:
type: object
properties:
userPassword:
type: string
format: password
superuserPassword:
type: string
format: password
required:
- userPassword
- superuserPassword
additionalProperties: false
description: >-
Open-source database system tailored for efficient data management and
scalability. Deployed on Codesphere using the CNPG K8s Operator.
plans:
- id: 0
description: 0.5 vCPU / 500 MB Memory
name: Small
parameters:
storage:
pricedAs: storage-mb
schema:
description: Storage (MB)
type: integer
default: 10000
readOnly: false
cpu:
pricedAs: cpu-tenths
schema:
description: CPU Tenths
type: number
default: 5
readOnly: true
memory:
pricedAs: ram-mb
schema:
description: Memory (MB)
type: integer
default: 500
readOnly: true
- id: 1
description: 1 vCPU / 1 GB Memory
name: Medium
parameters:
storage:
pricedAs: storage-mb
schema:
description: Storage (MB)
type: integer
default: 25000
readOnly: false
cpu:
pricedAs: cpu-tenths
schema:
description: CPU Tenths
type: number
default: 10
readOnly: true
memory:
pricedAs: ram-mb
schema:
description: Memory (MB)
type: integer
default: 1000
readOnly: true
- id: 2
description: 1 vCPU / 2 GB Memory
name: Medium High-Mem
parameters:
storage:
pricedAs: storage-mb
schema:
type: integer
default: 25000
readOnly: false
cpu:
pricedAs: cpu-tenths
schema:
type: number
default: 10
readOnly: true
memory:
pricedAs: ram-mb
schema:
type: integer
default: 2000
readOnly: true
- id: 3
description: 2 vCPU / 4 GB Memory
name: Large
parameters:
storage:
pricedAs: storage-mb
schema:
type: integer
default: 50000
readOnly: false
cpu:
pricedAs: cpu-tenths
schema:
type: number
default: 20
readOnly: true
memory:
pricedAs: ram-mb
schema:
type: integer
default: 4000
readOnly: true
- id: 4
description: 4 vCPU / 8 GB Memory
name: Extra Large
parameters:
storage:
pricedAs: storage-mb
schema:
type: integer
default: 150000
readOnly: false
cpu:
pricedAs: cpu-tenths
schema:
type: number
default: 40
readOnly: true
memory:
pricedAs: ram-mb
schema:
type: integer
default: 8000
readOnly: true

Adding your own Providers

You can also use the private cloud configuration file to statically provision providers that you implemented yourself.

Landscape-Based Providers

Landscape-Based Providers can simply be added to the managedServices array.

Full example: Statically provisioned custom Landscape-Based Provider
# /etc/codesphere/config.yaml
codesphere:
managedServices:
- name: mattermost
schemaVersion: v1
author: Your Team
displayName: Mattermost
iconUrl: https://example.com/mattermost-icon.png
category: collaboration
description: |
Open-source team messaging and collaboration platform.
Supports channels, direct messaging, and file sharing.
teamSingleton: true

backend:
landscape:
gitUrl: https://github.com/your-org/mattermost-landscape

configSchema:
type: object
properties:
SITE_NAME:
type: string
description: Display name for your Mattermost instance
default: mattermost
readOnly: false
MAX_USERS:
type: integer
description: Maximum number of users allowed
x-update-constraint: increase-only
required: ['MAX_USERS']

secretsSchema:
type: object
properties:
ADMIN_PASSWORD:
type: string
format: password

detailsSchema:
type: object
properties:
hostname:
type: string
port:
type: integer

plans:
- id: 0
name: Default Plan
description: Resource usage depends on the ci-profile of the landscape.
parameters: {}

versions:
1.0.0:
appVersion: Mattermost v33
ciProfile: prod
gitRef: release-tags/1-0-0
description: Long Term Support Release
# other providers ...

Rest-Based Providers

Rest-Based Providers are added to the managedService array in the same way as Landscape-Based Providers.

It is highly recommended that your REST-Backend authenticates requests using a bearer token. To share this token with Codesphere, you need to set it in the installer vault secrets:

# /home/<myuser>/secrets/prod.vault.yaml
secrets:
# ... other secrets
- name: managedServiceSecrets
fields:
# JSON array of objects
password: |-
[
{
"name": "postgres", # provider name (needs to match one of the names in the codesphere.managedServices array in the config.yaml)
"version": "v1" # provider version
"api": {
"secret": "Bearer MY-API-KEY-123123" # full authz header
}
}
]