Skip to content

Commit

Permalink
implemented update function:
Browse files Browse the repository at this point in the history
after downloading a release using the download button on the status page
the user can choose any of the downloaded versions for a update.
this enables also a downgrade to a older version.
when the update button is pushed, yacy terminates, installes the choosen version
and restarts

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3948 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Jul 2, 2007
1 parent 21fabe2 commit 3421c64
Show file tree
Hide file tree
Showing 8 changed files with 147 additions and 116 deletions.
2 changes: 1 addition & 1 deletion build.properties
Expand Up @@ -3,7 +3,7 @@ javacSource=1.4
javacTarget=1.4

# Release Configuration
releaseVersion=0.534
releaseVersion=0.535
releaseFile=yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz
proReleaseFile=yacy_pro_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz
releaseFileParentDir=yacy
Expand Down
20 changes: 10 additions & 10 deletions htroot/Status.html
Expand Up @@ -148,35 +148,35 @@
</form>

#(candeploy)#::
<form action="Status.html" method="get">
<fieldset>
<legend>System Update</legend>
<dl>
<dt>Available Releases</dt>
<dd>&nbsp;<select name="releasedownload">
<dd><form action="Status.html" method="get">
&nbsp;<select name="releasedownload">
#{availreleases}#
<option #(selected)#::selected#(/selected)# value="#[url]#">#[name]#</option>
#{/availreleases}#
</select>
&nbsp;&nbsp;<button type="submit" name="downloadRelease" value="DownloadRelease">
<img src="/env/grafics/lock.gif" alt="" />
Download Release
</button><br>
</dd>
</button><br><br>
</form></dd>
<dt>Downloaded Releases</dt>
<dd>&nbsp;<select name="releaseinstall">
<dd><form action="Steering.html" method="get">
&nbsp;<select name="releaseinstall">
#{downloadedreleases}#
<option #(selected)#::selected#(/selected)# value="#[file]#">#[name]#</option>
#{/downloadedreleases}#
</select><!--
&nbsp;&nbsp;<button type="submit" name="installRelease" value="InstallRelease">
</select>#(deployenabled)#::no&nbsp;automated installation on development environments::
&nbsp;&nbsp;<button type="submit" name="update" value="InstallRelease">
<img src="/env/grafics/lock.gif" alt="" />
Install Release
</button> -->
</dd>
</button>#(/deployenabled)#
</form></dd>
</dl>
</fieldset>
</form>
#(/candeploy)#

<fieldset>
Expand Down
86 changes: 44 additions & 42 deletions htroot/Status.java
Expand Up @@ -158,8 +158,9 @@ else if (jobType.equals("globalCrawlTrigger"))
}

// version information
prop.put("versionpp", yacy.combined2prettyVersion(sb.getConfig("version","0.1")));

String versionstring = yacy.combined2prettyVersion(sb.getConfig("version","0.1"));
prop.put("versionpp", versionstring);
boolean devenvironment = versionstring.startsWith("dev");
double thisVersion = Double.parseDouble(sb.getConfig("version","0.1"));
// cut off the SVN Rev in the Version
try {thisVersion = Math.round(thisVersion*1000.0)/1000.0;} catch (NumberFormatException e) {}
Expand All @@ -168,11 +169,12 @@ else if (jobType.equals("globalCrawlTrigger"))
// we can deploy a new system with (i.e.)
// cd DATA/RELEASE;tar xfz $1;cp -Rf yacy/* ../../;rm -Rf yacy

prop.put("candeploy", 1);

// list downloaded releases
yacyVersion release, dflt;
String[] downloaded = sb.releasePath.list();
prop.put("candeploy", 1);
prop.put("candeploy_deployenabled", (downloaded.length == 0) ? 0 : ((devenvironment) ? 1 : 2)); // prevent that a developer-version is over-deployed

