mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02:00

* docs: wip: digitalocean guide * feat(deployed-update.js): add script for updating deployed instance docs(deployment/digitalocean.md): update instructions for Digital Ocean deployment * fix(deployed-update.js): change docker-compose pull command to only pull api image fix(digitalocean.md): update instructions to add user to docker group and start docker before running installation/update script * feat(package.json): add 'update:deployed' script for deployed updates docs: wip: digitalocean * chore(package.json): add start:deployed and stop:deployed scripts for deploying with docker-compose * docs(deployment/digitalocean.md): add instructions for stopping and starting the docker container * docs(deployment/digitalocean.md): add instructions for stopping and starting the docker container docs(deployment/digitalocean.md): add command for checking active docker containers docs(deployment/digitalocean.md): provide guidance for troubleshooting before creating a new issue * fix(deployed-update.js): refactor code to use getCurrentBranch function feat(deployed-update.js): add support for rebasing current branch onto main branch docs(digitalocean.md): update instructions for deploying with Docker on remote Ubuntu server package.json: add rebase:deployed script to run deployed-update.js with --rebase flag * fix(deployed-update.js): fix variable scope issue in deployed-update.js docs(digitalocean.md): fix grammar and clarify instructions for editing NGINX file * docs(deployment): add warning about potential merge conflicts when editing branch docs(deployment): clarify that code changes in environment won't be reflected * docs: Update digitalocean.md with images and revised instructions * docs(digitalocean.md): formatting * docs(digitalocean.md): add ToC * docs(digitalocean.md): fix ToC * Update mkdocs.yml
55 lines
2 KiB
JavaScript
55 lines
2 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 if (shouldRebase) {
|
|
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 --volumes';
|
|
console.orange(downCommand);
|
|
execSync(downCommand, { 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' });
|
|
|
|
let 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 :)');
|
|
})();
|