Try PubSub+

How to copy files to/from a Solace broker

uherbstuherbst Member, Employee Posts: 18 Solace Employee
edited October 15 in Tips and Tricks

This looks like a frequently asked question - so I try to list all options to transfer files to/from a Solace broker.

Why do you need to transfer files ? This list are just some of the frequent use cases.

  • upload certificates (server cert, CA chains) to the broker
  • Download configuration backup files from the broker
  • upload script files to the broker
  • Download log files from the broker

copy from the Solace CLI to the outside world

To do that, you have to be logged in the CLI.

    ena
    copy logs/event.log scp://[email protected]_or_ip/tmp
    copy logs/event.log sftp://[email protected]_or_ip/tmp
    copy scp://[email protected]_or_ip/create.cli cliscripts/
    copy sftp://[email protected]_or_ip/create_cli cliscripts/

This solution works for appliances and software brokers, as long as you have access to the cli.

copy from somewhere outside into broker via scp/sftp

scp -P 2222 somefile.cli [email protected]_of_docker:cliscripts/

Keep in mind:

This solution works for appliances and software brokers, as long as you have access to the ssh port.

Copy to the Docker Container

docker cp somefile.cli solace:/usr/sw/jail/cliscripts

Keep in mind:

  • this command assumes, that your container is named "solace"
  • the "cliscripts"-directory in the cli is mapped to "/usr/sw/jail/cliscripts" inside the container

This solution does not work for appliances, just for dockerized brokers. You need access to the docker host and you need access to docker commands

Map docker containter volumes to the Host system

It is recommended (eg for better update-ability) to map the solace filesystems to the docker host.
You can check that with:
docker inspect solace

Check the "mounts"-section in the output.
Often, you can see something like that:

       {
            "Type": "bind",
            "Source": "/opt/solace/jail",
            "Destination": "/usr/sw/jail",
            "Mode": "",
            "RW": true,
            "Propagation": "rprivate"
        },

Here, the /usr/sw/jail directory inside the container is mapped to /opt/solace/jail on the docker host.
On the docker host, you can just copy files like this:

cp xxx.cli /opt/solace/jail/cliscripts

You can even copy from outside:

scp xxx.cli [email protected]:/opt/solace/jail/cliscripts

This solution does not work for appliances, just for dockerized brokers with named mapping for docker volumes. You need access to the docker host.

Comments

  • marcmarc Member, Administrator, Moderator, Employee Posts: 194 admin

    Awesome, thanks @uherbst! This will post will definitely come in handy for me :)

  • TomFTomF Member, Employee Posts: 116 Solace Employee

    @uli A great article. One point to add is that you have to create a "file transfer" user account. For instance, to do:
    scp -P 2222 somefile.cli [email protected]_of_docker:cliscripts/
    You'll need to have an account with name "filetransfer" created with file transfer permissions. See Configuring File Transfer User Accounts for more details.

  • CloudGodCloudGod Member Posts: 9
    edited October 14

    Excellent post! Thanks.
    BTW, i think it's also better to use docker cp to copy the certificates into the broker instead of using sftp (as per the Solace documentation - Managing Server Certificates).

    docker cp mycert.pem solace:/usr/sw/jail/certs
    
  • TomFTomF Member, Employee Posts: 116 Solace Employee

    Good point @CloudGod, the only point being the sftp method works no matter where the broker is deployed, whereas docker cp only works with docker. That's why I tend to use sftp.

Sign In or Register to comment.