mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-17 17:56:27 +00:00
Refactor certbot plugins install
- Added a script to install every single plugin, used in development and debugging - Improved certbot plugin install commands - Adjusted some version for plugins to install properly - It's noted that some plugins require deps that do not match other plugins, however these use cases should be extremely rare
This commit is contained in:
49
backend/scripts/install-certbot-plugins
Executable file
49
backend/scripts/install-certbot-plugins
Executable file
@ -0,0 +1,49 @@
|
||||
#!/usr/bin/node
|
||||
|
||||
// Usage:
|
||||
// Install all plugins defined in `certbot-dns-plugins.json`:
|
||||
// ./install-certbot-plugins
|
||||
// Install one or more specific plugins:
|
||||
// ./install-certbot-plugins route53 cloudflare
|
||||
//
|
||||
// Usage with a running docker container:
|
||||
// docker exec npm_core /command/s6-setuidgid 1000:1000 bash -c "/app/scripts/install-certbot-plugins"
|
||||
//
|
||||
|
||||
const dnsPlugins = require('../global/certbot-dns-plugins.json');
|
||||
const certbot = require('../lib/certbot');
|
||||
const logger = require('../logger').certbot;
|
||||
const batchflow = require('batchflow');
|
||||
|
||||
let hasErrors = false;
|
||||
let failingPlugins = [];
|
||||
|
||||
let pluginKeys = Object.keys(dnsPlugins);
|
||||
if (process.argv.length > 2) {
|
||||
pluginKeys = process.argv.slice(2);
|
||||
}
|
||||
|
||||
batchflow(pluginKeys).sequential()
|
||||
.each((i, pluginKey, next) => {
|
||||
certbot.installPlugin(pluginKey)
|
||||
.then(() => {
|
||||
next();
|
||||
})
|
||||
.catch((err) => {
|
||||
hasErrors = true;
|
||||
failingPlugins.push(pluginKey);
|
||||
next(err);
|
||||
});
|
||||
})
|
||||
.error((err) => {
|
||||
logger.error(err.message);
|
||||
})
|
||||
.end(() => {
|
||||
if (hasErrors) {
|
||||
logger.error('Some plugins failed to install. Please check the logs above. Failing plugins: ' + '\n - ' + failingPlugins.join('\n - '));
|
||||
process.exit(1);
|
||||
} else {
|
||||
logger.complete('Plugins installed successfully');
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user