Using SSH with containers

When your IBM MobileFirst™ Platform Foundation container is created with a Secure Shell (SSH) key and bound to a public IP address, a private key can be used to securely view and download the logs for each container instance.

Before you begin

Prerequisites for accessing your MobileFirst Server and MobileFirst Operational Analytics containers to get syslog and Liberty logs:

  • SSH must be enabled for the container.
  • Volume has been enabled so that the log files are persisted.
For container groups, a public IP address must be bound to each container instance to view the logs using SSH.

Procedure

  1. To enable SSH, copy the SSH public key to the package_root/[mfpf-server or mfpf-analytics]/usr/ssh folder before you run the prepareserver.sh or the prepareanalytics.sh scripts. This builds the image with SSH enabled. Any container created from that particular image will have the SSH enabled.

    If SSH is not enabled as part of the image customization, you can enable it for the container using the SSH_ENABLE and SSH_KEY arguments when executing the start-up scripts. You can optionally customize the related script .properties files to include the key content.

  2. Make an SSH request to the container. Example: mylocal-workstation# ssh -i ~/ssh_key_directory/id_rsa root@public_ip
  3. Archive the log file location. Example:
    • container_instance@root# cd /opt/ibm/wlp/usr/servers/worklight
    • container_instance@root# tar czf logs_archived.tar.gz logs/
  4. Download the log archive to your local workstation. Example: mylocal-workstation# scp -i ~/ssh_key_directory/id_rsa root@public_ip:/opt/ibm/wlp/usr/servers/worklight/logs_archived.tar.gz /local_workstation_dir/target_location/