mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
refactor: bind /proc and mount volumes with nsenter
This commit is contained in:
@@ -72,7 +72,7 @@ export const RepositorySnapshotsTabContent = ({ repository }: Props) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLoading && !data) {
|
if (isLoading && !data && !error) {
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
<CardContent className="flex items-center justify-center py-12">
|
<CardContent className="flex items-center justify-center py-12">
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { logger } from "../../../utils/logger";
|
|||||||
const execFile = promisify(execFileCb);
|
const execFile = promisify(execFileCb);
|
||||||
|
|
||||||
export const executeMount = async (args: string[]): Promise<void> => {
|
export const executeMount = async (args: string[]): Promise<void> => {
|
||||||
const { stderr } = await execFile("mount", args, {
|
const { stderr } = await execFile("nsenter", ["--mount=/host/proc/1/ns/mnt", "mount", ...args], {
|
||||||
timeout: OPERATION_TIMEOUT,
|
timeout: OPERATION_TIMEOUT,
|
||||||
maxBuffer: 1024 * 1024,
|
maxBuffer: 1024 * 1024,
|
||||||
});
|
});
|
||||||
@@ -20,7 +20,7 @@ export const executeMount = async (args: string[]): Promise<void> => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const executeUnmount = async (path: string): Promise<void> => {
|
export const executeUnmount = async (path: string): Promise<void> => {
|
||||||
const { stderr } = await execFile("umount", ["-l", "-f", path], {
|
const { stderr } = await execFile("nsenter", ["--mount=/host/proc/1/ns/mnt", "umount", "-l", "-f", path], {
|
||||||
timeout: OPERATION_TIMEOUT,
|
timeout: OPERATION_TIMEOUT,
|
||||||
maxBuffer: 1024 * 1024,
|
maxBuffer: 1024 * 1024,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,19 +6,17 @@ services:
|
|||||||
target: development
|
target: development
|
||||||
container_name: ironmount
|
container_name: ironmount
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
cap_add:
|
privileged: true
|
||||||
- SYS_ADMIN
|
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=development
|
- NODE_ENV=development
|
||||||
ports:
|
ports:
|
||||||
- "4096:4097"
|
- "4096:4097"
|
||||||
devices:
|
|
||||||
- /dev/fuse:/dev/fuse
|
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- /run/docker/plugins:/run/docker/plugins
|
- /run/docker/plugins:/run/docker/plugins
|
||||||
- /var/lib/ironmount/volumes/:/var/lib/ironmount/volumes:rshared
|
- /var/lib/ironmount/volumes/:/var/lib/ironmount/volumes:rslave
|
||||||
- /var/lib/repositories/:/var/lib/repositories
|
- /var/lib/repositories/:/var/lib/repositories
|
||||||
|
- /proc:/host/proc:ro
|
||||||
- ironmount_data:/data
|
- ironmount_data:/data
|
||||||
|
|
||||||
- ./apps/client/app:/app/apps/client/app
|
- ./apps/client/app:/app/apps/client/app
|
||||||
@@ -31,16 +29,15 @@ services:
|
|||||||
target: production
|
target: production
|
||||||
container_name: ironmount
|
container_name: ironmount
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
cap_add:
|
privileged: true
|
||||||
- SYS_ADMIN
|
|
||||||
ports:
|
ports:
|
||||||
- "4096:4096"
|
- "4096:4096"
|
||||||
devices:
|
|
||||||
- /dev/fuse:/dev/fuse
|
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- /run/docker/plugins:/run/docker/plugins
|
- /run/docker/plugins:/run/docker/plugins
|
||||||
- /var/lib/ironmount/volumes/:/var/lib/ironmount/volumes:rshared
|
- /var/lib/ironmount/volumes/:/var/lib/ironmount/volumes:rslave
|
||||||
|
- /var/lib/repositories/:/var/lib/repositories
|
||||||
|
- /proc:/host/proc:ro
|
||||||
- ironmount_data:/data
|
- ironmount_data:/data
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
Reference in New Issue
Block a user