Docker and Configuration Files (Backup/Restore)

Stu Shepherd
Stu Shepherd Member Posts: 6
edited January 2023 in PubSub+ Event Broker #1

Hi all, Am semi-new to Solace but wanting to ensure it is solid and stable from the start, even during my early testing...

Have successfully deployed Solace within AWS using Autoscaling group (1 of 1) to an EC2 behind a load balancer - all pretty standard server items.

However i am struggling to find how to either launch the Docker using a pre-created configuration.

I believe i can login to the console manually... run the 'backup' command which exports the file to the jail folder. This then can be used to restore my config...

I am looking for an automated method to start the docker using a backed up config (so all queues etc are re-imported in event of failure).

Additionally on top of this, i have seen i can schedule a backup task to run the backup like a crontab task within Solace. Are there any auto methods for say backing upto S3 or will i be better of writing my own script to copy the backup files in the jail folder to s3 ?


Have tested the logic (since asking Q and the logic i am looking to apply works manually):


Log into Solace via 8080, create custom VPN

  • docker exec -it <containerid> /usr/sw/loads/currentload/bin/cli -A
  • enable
  • backup
  • exit, exit
  • aws s3 cp /mnt/solace/jail/configs/backup s3://<s3bucket>/backup
  • <Reboot the server, simulating ec2 crash>


  • Ec2 Autostart initialises Docker and runs solace, SSM into EC2:
  • aws s3 cp s3://<s3bucket>/backup /mnt/solace/jail/configs/backup
  • docker exec -it <containerid> /usr/sw/loads/currentload/bin/cli -A
  • enable
  • reload config backup.solace (Click Yes)
  • exit, exit
  • Solace will load backup causing solace to stop the docker
  • Relaunch the docker container: docker start solace

Check solace via 8080 and ensure custom VPN present, it was!


Thank you.

Answers

  • Stu Shepherd
    Stu Shepherd Member Posts: 6
    edited January 2023 #2

    Added comment above ^^

  • uherbst
    uherbst Member, Employee Posts: 129 Solace Employee

    Hi @Stu Shepherd,

    there is currently no option to add a base configuration (neither from CLI script nor from binary backup) to a docker startup.

    Most users today implement some kind of configuration automation with ansible or terraform (I even saw it with puppet) or with self-created SEMP calls.

    Basically, it's all the same: after starting the broker, you just run your code to inject your configuration into that broker.


    Uli

  • Stu Shepherd
    Stu Shepherd Member Posts: 6

    Hi @uherbst , That seems to be all i can find to go on... Could i ask what kind of docker commands can be run externally ? All the ones i see require login to the console before then typing the commands... i.e. Do you know how i can call the 'backup' function from script, outside of the docker?

    Thanks in advance :)

  • Stu Shepherd
    Stu Shepherd Member Posts: 6

    Hi all again, have been looking into SEMP today and struggling to see where the API i can call commands post execute... i.e. backup or reload etc. Any clue on what i am missing? Thank you

  • Stu Shepherd
    Stu Shepherd Member Posts: 6

    Hi again all, @uherbst ,

    Think i have found my solution from another post:

    From the command line i can create a sh script to perform the backup:

    #!/bin/bash
    sudo tee /mnt/solace/jail/cliscripts/script-backup.cli <<-EOF
    enable
    backup
    exit
    exit
    EOF
    
    docker exec -it solace /usr/sw/loads/currentload/bin/cli -A -s script-backup.cli
    
    aws s3 cp /mnt/solace/jail/configs/backup s3://<s3bucket>/backup
    

    Question for the solace professionals.. any concerns / downsides to running this bash script?


    Thanks