After installing CSE please follow the steps below to run it as a service.
Create cse.sh file
Create cse.service file. You can copy the following code or create new one based on following link.
container-service-extension/cse.sh at master · vmware/container-service-extension (github.com)
# vi /opt/vmware/cse/cse.sh
#!/usr/bin/env bash
export CSE_CONFIG=/opt/vmware/cse/encrypted-config.yaml
export CSE_CONFIG_PASSWORD=<passwd>
cse run
Copy encrypted-config.yaml to /opt/vmware/cse directory.
Change the file permission
chmod +x /opt/vmware/cse/cse.sh
Create cse.service file
Create cse.service file. You can copy the following code or create new one based on following link.
container-service-extension/cse.service at master · vmware/container-service-extension (github.com)
vi /etc/systemd/system/cse.service
[Unit]
Description=Container Service Extension for VMware Cloud Director
[Service]
ExecStart=/opt/vmware/cse/cse.sh
User=root
WorkingDirectory=/opt/vmware/cse
Type=simple
Restart=always
[Install]
WantedBy=default.target
Enable and start the service
# systemctl enable cse.service
# systemctl start cse.service
Check the service status
# systemctl status cse.service
cse.service - Container Service Extension for VMware Cloud Director
Loaded: loaded (/etc/systemd/system/cse.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2021-11-24 14:43:56 +01; 1min 9s ago
Main PID: 770 (bash)
CGroup: /system.slice/cse.service
├─770 bash /opt/vmware/cse/cse.sh
└─775 /usr/local/bin/python3.7 /usr/local/bin/cse run
Nov 24 14:44:06 cse01.lab.com cse.sh[770]: Validating CSE installation according to config file
Nov 24 14:44:06 cse.sh[770]: MQTT extension and API filters found
Nov 24 14:44:06 cse01.lab.com cse.sh[770]: Found catalog 'cse-site1-k8s'
Nov 24 14:44:06 cse01.lab.com cse.sh[770]: CSE installation is valid
Nov 24 14:44:06 cse01.lab.com cse.sh[770]: Started thread 'MessageConsumer' (140229531580160)
Nov 24 14:44:06 cse01.lab.com l cse.sh[770]: Started thread 'ConsumerWatchdog' (140229523187456)
Nov 24 14:44:06 cse01.lab.com cse.sh[770]: Container Service Extension for vCloud Director
Nov 24 14:44:06 cse01.lab.com cse.sh[770]: Server running using config file: /opt/vmware/cse/encrypted-config.yaml
Nov 24 14:44:06 cse01.lab.com cse.sh[770]: Log files: /root/.cse-logs/cse-server-info.log, /root/.cse-logs/cse-server-debug.log
Nov 24 14:44:06 cse01.lab.com cse.sh[770]: waiting for requests (ctrl+c to close)