mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
install: use mongodb 7 by default
This commit is contained in:
1 file changed
+20
-3
+20
-3
@@ -24,6 +24,9 @@ const sleep = (t: number) => new Promise((r) => { setTimeout(r, t); });
|
|||||||
const locales = {
|
const locales = {
|
||||||
zh: {
|
zh: {
|
||||||
'install.start': '开始运行 Hydro 安装工具',
|
'install.start': '开始运行 Hydro 安装工具',
|
||||||
|
'note.avx': `检测到您的 CPU 不支持 avx 指令集,这可能会影响系统运行速度。
|
||||||
|
如果您正在使用 PVE/VirtualBox 等虚拟机平台,请尝试关机后将虚拟机的 CPU 类型设置为 Host,重启后再次运行该脚本。
|
||||||
|
您也可以选择忽略此问题,安装脚本将在一分钟后自动继续安装。`,
|
||||||
'warn.avx': '检测到您的 CPU 不支持 avx 指令集,将使用 mongodb@v4.4',
|
'warn.avx': '检测到您的 CPU 不支持 avx 指令集,将使用 mongodb@v4.4',
|
||||||
'error.rootRequired': '请先使用 sudo su 切换到 root 用户后再运行该工具。',
|
'error.rootRequired': '请先使用 sudo su 切换到 root 用户后再运行该工具。',
|
||||||
'error.unsupportedArch': '不支持的架构 %s ,请尝试手动安装。',
|
'error.unsupportedArch': '不支持的架构 %s ,请尝试手动安装。',
|
||||||
@@ -51,6 +54,11 @@ const locales = {
|
|||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
'install.start': 'Starting Hydro installation tool',
|
'install.start': 'Starting Hydro installation tool',
|
||||||
|
'note.avx': `Your CPU does not support avx, this may affect system performance.
|
||||||
|
If you are using a virtual machine platform such as PVE/VirtualBox,
|
||||||
|
try shutting down and setting the CPU type of the virtual machine to Host,
|
||||||
|
then restart and run the script again.
|
||||||
|
You can also choose to ignore this issue, the installation script will continue in one minute.`,
|
||||||
'warn.avx': 'Your CPU does not support avx, will use mongodb@v4.4',
|
'warn.avx': 'Your CPU does not support avx, will use mongodb@v4.4',
|
||||||
'error.rootRequired': 'Please run this tool as root user.',
|
'error.rootRequired': 'Please run this tool as root user.',
|
||||||
'error.unsupportedArch': 'Unsupported architecture %s, please try to install manually.',
|
'error.unsupportedArch': 'Unsupported architecture %s, please try to install manually.',
|
||||||
@@ -308,6 +316,12 @@ const Steps = () => [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async () => {
|
||||||
|
if (!avx && !installAsJudge) {
|
||||||
|
log.warn('note.avx');
|
||||||
|
await sleep(60000);
|
||||||
|
}
|
||||||
|
},
|
||||||
() => {
|
() => {
|
||||||
if (substituters.length) {
|
if (substituters.length) {
|
||||||
writeFileSync('/etc/nix/nix.conf', `substituters = ${substituters.join(' ')}
|
writeFileSync('/etc/nix/nix.conf', `substituters = ${substituters.join(' ')}
|
||||||
@@ -373,7 +387,7 @@ ${nixConfBase}`);
|
|||||||
"openssl-1.1.1z"
|
"openssl-1.1.1z"
|
||||||
];
|
];
|
||||||
}`),
|
}`),
|
||||||
`nix-env -iA hydro.mongodb${avx ? 6 : 4}${CN ? '-cn' : ''} nixpkgs.mongosh nixpkgs.mongodb-tools`,
|
`nix-env -iA hydro.mongodb${avx ? 7 : 4}${CN ? '-cn' : ''} nixpkgs.mongosh nixpkgs.mongodb-tools`,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -442,7 +456,9 @@ ${nixConfBase}`);
|
|||||||
readPreference: 'nearest',
|
readPreference: 'nearest',
|
||||||
writeConcern: new WriteConcern('majority'),
|
writeConcern: new WriteConcern('majority'),
|
||||||
});
|
});
|
||||||
await client.db('hydro').addUser('hydro', password, {
|
await client.db('hydro').command({
|
||||||
|
createUser: 'hydro',
|
||||||
|
pwd: password,
|
||||||
roles: [{ role: 'readWrite', db: 'hydro' }],
|
roles: [{ role: 'readWrite', db: 'hydro' }],
|
||||||
});
|
});
|
||||||
await client.close();
|
await client.close();
|
||||||
@@ -466,7 +482,6 @@ ${nixConfBase}`);
|
|||||||
// The only thing mongod writes to stderr is 'libcurl no version information available'
|
// The only thing mongod writes to stderr is 'libcurl no version information available'
|
||||||
`pm2 start mongod --name mongodb -e /dev/null -- --auth --bind_ip 0.0.0.0 --wiredTigerCacheSizeGB=${wtsize}`,
|
`pm2 start mongod --name mongodb -e /dev/null -- --auth --bind_ip 0.0.0.0 --wiredTigerCacheSizeGB=${wtsize}`,
|
||||||
() => sleep(1000),
|
() => sleep(1000),
|
||||||
'pm2 start hydrooj',
|
|
||||||
async () => {
|
async () => {
|
||||||
if (noCaddy) return;
|
if (noCaddy) return;
|
||||||
if (!await isPortFree(80)) log.warn('port.80');
|
if (!await isPortFree(80)) log.warn('port.80');
|
||||||
@@ -478,7 +493,9 @@ ${nixConfBase}`);
|
|||||||
exec('pm2 start caddy -- run', { cwd: `${process.env.HOME}/.hydro` });
|
exec('pm2 start caddy -- run', { cwd: `${process.env.HOME}/.hydro` });
|
||||||
exec('hydrooj cli system set server.xff x-forwarded-for');
|
exec('hydrooj cli system set server.xff x-forwarded-for');
|
||||||
exec('hydrooj cli system set server.xhost x-forwarded-host');
|
exec('hydrooj cli system set server.xhost x-forwarded-host');
|
||||||
|
exec('hydrooj cli system set server.xproxy true');
|
||||||
},
|
},
|
||||||
|
'pm2 start hydrooj',
|
||||||
],
|
],
|
||||||
'pm2 startup',
|
'pm2 startup',
|
||||||
'pm2 save',
|
'pm2 save',
|
||||||
|
|||||||
Reference in new issue
Block a user