core: remove watchtower from proxmox totally

This commit is contained in:
Koushik Dutta
2025-11-05 10:32:25 -08:00
parent 618a33028b
commit d8e17e9216
5 changed files with 27 additions and 6 deletions

View File

@@ -36,4 +36,5 @@ docker compose pull
WATCHTOWER_HTTP_API_TOKEN=$(echo $RANDOM | md5sum | head -c 32) docker compose up --force-recreate WATCHTOWER_HTTP_API_TOKEN=$(echo $RANDOM | md5sum | head -c 32) docker compose up --force-recreate
# abort on container exit is problematic if watchtower is the one that aborts. # abort on container exit is problematic if watchtower is the one that aborts.
# this is also redundant now that watchtower is disabled.
# WATCHTOWER_HTTP_API_TOKEN=$(echo $RANDOM | md5sum | head -c 32) docker compose up --force-recreate --abort-on-container-exit # WATCHTOWER_HTTP_API_TOKEN=$(echo $RANDOM | md5sum | head -c 32) docker compose up --force-recreate --abort-on-container-exit

View File

@@ -1,12 +1,12 @@
{ {
"name": "@scrypted/core", "name": "@scrypted/core",
"version": "0.3.138", "version": "0.3.139",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@scrypted/core", "name": "@scrypted/core",
"version": "0.3.138", "version": "0.3.139",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@scrypted/common": "file:../../common", "@scrypted/common": "file:../../common",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@scrypted/core", "name": "@scrypted/core",
"version": "0.3.138", "version": "0.3.139",
"description": "Scrypted Core plugin. Provides the UI, websocket, and engine.io APIs.", "description": "Scrypted Core plugin. Provides the UI, websocket, and engine.io APIs.",
"author": "Scrypted", "author": "Scrypted",
"license": "Apache-2.0", "license": "Apache-2.0",

View File

@@ -345,7 +345,6 @@ class ScryptedCore extends ScryptedDeviceBase implements HttpRequestHandler, Dev
const dockerCompose = yaml.parseDocument(readFileAsString('/root/.scrypted/docker-compose.yml')); const dockerCompose = yaml.parseDocument(readFileAsString('/root/.scrypted/docker-compose.yml'));
// @ts-ignore // @ts-ignore
dockerCompose.contents.get('services').get('scrypted').set('image', `ghcr.io/koush/scrypted${releaseChannel}`); dockerCompose.contents.get('services').get('scrypted').set('image', `ghcr.io/koush/scrypted${releaseChannel}`);
yaml.stringify(dockerCompose);
writeFileSync('/root/.scrypted/docker-compose.yml', yaml.stringify(dockerCompose)); writeFileSync('/root/.scrypted/docker-compose.yml', yaml.stringify(dockerCompose));
this.setPullImage(); this.setPullImage();

View File

@@ -1,5 +1,7 @@
import fs from 'fs'; import fs, { writeFileSync } from 'fs';
import sdk from '@scrypted/sdk'; import sdk from '@scrypted/sdk';
import yaml from 'yaml';
import { readFileAsString } from '@scrypted/common/src/eval/scrypted-eval';
export const SCRYPTED_INSTALL_ENVIRONMENT_LXC = 'lxc'; export const SCRYPTED_INSTALL_ENVIRONMENT_LXC = 'lxc';
export const SCRYPTED_INSTALL_ENVIRONMENT_LXC_DOCKER = 'lxc-docker'; export const SCRYPTED_INSTALL_ENVIRONMENT_LXC_DOCKER = 'lxc-docker';
@@ -18,6 +20,25 @@ export async function checkLxc() {
if (process.env.SCRYPTED_INSTALL_ENVIRONMENT !== SCRYPTED_INSTALL_ENVIRONMENT_LXC_DOCKER) if (process.env.SCRYPTED_INSTALL_ENVIRONMENT !== SCRYPTED_INSTALL_ENVIRONMENT_LXC_DOCKER)
return; return;
await checkLxcCompose();
await checkLxcScript();
}
async function checkLxcCompose() {
// the lxc-docker used watchtower for automatic updates but watchtower started crashing in the lxc environment
// after a docker update.
// watchtower was removed from the lxc as a result.
// however existing installations may still have watchtower in their docker-compose.yml and need it removed.
const dockerCompose = yaml.parseDocument(readFileAsString('/root/.scrypted/docker-compose.yml'));
// @ts-ignore
const watchtower = dockerCompose.contents.get('services').get('watchtower');
if (watchtower.get('profiles'))
return;
watchtower.set('profiles', ['disabled']);
writeFileSync('/root/.scrypted/docker-compose.yml', yaml.stringify(dockerCompose));
}
async function checkLxcScript() {
const foundDockerComposeSh = await fs.promises.readFile(DOCKER_COMPOSE_SH_PATH, 'utf8'); const foundDockerComposeSh = await fs.promises.readFile(DOCKER_COMPOSE_SH_PATH, 'utf8');
const dockerComposeSh = await fs.promises.readFile(LXC_DOCKER_COMPOSE_SH_PATH, 'utf8'); const dockerComposeSh = await fs.promises.readFile(LXC_DOCKER_COMPOSE_SH_PATH, 'utf8');
@@ -34,4 +55,4 @@ export async function checkLxc() {
// console.warn(foundDockerComposeSh); // console.warn(foundDockerComposeSh);
await fs.promises.copyFile(LXC_DOCKER_COMPOSE_SH_PATH, DOCKER_COMPOSE_SH_PATH); await fs.promises.copyFile(LXC_DOCKER_COMPOSE_SH_PATH, DOCKER_COMPOSE_SH_PATH);
await fs.promises.chmod(DOCKER_COMPOSE_SH_PATH, 0o755); await fs.promises.chmod(DOCKER_COMPOSE_SH_PATH, 0o755);
} }