TreeSet downloadedreleases = new TreeSet();
for (int j = 0; j < downloaded.length; j++) {
try {
Expand All @@ -184,44 +186,44 @@ else if (jobType.equals("globalCrawlTrigger"))
}
}
dflt = (downloadedreleases.size() == 0) ? null : (yacyVersion) downloadedreleases.last();
Iterator i = downloadedreleases.iterator();
int relcount = 0;
while (i.hasNext()) {
release = (yacyVersion) i.next();
prop.put("candeploy_downloadedreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);
prop.put("candeploy_downloadedreleases_" + relcount + "_file", release.name);
prop.put("candeploy_downloadedreleases_" + relcount + "_selected", (release == dflt) ? 1 : 0);
relcount++;
}
prop.put("candeploy_downloadedreleases", relcount);
// list remotely available releases
TreeSet[] releasess = yacyVersion.allReleases(); // {0=promain, 1=prodev, 2=stdmain, 3=stddev}
relcount = 0;
// main
TreeSet releases = releasess[(yacy.pro) ? 0 : 2];
releases.removeAll(downloadedreleases);
i = releases.iterator();
while (i.hasNext()) {
release = (yacyVersion) i.next();
prop.put("candeploy_availreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);
prop.put("candeploy_availreleases_" + relcount + "_url", release.url.toString());
prop.put("candeploy_availreleases_" + relcount + "_selected", 0);
relcount++;
}
// dev
dflt = (releasess[(yacy.pro) ? 1 : 3].size() == 0) ? null : (yacyVersion) releasess[(yacy.pro) ? 1 : 3].last();
releases = releasess[(yacy.pro) ? 1 : 3];
releases.removeAll(downloadedreleases);
i = releases.iterator();
while (i.hasNext()) {
release = (yacyVersion) i.next();
prop.put("candeploy_availreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);
prop.put("candeploy_availreleases_" + relcount + "_url", release.url.toString());
prop.put("candeploy_availreleases_" + relcount + "_selected", (release == dflt) ? 1 : 0);
relcount++;
}
prop.put("candeploy_availreleases", relcount);
Iterator i = downloadedreleases.iterator();
int relcount = 0;
while (i.hasNext()) {
release = (yacyVersion) i.next();
prop.put("candeploy_downloadedreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);
prop.put("candeploy_downloadedreleases_" + relcount + "_file", release.name);
prop.put("candeploy_downloadedreleases_" + relcount + "_selected", (release == dflt) ? 1 : 0);
relcount++;
}
prop.put("candeploy_downloadedreleases", relcount);

// list remotely available releases
TreeSet[] releasess = yacyVersion.allReleases(); // {0=promain, 1=prodev, 2=stdmain, 3=stddev}
relcount = 0;
// main
TreeSet releases = releasess[(yacy.pro) ? 0 : 2];
releases.removeAll(downloadedreleases);
i = releases.iterator();
while (i.hasNext()) {
release = (yacyVersion) i.next();
prop.put("candeploy_availreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);
prop.put("candeploy_availreleases_" + relcount + "_url", release.url.toString());
prop.put("candeploy_availreleases_" + relcount + "_selected", 0);
relcount++;
}
// dev
dflt = (releasess[(yacy.pro) ? 1 : 3].size() == 0) ? null : (yacyVersion) releasess[(yacy.pro) ? 1 : 3].last();
releases = releasess[(yacy.pro) ? 1 : 3];
releases.removeAll(downloadedreleases);
i = releases.iterator();
while (i.hasNext()) {
release = (yacyVersion) i.next();
prop.put("candeploy_availreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);
prop.put("candeploy_availreleases_" + relcount + "_url", release.url.toString());
prop.put("candeploy_availreleases_" + relcount + "_selected", (release == dflt) ? 1 : 0);
relcount++;
}
prop.put("candeploy_availreleases", relcount);
} else {
prop.put("candeploy", 0);
}
Expand Down
14 changes: 8 additions & 6 deletions htroot/Steering.html
Expand Up @@ -6,11 +6,9 @@
</head>
<body style="margin:40px;">
<h2>Steering Receipt:</h2>
<p>#(info)#
<b>No information has been submitted</b><br />
Nothing changed
</p>
<p>You can now go back to the <a href="Settings_p.html">Settings</a> page if you want to make more changes.</p>
#(info)#
<b>No action submitted</b><br />
<p>Go back to the <a href="Settings_p.html">Settings</a> page</p>
::
<b>Your system is not protected by a password</b><br />
Please go to the <a href="/Settings_p.html">Settings</a> page and set an administration password.
Expand All @@ -25,7 +23,11 @@ <h2>Steering Receipt:</h2>
<b>Restart YaCy.</b><br />
Application will terminate after working off all scheduled tasks.<br />
Then YaCy will restart.<br />
If you can't reach YaCy's interface after 5 minutes restart failed.#(/info)#
If you can't reach YaCy's interface after 5 minutes restart failed.
::
<b>Installing release #[release]#</b><br />
<p>YaCy will be restartet after installation</p>
#(/info)#
</p>
</body>
</html>
14 changes: 14 additions & 0 deletions htroot/Steering.java
Expand Up @@ -46,6 +46,8 @@
// javac -classpath .:../Classes SettingsAck_p.java
// if the shell's current path is HTROOT

import java.io.File;

import de.anomic.http.httpHeader;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverObjects;
Expand Down Expand Up @@ -80,7 +82,19 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve

return prop;
}

if (post.containsKey("update")) {
boolean devenvironment = yacy.combined2prettyVersion(sb.getConfig("version","0.1")).startsWith("dev");
String releaseFileName = post.get("releaseinstall", "");
File releaseFile = new File(sb.getRootPath(), "DATA/RELEASE/" + releaseFileName);
if ((!devenvironment) && (releaseFile.length() > 0) && (releaseFile.exists())) {
yacyVersion.deployRelease(releaseFileName);
}
prop.put("info", 5);
prop.put("info_release", releaseFileName);

return prop;
}
return prop;
}

Expand Down
22 changes: 16 additions & 6 deletions source/de/anomic/plasma/plasmaSwitchboard.java
Expand Up @@ -933,9 +933,19 @@ public plasmaSwitchboard(String rootPath, String initPath, String configPath, bo
}
}

// set auto-updater locations
yacyVersion.latestDevReleaseLocation = getConfig("network.unit.update.location.dev", "");
yacyVersion.latestMainReleaseLocation = getConfig("network.unit.update.location.main", "");
// set release locations
int i = 0;
String location;
while (true) {
location = getConfig("network.unit.update.location" + i, "");
if (location.length() == 0) break;
try {
yacyVersion.latestReleaseLocations.add(new URL(location));
} catch (MalformedURLException e) {
break;
}
i++;
}

// load values from configs
this.plasmaPath = new File(rootPath, getConfig(DBPATH, DBPATH_DEFAULT));
Expand Down Expand Up @@ -1159,7 +1169,7 @@ public plasmaSwitchboard(String rootPath, String initPath, String configPath, bo
int count = 0;
try {
ArrayList sbQueueEntries = this.sbQueue.list();
for (int i = 0; i < sbQueueEntries.size(); i++) {
for (i = 0; i < sbQueueEntries.size(); i++) {
plasmaSwitchboardQueue.Entry entry = (plasmaSwitchboardQueue.Entry) sbQueueEntries.get(i);
if ((entry != null) && (entry.url() != null) && (entry.cacheFile().exists())) {
plasmaHTCache.filesInUse.add(entry.cacheFile());
Expand Down Expand Up @@ -1269,7 +1279,7 @@ public plasmaSwitchboard(String rootPath, String initPath, String configPath, bo
// init nameCacheNoCachingList
String noCachingList = getConfig(HTTPC_NAME_CACHE_CACHING_PATTERNS_NO,"");
String[] noCachingEntries = noCachingList.split(",");
for (int i=0; i<noCachingEntries.length; i++) {
for (i = 0; i < noCachingEntries.length; i++) {
String entry = noCachingEntries[i].trim();
httpc.nameCacheNoCachingPatterns.add(entry);
}
Expand Down Expand Up @@ -1320,7 +1330,7 @@ public plasmaSwitchboard(String rootPath, String initPath, String configPath, bo

deployThread(INDEXER, "Parsing/Indexing", "thread that performes document parsing and indexing", "/IndexCreateIndexingQueue_p.html",
new serverInstantThread(this, INDEXER_METHOD_START, INDEXER_METHOD_JOBCOUNT, INDEXER_METHOD_FREEMEM), 10000);
for (int i = 1; i < indexing_cluster; i++) {
for (i = 1; i < indexing_cluster; i++) {
setConfig((i + 80) + "_indexing_idlesleep", getConfig(INDEXER_IDLESLEEP, ""));
setConfig((i + 80) + "_indexing_busysleep", getConfig(INDEXER_BUSYSLEEP, ""));
deployThread((i + 80) + "_indexing", "Parsing/Indexing (cluster job)", "thread that performes document parsing and indexing", null,
Expand Down

0 comments on commit 3421c64

Please sign in to comment.