Correctly Implementing Complex commands in systemd unit file of containers for ns8 Apps

Hello @stephdl,

What would be the best way to run complex commands such as the one below, in the system file of a ns8 app.

How we do it currently is that we append the command Infront of the ${_IMAGE} command

However i feel it might not be really the best way to do this.

      - >
        wait-for-it -t 120 db:3306;
        wait-for-it -t 120 redis-cache:6379;
        wait-for-it -t 120 redis-queue:6379;
        wait-for-it -t 120 redis-socketio:6379;
        export start=`date +%s`;
        until [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".db_host // empty"` ]] && \
          [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_cache // empty"` ]] && \
          [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_queue // empty"` ]];
          echo "Waiting for sites/common_site_config.json to be created";
          sleep 5;
          if (( `date +%s`-start > 120 )); then
            echo "could not find sites/common_site_config.json with required keys";
            exit 1
        echo "sites/common_site_config.json found";
        bench new-site frontend --no-mariadb-socket --admin-password=${ADMIN_PASSWORD} --db-root-password=admin --install-app erpnext --set-default;

This is in relation to this geniusdynamics/ns8-erp-next (

ERPnext is a wonder ERP solution, however due to its complexities and complex components, it makes it much harder to deploy correctly, and update on a server.

Our Effort is to bring ERPnext as a Prodcution Level NS8 App eployment for Small and LArge businesses that have more complex needs for an ERP

When I have many things to do in a systemd ExecStartPre= command I write an executable script.

For example:

1 Like