bump version.

docker image includes app
This commit is contained in:
kirill.labutin 2026-08-14 18:01:21 +03:00
parent 4da94338bf
commit 653c67062c
11 changed files with 46 additions and 13 deletions

View File

@ -1,13 +1,12 @@
FROM alpine:latest FROM alpine:latest
RUN apk add --no-cache openjdk25 git curl RUN apk add --no-cache openjdk25 git
RUN mkdir -p /data /data/local RUN mkdir -p /data /data/local
COPY launcher.sh /launcher.sh
COPY docker/config.json /data/config.json COPY docker/config.json /data/config.json
COPY docker/entrypoint.sh /entrypoint.sh COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /launcher.sh /entrypoint.sh RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ru.kirillius</groupId> <groupId>ru.kirillius</groupId>
<artifactId>pf-sdn</artifactId> <artifactId>pf-sdn</artifactId>
<version>1.0.2.5</version> <version>1.1.0.0</version>
</parent> </parent>
<artifactId>pf-sdn.app</artifactId> <artifactId>pf-sdn.app</artifactId>

View File

@ -24,6 +24,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -114,8 +115,10 @@ public class App implements Context, Closeable {
serviceManager.getService(ComponentHandlerService.class).syncComponentsWithConfig(); serviceManager.getService(ComponentHandlerService.class).syncComponentsWithConfig();
serviceManager.getService(ResourceUpdateService.class).start(); serviceManager.getService(ResourceUpdateService.class).start();
if(!isExternalManagement()) {
removeObsoleteVersions(); removeObsoleteVersions();
} }
}
private void removeObsoleteVersions() { private void removeObsoleteVersions() {
var appVersion = serviceManager.getService(AppUpdateService.class).getAppVersion(); var appVersion = serviceManager.getService(AppUpdateService.class).getAppVersion();
@ -175,8 +178,15 @@ public class App implements Context, Closeable {
*/ */
public void requestExit(boolean restart) { public void requestExit(boolean restart) {
running.set(false); running.set(false);
if(!isExternalManagement()) {
shouldRestart.set(restart); shouldRestart.set(restart);
} }
}
@Override
public boolean isExternalManagement() {
return Objects.equals(System.getProperty("app.external.management", Boolean.FALSE.toString()), Boolean.TRUE.toString());
}
/** /**
* Closes all managed services. * Closes all managed services.

View File

@ -122,10 +122,19 @@ public class System implements RPC {
@ProtectedMethod @ProtectedMethod
@JRPCMethod @JRPCMethod
public void doUpdate() { public void doUpdate() {
if(context.isExternalManagement()){
return;
}
var updateService = context.getServiceManager().getService(AppUpdateService.class); var updateService = context.getServiceManager().getService(AppUpdateService.class);
updateService.updateApp(); updateService.updateApp();
} }
@ProtectedMethod
@JRPCMethod
public boolean isExternalManaged() {
return context.isExternalManagement();
}
@ProtectedMethod @ProtectedMethod
@JRPCMethod @JRPCMethod
public JSONArray getRepositoryTypes() { public JSONArray getRepositoryTypes() {

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ru.kirillius</groupId> <groupId>ru.kirillius</groupId>
<artifactId>pf-sdn</artifactId> <artifactId>pf-sdn</artifactId>
<version>1.0.2.5</version> <version>1.1.0.0</version>
</parent> </parent>

View File

@ -26,4 +26,7 @@ public interface Context {
* @param shouldRestart {@code true} to exit with restart intent, {@code false} to shut down. * @param shouldRestart {@code true} to exit with restart intent, {@code false} to shut down.
*/ */
void requestExit(boolean shouldRestart); void requestExit(boolean shouldRestart);
boolean isExternalManagement();
} }

View File

@ -1,2 +1,2 @@
#!/bin/sh #!/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/"

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ru.kirillius</groupId> <groupId>ru.kirillius</groupId>
<artifactId>pf-sdn</artifactId> <artifactId>pf-sdn</artifactId>
<version>1.0.2.5</version> <version>1.1.0.0</version>
</parent> </parent>
<artifactId>launcher</artifactId> <artifactId>launcher</artifactId>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ru.kirillius</groupId> <groupId>ru.kirillius</groupId>
<artifactId>pf-sdn</artifactId> <artifactId>pf-sdn</artifactId>
<version>1.0.2.5</version> <version>1.1.0.0</version>
</parent> </parent>
<artifactId>pf-sdn.ovpn-connector</artifactId> <artifactId>pf-sdn.ovpn-connector</artifactId>

View File

@ -6,7 +6,7 @@
<groupId>ru.kirillius</groupId> <groupId>ru.kirillius</groupId>
<artifactId>pf-sdn</artifactId> <artifactId>pf-sdn</artifactId>
<version>1.0.2.5</version> <version>1.1.0.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>

View File

@ -87,10 +87,14 @@ async function renderSystemAndManagerStatus() {
const currentVersion = (versionInfo && versionInfo.current) || ''; const currentVersion = (versionInfo && versionInfo.current) || '';
const downloadedVersion = (versionInfo && versionInfo.downloaded) || ''; const downloadedVersion = (versionInfo && versionInfo.downloaded) || '';
configChanged = await JSONRPC.System.isConfigChanged(); configChanged = await JSONRPC.System.isConfigChanged();
const isExternalManaged = await JSONRPC.System.isExternalManaged();
const hasAvailableUpdate = availableVersion && availableVersion !== currentVersion; const hasAvailableUpdate = availableVersion && availableVersion !== currentVersion;
const isDownloaded = hasAvailableUpdate && downloadedVersion === availableVersion; const isDownloaded = hasAvailableUpdate && downloadedVersion === availableVersion;
const updateButtonDisabled = !hasAvailableUpdate || isDownloaded; const updateButtonDisabled = !hasAvailableUpdate || isDownloaded || isExternalManaged;
const systemStatus = (() => { const systemStatus = (() => {
if (isExternalManaged) {
return 'Управляется извне';
}
if (!hasAvailableUpdate) { if (!hasAvailableUpdate) {
return 'Нет обновлений'; return 'Нет обновлений';
} }
@ -104,6 +108,7 @@ async function renderSystemAndManagerStatus() {
<span>Текущая версия: <span class="${hasAvailableUpdate ? 'text-yellow-500' : 'text-green-500'}">${currentVersion || '-'}</span></span><br /> <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> <span class="last-version">Последняя версия: <span class="${hasAvailableUpdate ? 'text-yellow-500' : 'text-green-500'}">${availableVersion || '-'}</span></span>
</div> </div>
${isExternalManaged ? '<p class="status-line text-red-500">Обновление ПО управляется внешней системой, установка из веб-интерфейса недоступна.</p>' : ''}
<p class="status-line ${configChanged ? 'text-yellow-500' : 'text-green-500'}"> <p class="status-line ${configChanged ? 'text-yellow-500' : 'text-green-500'}">
Конфигурация: ${configChanged ? 'изменена' : 'актуальна'} Конфигурация: ${configChanged ? 'изменена' : 'актуальна'}
</p> </p>
@ -225,8 +230,15 @@ function attachEventHandlers() {
$btn.prop('disabled', true).text('Обновление...'); $btn.prop('disabled', true).text('Обновление...');
try { try {
await JSONRPC.System.doUpdate(); const updatePromise = JSONRPC.System.doUpdate();
alert('Обновление ПО запущено!'); alert('Обновление ПО запущено!');
await updatePromise;
if (confirm('Обновление завершено. Перезагрузить?')) {
await JSONRPC.System.restart();
setTimeout(() => {
window.location.reload();
}, 10000);
}
await renderSystemAndManagerStatus(); await renderSystemAndManagerStatus();
} catch (e) { } catch (e) {
alert('Ошибка при запуске обновления ПО!'); alert('Ошибка при запуске обновления ПО!');