The SSH deploy key isn't where this build expects it:
${deploy.keyfile}
If it already works from a different shell (e.g. WSL/git-bash) but not from
here, this is almost certainly the Windows-vs-WSL home directory split
described in xzpect-timer/build.xml's comments, not a missing key. Copy it
(and known_hosts, checked separately below) over from wherever it already
works, e.g. from a WSL bash shell:
mkdir -p /mnt/c/Users/<you>/.ssh
cp ~/.ssh/sportrum_key_new /mnt/c/Users/<you>/.ssh/
If you keep this key somewhere else entirely (e.g. alongside the sportrum
webapp project's confdir/), point deploy.keyfile at it in
build.local.properties instead of moving the file.
known_hosts isn't where this build expects it:
${deploy.knownhosts}
Same Windows-vs-WSL split as the deploy key above most likely applies here
too. Copy or append it over from wherever it already works (append, don't
overwrite, if the destination already has unrelated entries you want to
keep):
cat ~/.ssh/known_hosts >> /mnt/c/Users/<you>/.ssh/known_hosts
If this is truly the first time connecting to the target server from
anywhere, SSH in manually once first (e.g.
"ssh -p ${deploy.ssh.port} ${deploy.user}@<server>") and accept its host
key interactively — this build's scp/sshexec tasks deliberately don't
auto-trust unknown host keys.
This build's scp/sshexec targets need JSch on ANT'S OWN classpath, not just
this project's taskdef classpathref (see lib.build/README.md). Re-run with
-lib, e.g.:
ant -lib lib.build "deploy(@local.sportrum.se)"
Running from Eclipse instead? Add lib.build/jsch-*.jar under Window ->
Preferences -> Ant -> Runtime -> Classpath -> Ant Home Entries — same fix.
Available targets:
ant "install-scripts(@local.sportrum.se)" - sync upgrade.sh and friends to the server (does NOT run an upgrade)
ant "deploy(@local.sportrum.se)" - install-scripts(@local.sportrum.se), then run upgrade.sh, then verify the site responds
Before the FIRST run against any given server: ssh -p ${deploy.ssh.port} ${deploy.user}@<that server>
once, interactively (accept the host key, then Ctrl+D) so ${deploy.knownhosts}
already has it — these targets do not auto-trust unknown host keys.
Also run the sportrum webapp project's own "ant release-all" FIRST, against
the same server — it builds and uploads sportrum.war/manager.zip, which
upgrade.sh (run by the deploy target here) expects to already be sitting at
/home/sportrum/webapp/sportrum.war and /home/sportrum/manager.zip. This
project's build.xml never builds or uploads those itself.
install-scripts/deploy are deliberately separate steps, not one big
"deploy" that both syncs scripts and upgrades:
- install-scripts(@server) only uploads this repo's control scripts
(upgrade.sh, upgrade-cmds.sh, upgrade-funs.sh, tomcat_ctl.sh,
restart.sh) to ${deploy.remotepath} on the server. Nothing on the
server is touched otherwise — no Tomcat stop, no backup, no DB
migration.
- deploy(@server) runs install-scripts(@server) first (so the server is
always running this repo's current scripts, never a stale hand-copied
version), then sshexecs upgrade.sh itself, then checks the site
responds afterwards.
Because the upgrade is just upgrade.sh living on the server (at
${deploy.remotepath}), you don't need ant for it at all if you'd rather
not: run "ant install-scripts(@server)" whenever you like, then SSH in as
${deploy.user} and run "./upgrade.sh" (or "./restart.sh", for a plain
restart with no upgrade) yourself, at whatever moment you choose.
Adding a new server: add
<target name="install-scripts(@new-server-hostname)" description="...">
<upload-scripts host="new-server-hostname"/>
</target>
<target name="deploy(@new-server-hostname)" depends="install-scripts(@new-server-hostname)" description="...">
<run-upgrade host="new-server-hostname"/>
<verify-upgrade host="new-server-hostname"/>
</target>
below — the shared sportrum user/key/port above cover it already, nothing
else to configure here.