Updated Installation (markdown)
[buildfarm-client-wiki.git] / Installation.md
index 22f1ce60725ee1d734fc93aa9686ebc9f62e9508..61c6a0a74e4261d5a77db87e1dcd0105e7d56948 100644 (file)
@@ -31,6 +31,24 @@ This will create the repo checkout in the directory *~/code/*.
 16. If you can get past each of these steps, then your build farm system meets the minimum requirements.
 17. The official process can be kicked off by running `/home/farm/code/run_cron.sh --run-all`.  This will run the default build configuration, keep track of the git repository status, and upload the build results to the server.
 18. Once that command runs with no complaints, add it to the **farm** user crontab.  You can run it at whatever frequency you choose, I suggest 1 hour.  If a previous instantiation is still running, the script will detect the lockfile and exit so as not to step on each other.
+19. I had a problem running the *run_cron.sh* script in that cron gives a highly sanitized path to the script when it runs it.  I made a second wrapper script to call the first one so I could put path elements in that were needed:
+<pre><code>$ more /home/farm/bin/build_farm.sh
+#!/bin/bash
+export PATH="/usr/local/bin:/sbin:/usr/sbin:$PATH"
+$HOME/code/run_cron.sh --run-all $@
+</code></pre>
+Then I make my cronjob call: `6 * * * * $HOME/bin/build_farm.sh` .... but ...
+20. My cronjob ran great for a couple weeks.  Then another problem popped up running the cron job in that the test portion suddenly started failing with an odd error:
+<pre><code>** runtest error: Failed to open /dev/tty: No such device or address</code></pre>
+This is not a sudo issue.  This is happening because the cron daemon does not give a tty to the cronjob that it starts.  (How the heck did it ever work?)  The runtest script needs a tty in normal operation.  To fix this, I used an old trick of ssh'ing to localhost with the *-tt* option to **force** allocation of a local tty when starting the *build_farm.sh* script.  To do this, you need to configure the **farm** user to use key-based authentication with its own key.  Assuming you have not generated an ssh key yet:
+<pre><code># Press Enter to use defaults for all questions in
+# next command, including no password
+ssh-keygen -t dsa
+cat .ssh/id_dsa.pub >> .ssh/authorized_keys
+# Do the following command once to accept the new host key
+ssh farm@localhost</code></pre>
+Once that works properly, then the cron command changes to:
+<pre><code>6 * * * * ssh -tt farm@localhost $HOME/bin/build_farm.sh</code></pre>
 
 ## Multiple build clients on one machine
 As mentioned above, you can start at step 9.  A second application must be filled out to put the appropriate data in the database because this is treated a separate BuildFarm client: