parent
4da94338bf
commit
653c67062c
|
|
@ -1,13 +1,12 @@
|
|||
FROM alpine:latest
|
||||
|
||||
RUN apk add --no-cache openjdk25 git curl
|
||||
RUN apk add --no-cache openjdk25 git
|
||||
|
||||
RUN mkdir -p /data /data/local
|
||||
|
||||
COPY launcher.sh /launcher.sh
|
||||
COPY docker/config.json /data/config.json
|
||||
COPY docker/entrypoint.sh /entrypoint.sh
|
||||
|
||||
RUN chmod +x /launcher.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ru.kirillius</groupId>
|
||||
<artifactId>pf-sdn</artifactId>
|
||||
<version>1.0.2.5</version>
|
||||
<version>1.1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pf-sdn.app</artifactId>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.logging.Level;
|
||||
import java.util.regex.Pattern;
|
||||
|
|
@ -114,7 +115,9 @@ public class App implements Context, Closeable {
|
|||
serviceManager.getService(ComponentHandlerService.class).syncComponentsWithConfig();
|
||||
serviceManager.getService(ResourceUpdateService.class).start();
|
||||
|
||||
removeObsoleteVersions();
|
||||
if(!isExternalManagement()) {
|
||||
removeObsoleteVersions();
|
||||
}
|
||||
}
|
||||
|
||||
private void removeObsoleteVersions() {
|
||||
|
|
@ -175,7 +178,14 @@ public class App implements Context, Closeable {
|
|||
*/
|
||||
public void requestExit(boolean restart) {
|
||||
running.set(false);
|
||||
shouldRestart.set(restart);
|
||||
if(!isExternalManagement()) {
|
||||
shouldRestart.set(restart);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExternalManagement() {
|
||||
return Objects.equals(System.getProperty("app.external.management", Boolean.FALSE.toString()), Boolean.TRUE.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -122,10 +122,19 @@ public class System implements RPC {
|
|||
@ProtectedMethod
|
||||
@JRPCMethod
|
||||
public void doUpdate() {
|
||||
if(context.isExternalManagement()){
|
||||
return;
|
||||
}
|
||||
var updateService = context.getServiceManager().getService(AppUpdateService.class);
|
||||
updateService.updateApp();
|
||||
}
|
||||
|
||||
@ProtectedMethod
|
||||
@JRPCMethod
|
||||
public boolean isExternalManaged() {
|
||||
return context.isExternalManagement();
|
||||
}
|
||||
|
||||
@ProtectedMethod
|
||||
@JRPCMethod
|
||||
public JSONArray getRepositoryTypes() {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ru.kirillius</groupId>
|
||||
<artifactId>pf-sdn</artifactId>
|
||||
<version>1.0.2.5</version>
|
||||
<version>1.1.0.0</version>
|
||||
</parent>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,4 +26,7 @@ public interface Context {
|
|||
* @param shouldRestart {@code true} to exit with restart intent, {@code false} to shut down.
|
||||
*/
|
||||
void requestExit(boolean shouldRestart);
|
||||
|
||||
|
||||
boolean isExternalManagement();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/sh
|
||||
exec /launcher.sh --c=/data/config.json
|
||||
exec java -Xmx256m -jar default.pfapp --c=/data/config.json -Dapp.external.management=true -l=. -r="https://repo.kirillius.ru/apps/pf/"
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ru.kirillius</groupId>
|
||||
<artifactId>pf-sdn</artifactId>
|
||||
<version>1.0.2.5</version>
|
||||
<version>1.1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>launcher</artifactId>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ru.kirillius</groupId>
|
||||
<artifactId>pf-sdn</artifactId>
|
||||
<version>1.0.2.5</version>
|
||||
<version>1.1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pf-sdn.ovpn-connector</artifactId>
|
||||
|
|
|
|||
2
pom.xml
2
pom.xml
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>ru.kirillius</groupId>
|
||||
<artifactId>pf-sdn</artifactId>
|
||||
<version>1.0.2.5</version>
|
||||
<version>1.1.0.0</version>
|
||||
|
||||
|
||||
<packaging>pom</packaging>
|
||||
|
|
|
|||
|
|
@ -87,10 +87,14 @@ async function renderSystemAndManagerStatus() {
|
|||
const currentVersion = (versionInfo && versionInfo.current) || '';
|
||||
const downloadedVersion = (versionInfo && versionInfo.downloaded) || '';
|
||||
configChanged = await JSONRPC.System.isConfigChanged();
|
||||
const isExternalManaged = await JSONRPC.System.isExternalManaged();
|
||||
const hasAvailableUpdate = availableVersion && availableVersion !== currentVersion;
|
||||
const isDownloaded = hasAvailableUpdate && downloadedVersion === availableVersion;
|
||||
const updateButtonDisabled = !hasAvailableUpdate || isDownloaded;
|
||||
const updateButtonDisabled = !hasAvailableUpdate || isDownloaded || isExternalManaged;
|
||||
const systemStatus = (() => {
|
||||
if (isExternalManaged) {
|
||||
return 'Управляется извне';
|
||||
}
|
||||
if (!hasAvailableUpdate) {
|
||||
return 'Нет обновлений';
|
||||
}
|
||||
|
|
@ -104,6 +108,7 @@ async function renderSystemAndManagerStatus() {
|
|||
<span>Текущая версия: <span class="${hasAvailableUpdate ? 'text-yellow-500' : 'text-green-500'}">${currentVersion || '-'}</span></span><br />
|
||||
<span class="last-version">Последняя версия: <span class="${hasAvailableUpdate ? 'text-yellow-500' : 'text-green-500'}">${availableVersion || '-'}</span></span>
|
||||
</div>
|
||||
${isExternalManaged ? '<p class="status-line text-red-500">Обновление ПО управляется внешней системой, установка из веб-интерфейса недоступна.</p>' : ''}
|
||||
<p class="status-line ${configChanged ? 'text-yellow-500' : 'text-green-500'}">
|
||||
Конфигурация: ${configChanged ? 'изменена' : 'актуальна'}
|
||||
</p>
|
||||
|
|
@ -225,8 +230,15 @@ function attachEventHandlers() {
|
|||
$btn.prop('disabled', true).text('Обновление...');
|
||||
|
||||
try {
|
||||
await JSONRPC.System.doUpdate();
|
||||
const updatePromise = JSONRPC.System.doUpdate();
|
||||
alert('Обновление ПО запущено!');
|
||||
await updatePromise;
|
||||
if (confirm('Обновление завершено. Перезагрузить?')) {
|
||||
await JSONRPC.System.restart();
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 10000);
|
||||
}
|
||||
await renderSystemAndManagerStatus();
|
||||
} catch (e) {
|
||||
alert('Ошибка при запуске обновления ПО!');
|
||||
|
|
|
|||
Loading…
Reference in New Issue