- Open Service Broker Framework (by evoila)
- Components
- Configuring a Service Broker
- Service Keys
- Backup Agent
- Development
- Local Deployment
- Open Service Broker API Features
- IDE & Runtime
- Contribution
- License
The Backup Manager is a component provided with the evoila OSB Framework in the Enterprise Package. It enables to schedule automatic backups of any endpoint. That means,each endpoint that has a concrete implementation in the osb-backup-manager
enables customers/developers to do automatic backups of their Service Instances.
To enable the Backup Connector configuration wise, the Service Broker needs to be deployed with the following settings:
backup:
enabled: true
catalog:
services:
plans:
- name: xs
...
metadata:
backup:
enabled: true
instance_group: postgres
- enabled: if set to true it is enabled for the specific plan.
- instance_group: the instance group the osb-backup-manager is connection to, to execute the backups.
Note: please be aware, that the communication to schedule the backup jobs is done via RabbitMQ. That means, an existing RabbitMQ configuration must exist. Refer to Basic Service Broker configuration for that.
To set the backup functionality for the instance group, configured in the metadata of a plan, use the method
protected ServerAddress toServerAddress(Vm vm, int port, Plan plan)
Example:
@Service
@ConditionalOnBean(BoshProperties.class)
public class MyBoshPlatformService extends BoshPlatformService {
@Override
protected void updateHosts(ServiceInstance serviceInstance, Plan plan, Deployment deployment) {
List<Vm> vms = super.getVms(serviceInstance);
if (serviceInstance.getHosts() == null)
serviceInstance.setHosts(new ArrayList<>());
serviceInstance.getHosts().clear();
vms.forEach(vm -> serviceInstance.getHosts().add(super.toServerAddress(vm, 1234, plan)));
}
}
The Backup Connector is a component
@Service
@ConditionalOnBean(BackupTypeConfiguration.class)
public class BackupCustomServiceImpl implements BackupCustomService {
BackupTypeConfiguration backupTypeConfiguration;
ServiceInstanceRepository serviceInstanceRepository;
PostgresCustomImplementation postgresCustomImplementation;
ServiceDefinitionRepository serviceDefinitionRepository;
public BackupCustomServiceImpl(BackupTypeConfiguration backupTypeConfiguration,
ServiceInstanceRepository serviceInstanceRepository,
PostgresCustomImplementation postgresCustomImplementation,
ServiceDefinitionRepository serviceDefinitionRepository) {
this.backupTypeConfiguration = backupTypeConfiguration;
this.serviceInstanceRepository = serviceInstanceRepository;
this.postgresCustomImplementation = postgresCustomImplementation;
this.serviceDefinitionRepository = serviceDefinitionRepository;
}
@Override
public Map<String, String> getItems(String serviceInstanceId) throws ServiceInstanceDoesNotExistException,
ServiceDefinitionDoesNotExistException {
ServiceInstance instance = this.validateServiceInstanceId(serviceInstanceId);
Plan plan = serviceDefinitionRepository.getPlan(instance.getPlanId());
PostgresDbService postgresDbService = postgresCustomImplementation.connection(instance, plan);
Map<String, String> result = new HashMap<>();
try {
Map<String, String> databases = postgresDbService.executeSelect("SELECT datname FROM pg_database", "datname");
for(Map.Entry<String, String> database : databases.entrySet())
result.put(database.getValue(), database.getValue());
} catch(SQLException ex) {
new ServiceBrokerException("Could not load databases", ex);
}
return result;
}
}