Skip to content

Commit 8f2369b

Browse files
committed
Update root to align with docker-netbootxyz
1 parent d5616c3 commit 8f2369b

File tree

10 files changed

+121
-78
lines changed

10 files changed

+121
-78
lines changed

root/defaults/nginx.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
user abc;
1+
user nbxyz;
22
worker_processes 4;
33
pid /run/nginx.pid;
44
include /etc/nginx/modules/*.conf;

root/donate.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
opencollective: https://opencollective.com/netbootxyz/donate
2+
github: https://github.com/sponsors/netbootxyz

root/etc/cont-init.d/20-nginx-config

-18
This file was deleted.

root/etc/cont-init.d/35-dev-config

-6
This file was deleted.

root/etc/cont-init.d/36-download-menus

-41
This file was deleted.

root/etc/services.d/nginx/run

-2
This file was deleted.

root/etc/services.d/tftp/run

-4
This file was deleted.

root/etc/services.d/webapp/run

-6
This file was deleted.

root/etc/supervisor.conf

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[supervisord]
2+
nodaemon=true
3+
user=root
4+
5+
[program:syslog-ng]
6+
command=/usr/sbin/syslog-ng --foreground --no-caps
7+
stdout_syslog=true
8+
stdout_capture_maxbytes=1MB
9+
priority = 1
10+
11+
[program:nginx]
12+
command = /usr/sbin/nginx -c /config/nginx/nginx.conf
13+
startretries = 2
14+
daemon=off
15+
priority = 2
16+
17+
[program:webapp]
18+
environment=NODE_ENV="production",PORT=3000
19+
command=/usr/bin/node app.js
20+
user=nbxyz
21+
directory=/app
22+
priority = 3
23+
24+
[program:in.tftpd]
25+
command=/usr/sbin/in.tftpd -Lvvv --user nbxyz --secure %(ENV_TFTPD_OPTS)s /config/menus
26+
stdout_logfile=/config/tftpd.log
27+
redirect_stderr=true
28+
priority = 4
29+
30+
[program:messages-log]
31+
command=tail -f /var/log/messages
32+
stdout_logfile=/dev/stdout
33+
stdout_logfile_maxbytes=0

root/start.sh

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/bash
2+
3+
# make our folders
4+
mkdir -p \
5+
/assets \
6+
/config/nginx/site-confs \
7+
/config/log/nginx \
8+
/run \
9+
/var/lib/nginx/tmp/client_body \
10+
/var/tmp/nginx
11+
12+
# copy config files
13+
[[ ! -f /config/nginx/nginx.conf ]] && \
14+
cp /defaults/nginx.conf /config/nginx/nginx.conf
15+
[[ ! -f /config/nginx/site-confs/default ]] && \
16+
cp /defaults/default /config/nginx/site-confs/default
17+
18+
# Ownership
19+
chown -R nbxyz:nbxyz /assets
20+
chown -R nbxyz:nbxyz /var/lib/nginx
21+
chown -R nbxyz:nbxyz /var/log/nginx
22+
23+
# create local logs dir
24+
mkdir -p \
25+
/config/menus/remote \
26+
/config/menus/local
27+
28+
# download menus if not found
29+
if [[ ! -f /config/menus/remote/menu.ipxe ]]; then
30+
if [[ -z ${MENU_VERSION+x} ]]; then \
31+
MENU_VERSION=$(curl -sL "https://api.github.com/repos/netbootxyz/netboot.xyz/releases/latest" | jq -r '.tag_name')
32+
fi
33+
echo "[netbootxyz-init] Downloading netboot.xyz at ${MENU_VERSION}"
34+
# menu files
35+
curl -o \
36+
/config/endpoints.yml -sL \
37+
"https://raw.githubusercontent.com/netbootxyz/netboot.xyz/${MENU_VERSION}/endpoints.yml"
38+
curl -o \
39+
/tmp/menus.tar.gz -sL \
40+
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/menus.tar.gz"
41+
tar xf \
42+
/tmp/menus.tar.gz -C \
43+
/config/menus/remote
44+
# boot files
45+
curl -o \
46+
/config/menus/remote/netboot.xyz.kpxe -sL \
47+
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz.kpxe"
48+
curl -o \
49+
/config/menus/remote/netboot.xyz-undionly.kpxe -sL \
50+
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-undionly.kpxe"
51+
curl -o \
52+
/config/menus/remote/netboot.xyz.efi -sL \
53+
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz.efi"
54+
curl -o \
55+
/config/menus/remote/netboot.xyz-snp.efi -sL \
56+
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-snp.efi"
57+
curl -o \
58+
/config/menus/remote/netboot.xyz-snponly.efi -sL \
59+
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-snponly.efi"
60+
curl -o \
61+
/config/menus/remote/netboot.xyz-arm64.efi -sL \
62+
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-arm64.efi"
63+
curl -o \
64+
/config/menus/remote/netboot.xyz-arm64-snp.efi -sL \
65+
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-arm64-snp.efi"
66+
curl -o \
67+
/config/menus/remote/netboot.xyz-arm64-snponly.efi -sL \
68+
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-arm64-snponly.efi"
69+
# layer and cleanup
70+
echo -n ${MENU_VERSION} > /config/menuversion.txt
71+
cp -r /config/menus/remote/* /config/menus
72+
rm -f /tmp/menus.tar.gz
73+
fi
74+
75+
# Ownership
76+
chown -R nbxyz:nbxyz /config
77+
78+
echo " _ _ _ "
79+
echo " _ __ ___| |_| |__ ___ ___ | |_ __ ___ _ ____ "
80+
echo "| '_ \ / _ \ __| '_ \ / _ \ / _ \| __| \ \/ / | | |_ / "
81+
echo "| | | | __/ |_| |_) | (_) | (_) | |_ _ > <| |_| |/ / "
82+
echo "|_| |_|\___|\__|_.__/ \___/ \___/ \__(_)_/\_\\__, /___| "
83+
echo " |___/ "
84+
85+
supervisord -c /etc/supervisor.conf

0 commit comments

Comments
 (0)