🎄 Happy Holidays! 🥳

Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.

Happy Holidays!

Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.

Automatically run cli script during/after docker startup

jfg1306
jfg1306 Member Posts: 14 ✭✭

Hello,

is there a place or option somewhere that allows us to automatically run CLI scripts right after the startup completed ?

The idea comes from PostgreSQL where you can create .sql files and place them in a specific path (here initdb.d) and they will get automatically executed.

[...]

If you would like to do additional initialization in an image derived from this one, add one or more *.sql*.sql.gz, or *.sh scripts under /docker-entrypoint-initdb.d (creating the directory if necessary). After the entrypoint calls initdb to create the default postgres user and database, it will run any *.sql files, run any executable *.sh scripts, and source any non-executable *.sh scripts found in that directory to do further initialization before starting the service.

[...] (postgres - Official Image | Docker Hub)

We are aware that we can execute the CLI scripts either manually inside the instance or from the outside through docker exec.

Greetings,

Filip.

Best Answer

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 963 admin
    #2 Answer ✓

    Hi @jfg1306,

    There is currently not a way to automatically run CLI scripts, but I always thought it would be a cool feature so if you feel strongly about it please request it via support ;)

    As it stands, two common options for configuration are triggering the scripts as you have noted, or using SEMP to perform your configuration. Either way I'd recommend a SEMP call before executing either to check that the container is up and running :)

Answers

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 963 admin
    #3 Answer ✓

    Hi @jfg1306,

    There is currently not a way to automatically run CLI scripts, but I always thought it would be a cool feature so if you feel strongly about it please request it via support ;)

    As it stands, two common options for configuration are triggering the scripts as you have noted, or using SEMP to perform your configuration. Either way I'd recommend a SEMP call before executing either to check that the container is up and running :)