fickit: add helper script to simplify nsenter
This commit is contained in:
parent
6e612df2e9
commit
9784310dc0
19
configs/nsenter_iptables.sh
Executable file
19
configs/nsenter_iptables.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -d /containers/onboot/004-admin-ip-setup ]; then
|
||||||
|
LOWER=/containers/onboot/004-admin-ip-setup
|
||||||
|
elif [ -d /containers/onboot/004-nginx-ip-setup ]; then
|
||||||
|
LOWER=/containers/onboot/004-nginx-ip-setup
|
||||||
|
else
|
||||||
|
nsenter -t 1 -a "$0" $@
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
mount -t tmpfs none $LOWER/run
|
||||||
|
|
||||||
|
chroot $LOWER iptables $@
|
||||||
|
EXIT=$?
|
||||||
|
|
||||||
|
umount $LOWER/run
|
||||||
|
|
||||||
|
exit ${EXIT}
|
3
configs/nsenter_mysql.sh
Executable file
3
configs/nsenter_mysql.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
nsenter -t $(pgrep mysql | head -1) -a mysql $@
|
7
configs/nsenter_process.sh
Executable file
7
configs/nsenter_process.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PROC="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
nsenter -t $(pgrep "$PROC" | head -1) $@
|
||||||
|
exit $?
|
@ -237,6 +237,9 @@ services:
|
|||||||
binds:
|
binds:
|
||||||
- /etc/hosts:/etc/hosts:ro
|
- /etc/hosts:/etc/hosts:ro
|
||||||
- /root/.ssh/:/root/.ssh/:ro
|
- /root/.ssh/:/root/.ssh/:ro
|
||||||
|
- /usr/bin/iptables:/usr/bin/iptables:ro
|
||||||
|
- /usr/bin/mysql:/usr/bin/mysql:ro
|
||||||
|
- /usr/bin/pnsenter:/usr/bin/pnsenter:ro
|
||||||
- /var/lib/fic/outofsync:/var/lib/fic/outofsync
|
- /var/lib/fic/outofsync:/var/lib/fic/outofsync
|
||||||
- /var/lib/fic/raw_files:/mnt/fic
|
- /var/lib/fic/raw_files:/mnt/fic
|
||||||
capabilities:
|
capabilities:
|
||||||
@ -280,6 +283,16 @@ files:
|
|||||||
source: configs/id_ed25519
|
source: configs/id_ed25519
|
||||||
mode: "0400"
|
mode: "0400"
|
||||||
|
|
||||||
|
- path: usr/bin/iptables
|
||||||
|
source: configs/nsenter_iptables.sh
|
||||||
|
mode: "0755"
|
||||||
|
- path: usr/bin/mysql
|
||||||
|
source: configs/nsenter_mysql.sh
|
||||||
|
mode: "0755"
|
||||||
|
- path: usr/bin/pnsenter
|
||||||
|
source: configs/nsenter_process.sh
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
- path: etc/mysql/conf.d/max-conn.cnf
|
- path: etc/mysql/conf.d/max-conn.cnf
|
||||||
contents: |
|
contents: |
|
||||||
[mysqld]
|
[mysqld]
|
||||||
|
@ -405,6 +405,13 @@ files:
|
|||||||
source: frontend/static/robots.txt
|
source: frontend/static/robots.txt
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
|
|
||||||
|
- path: usr/bin/iptables
|
||||||
|
source: configs/nsenter_iptables.sh
|
||||||
|
mode: "0755"
|
||||||
|
- path: usr/bin/pnsenter
|
||||||
|
source: configs/nsenter_process.sh
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
- path: etc/dhcpcd.conf
|
- path: etc/dhcpcd.conf
|
||||||
contents: |
|
contents: |
|
||||||
allowinterfaces internet
|
allowinterfaces internet
|
||||||
|
Loading…
x
Reference in New Issue
Block a user