DA_FOREGROUND_CUSTOMBUILD does not work

bbytes

Verified User
Joined
Feb 2, 2010
Messages
13
Somehow DA_FOREGROUND_CUSTOMBUILD environment variable does not work. Running setup like:

DA_FOREGROUND_CUSTOMBUILD=true ./setup.sh <client_id> <license_id> <interface> <ip address>

will install custombuild options in the background. We have an options.conf placed in a empty /usr/local/directadmin/custombuild with all the settings we need for the build.

We tested this part of the setup in a bash script (test.sh) and it works without a problem.
if [ -z "${DA_FOREGROUND_CUSTOMBUILD}" ]; then
echo "DA_FOREGROUND_CUSTOMBUILD=false"
else
echo "DA_FOREGROUND_CUSTOMBUILD=true"
fi

[srv1 ~]# DA_FOREGROUND_CUSTOMBUILD=true ./test.sh
DA_FOREGROUND_CUSTOMBUILD=true


But somehow in the setup.sh it does not work. Everytime we run "DA_FOREGROUND_CUSTOMBUILD=true ./setup.sh", custombuild runs in the background and shows the echo line "You will receive a message in the DirectAdmin panel when background installation finalizes."

Because we use ansible to deploy DA on remote hosts, we need to monitor the progress of the custombuild.

----------
setup.sh custombuild part

${DA_PATH}/custombuild/build update >> ${DA_PATH}/custombuild/install.txt 2>&1 &
if [ -z "${DA_FOREGROUND_CUSTOMBUILD}" ]; then
${DA_PATH}/custombuild/build all d >> ${DA_PATH}/custombuild/install.txt 2>&1 &
echogreen "You will receive a message in the DirectAdmin panel when background installation finalizes."
else
${DA_PATH}/custombuild/build all d | tee ${DA_PATH}/custombuild/install.txt
fi
 
Last edited:
You don't need UID and LID anymore but your license key, this can be found in your customer portal, if you don't know it, use the /auto switch.

If you don't use a script, as far as I understood, the commandline options should be place behind the setup.sh if you don't per export them to a script.

So try like this:
./setup.sh <license KEY> DA_FOREGROUND_CUSTOMBUILD=true
 
Thanks for the reply!
Running it your way gives DA_FOREGROUND_CUSTOMBUILD=no
Running it my way gives DA_FOREGROUND_CUSTOMBUILD=true

And in both instances Custombuild still builds in the background.

----------------

src]# ./setup.sh <lic> DA_FOREGROUND_CUSTOMBUILD=true
.
[setup.sh] Welcome to DirectAdmin installer!

[setup.sh] Using these parameters for the installation:
License Key: <lic>
DA_CHANNEL: current
DA_EMAIL: admin@web01
DA_HOSTNAME: web01
DA_NS1: ns1.
DA_NS2: ns2.
DA_SKIP_FASTEST: no
DA_SKIP_CSF: no
DA_SKIP_MYSQL_INSTALL: no
DA_SKIP_SECURE_PHP: no
DA_SKIP_CUSTOMBUILD: no
DA_INTERACTIVE_CUSTOMBUILD: no
DA_FOREGROUND_CUSTOMBUILD: no

......
[setup.sh] You will receive a message in the DirectAdmin panel when background installation finalizes.


----------
my way

src]# DA_FOREGROUND_CUSTOMBUILD=true ./setup.sh <lic>
.
[setup.sh] Welcome to DirectAdmin installer!

[setup.sh] Using these parameters for the installation:
License Key: <lic>
DA_CHANNEL: current
DA_EMAIL: admin@web01
DA_HOSTNAME: web01
DA_NS1: ns1
DA_NS2: ns2
DA_SKIP_FASTEST: no
DA_SKIP_CSF: no
DA_SKIP_MYSQL_INSTALL: no
DA_SKIP_SECURE_PHP: no
DA_SKIP_CUSTOMBUILD: no
DA_INTERACTIVE_CUSTOMBUILD: no
DA_FOREGROUND_CUSTOMBUILD: true

.....

[setup.sh] You will receive a message in the DirectAdmin panel when background installation finalizes.
 
Yes we tried 1 and yes. But if you look at the if statement, it only checks if the variable has a value and it does not matter what it is.

alpha Channel? Really? Thats just great! :-( We will use an old setup.sh and rewrite our ansible playbooks for the remainding 20+ webserver we have to deploy.
 
Ugh. I hate the new installing method. Not only does our automated DA server setup script does not work anymore; the new License Key cannot be used/entered and therefor is not used and stops the automated install, but also options do not work as the TS mentioned (DA_FOREGROUND_CUSTOMBUILD). Seems you have to use Alpha stuff in order to get this working? :S

I really do not understand why these things have to change. Now we have to hire someone to redo the complete code and look into the issue that it will not use the LK correctly/completely. Sigh. DA is costing us money. Oh well...
 
Looks like this works now in the "current" channel, I just ran an install (via ansible) today. My task is:

YAML:
- name: "Run DirectAdmin setup | This will take a while"
  shell:
    cmd: "./setup.sh {{ directadmin__license_key }} >/var/log/ansible-da-custombuild/da_setup.sh.{{ ansible_date_time.iso8601 }}.log 2>&1"
    chdir: "{{ directadmin__setup_sh_path }}"
    creates: "{{ directadmin__config_path }}"
  environment:
    DA_EMAIL: "{{ directadmin__admin_email_address }}"
    DA_NS1: "{{ directadmin__primary_name_server }}"
    DA_NS2: "{{ directadmin__secondary_name_server }}"
    DA_SKIP_CSF: "true"
    DA_FOREGROUND_CUSTOMBUILD: "true"

setup.sh reported this when started:

Code:
[setup.sh] Using these parameters for the installation:
                License Key: <redacted>
                 DA_CHANNEL: current
                   DA_EMAIL: <redacted>
                DA_HOSTNAME: <redacted>
                     DA_NS1: <redacted>
                     DA_NS2: <redacted>
            DA_SKIP_FASTEST: no
                DA_SKIP_CSF: true
      DA_SKIP_MYSQL_INSTALL: no
         DA_SKIP_SECURE_PHP: no
        DA_SKIP_CUSTOMBUILD: no
 DA_INTERACTIVE_CUSTOMBUILD: no
  DA_FOREGROUND_CUSTOMBUILD: true

After Directadmin itself has been installed, it outputs the following:

Code:
DirectAdmin should be accessible now
If you cannot connect to the login URL, then it is likely that a firewall is blocking port 2222. Please see:
  https://docs.directadmin.com/directadmin/general-usage/troubleshooting-da-service.html#cannot-connect-to-da-on-port-2222
######################################################################## 100.0%
CustomBuild installation has started, you may check the progress using the following command: tail -f /usr/local/directadmin/custombuild/install.txt
Adding system user `webapps' (UID 111) ...
Adding new group `webapps' (GID 118) ...
Adding new user `webapps' (UID 111) with group `webapps' ...
<and so on>

The build is logged into the file install.txt as mentioned, but also to stdout of the current process, so the custombuild is running in foreground as expected.
 
To clarify, we wrote an unofficial Ansible module which will be taking care of this too. It also allows you to dynamically preset all environment variables for CustomBuild. It would be cool if we could share some knowledge on this every now and then.

We do have budget for some specific things we'd like to tackle in our module if people are interested, like managing the admin users and reseller/user packages. I think it will benefit others too.

The package is open source as is most of the software we make:
 
Back
Top