LibreChat/config/deployed-update.js
Danny Avila f13b0eaef4
Some checks failed
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Docker Dev Images Build / publish (push) Waiting to run
Sync Helm Chart Tags / Ignore non-main push (push) Waiting to run
Sync Helm Chart Tags / Sync chart tags (push) Waiting to run
Publish `@librechat/client` to NPM / pack (push) Has been cancelled
Publish `librechat-data-provider` to NPM / pack (push) Has been cancelled
Publish `@librechat/data-schemas` to NPM / pack (push) Has been cancelled
Publish `@librechat/client` to NPM / publish-npm (push) Has been cancelled
Publish `librechat-data-provider` to NPM / publish-npm (push) Has been cancelled
Publish `@librechat/data-schemas` to NPM / publish-npm (push) Has been cancelled
🚚 chore: Point Repository and Image References at LibreChat-AI (#16005)
Update package repository and bugs URLs, GitHub links in docs, templates and comments, and image references (compose files, deployed-update, Helm values and renovate hints) from danny-avila to LibreChat-AI / librechat-ai. Covers the rag-api repository and its images, which moved to the organization. Sponsor links and the sealed star-history chart are unchanged.
2026-09-23 23:08:36 -04:00

83 lines
3.3 KiB
JavaScript

const { execSync } = require('child_process');
const { isDockerRunning, silentExit } = require('./helpers');
async function validateDockerRunning() {
if (!isDockerRunning()) {
console.red(
'Error: Docker is not running. You will need to start Docker Desktop or if using linux/mac, run `sudo systemctl start docker`',
);
silentExit(1);
}
}
function getCurrentBranch() {
return execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8' }).trim();
}
const shouldRebase = process.argv.includes('--rebase');
(async () => {
console.green(
'Starting deployed update script, this may take a minute or two depending on your system and network.',
);
await validateDockerRunning();
console.purple('Fetching the latest repo...');
execSync('git fetch origin', { stdio: 'inherit' });
if (!shouldRebase) {
execSync('git checkout main', { stdio: 'inherit' });
console.purple('Pulling the latest code from main...');
execSync('git pull origin main', { stdio: 'inherit' });
} else {
const currentBranch = getCurrentBranch();
console.purple(`Rebasing ${currentBranch} onto main...`);
execSync('git rebase origin/main', { stdio: 'inherit' });
}
console.purple('Removing previously made Docker container...');
const downCommand = 'sudo docker compose -f ./deploy-compose.yml down';
console.orange(downCommand);
execSync(downCommand, { stdio: 'inherit' });
console.purple('Removing all tags for LibreChat `deployed` images...');
const repositories = ['registry.librechat.ai/librechat-ai/librechat-dev-api', 'librechat-client'];
repositories.forEach((repo) => {
const imageRefs = execSync(`sudo docker images ${repo} --format "{{.Repository}}:{{.Tag}}"`, {
encoding: 'utf8',
})
.split('\n')
.filter(Boolean)
.filter((ref) => !ref.includes('<none>'));
imageRefs.forEach((imageRef) => {
const removeImageCommand = `sudo docker rmi ${imageRef}`;
console.orange(removeImageCommand);
execSync(removeImageCommand, { stdio: 'inherit' });
});
});
console.purple('Pulling latest LibreChat images...');
const pullCommand = 'sudo docker compose -f ./deploy-compose.yml pull api';
console.orange(pullCommand);
execSync(pullCommand, { stdio: 'inherit' });
/* The tag-removal above only covers the stock repositories; any overridden
* `api` image (or other freshly pulled service) leaves its previous version
* dangling — ~1.7GB per update that nothing reclaimed. Prune AFTER the pull
* so the just-superseded layers are already untagged, mirroring update.js. */
console.purple('Removing all unused dangling Docker images...');
const pruneCommand = 'sudo docker image prune -f';
console.orange(pruneCommand);
execSync(pruneCommand, { stdio: 'inherit' });
const startCommand = 'sudo docker compose -f ./deploy-compose.yml up -d';
console.green('Your LibreChat app is now up to date! Start the app with the following command:');
console.purple(startCommand);
console.orange(
"Note: it's also recommended to clear your browser cookies and localStorage for LibreChat to assure a fully clean installation.",
);
console.orange("Also: Don't worry, your data is safe :)");
})().catch((err) => {
console.error('Update script failed:', err.message);
process.exit(1);
});