To create a universal connector when requesting data from mobile device from source, create a Docker container:
On mobile platform server when using standalone configuration of Foresight Mobile Platform.
In cluster when using cluster configuration of Foresight Mobile Platform.
To create a Docker component on a mobile platform server:
Develop the Docker container image that converts input requests to a valid data source format, and compile it.
Create a *.yml configuration file file to start the universal connector using the docker-compose utility, for example:
```yaml
version: '3.4'
services:
custom-connector:
image: <docker-registry>/<connector-repository>:<tag>
restart: always
networks:
- backend
```
NOTE. A universal connector and a mobile platform server should be started within the same network. Specify this network as a value of the networks attribute.
Start the Docker container using the created configuration file:
If a mobile platform server is running, execute the command:
docker-compose -f <configuration file name>.yml up
If mobile platform server is not running, execute the command to start the Docker container (universal connector) and mobile platform server at the same time:
docker-compose -f docker-compose.standalone.yml -f <configuration file name>.yml up
TIP. It is recommended to start the Docker container and mobile platform server at the same time. If required, one can place a Docker container on a dedicated server or a data source server and start it manually.
After executing the operations the Docker container is created on mobile platform server, which is started at the same time with the server. Next, proceed to setting up a JSON or WEB data source connection.
To create the Docker container in a cluster:
Develop the Docker container image that converts input requests to a valid data source format, and compile it.
Create a *.yml configuration file to start the universal connector using the Docker container image, for example:
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: custom-connector
spec:
selector:
matchLabels:
app: custom-connector
replicas: 2
template:
metadata:
labels:
app: custom-connector
spec:
containers:
- name: custom-connector
image: <docker-registry>/<connector-repository>:<tag>
ports:
# specify used port
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: custom-connector
labels:
app: custom-connector
spec:
type: LoadBalancer
ports:
# specify port in use
- port: 8080
selector:
app: custom-connector
```
Start the Docker container image:
kubectl apply -f <configuration file name>.yaml
To start the Docker image in OpenShift, observe the following conditions:
The root user is not used in the Docker container image.
Files on the disk are included in the root group.
NOTE. The universal connector and the cluster should be started in the same namespace. For details see the kubernetes documentation.
The Docker container image will be created and started in the cluster after executing the operations. Next, proceed to setting up a JSON or WEB data source connection.
See also:
Creating a Universal Data Source Connector | Setting Up JSON Data Source Connection | Setting Up WEB Data Source Connection