Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d339e3f
add sequelize orm package
runleveldev Oct 20, 2025
f872120
initialize sequelize-cli
runleveldev Oct 21, 2025
1864049
add services models
runleveldev Oct 21, 2025
1116eaa
fix config path
runleveldev Oct 21, 2025
8062fef
flatten services model
runleveldev Oct 21, 2025
2d583a9
fix service model definition
runleveldev Oct 22, 2025
50ace75
add json-to-sql script
runleveldev Oct 22, 2025
bd4421b
remove pointless envvar check
runleveldev Oct 22, 2025
08e81d0
add ejs dependency
runleveldev Oct 22, 2025
9306124
add containers index page
runleveldev Oct 22, 2025
19aac49
fix logo path
runleveldev Oct 22, 2025
72e29a5
simplify logout form handling
runleveldev Oct 22, 2025
2db0c5e
unify page styles
runleveldev Oct 22, 2025
e2f7200
add missing fields to the container model
runleveldev Oct 22, 2025
8df1112
new container form improvements
runleveldev Oct 22, 2025
024b4df
fix aiContainer fields in container model
runleveldev Oct 22, 2025
4fa2e4f
remove ssh public key support from the html frontend
runleveldev Oct 22, 2025
02b492a
database update handling
runleveldev Oct 23, 2025
9ad86c2
fix form redirect handling
runleveldev Oct 23, 2025
186d6f9
remove unused body-parser import
runleveldev Oct 23, 2025
c57cb32
document extra .env settings
runleveldev Oct 23, 2025
bb1187c
remove duplicate services.json file
runleveldev Oct 23, 2025
55aa6c0
fix ratelmiting
runleveldev Oct 23, 2025
ff38269
remove unused import
runleveldev Oct 24, 2025
acf8af6
group statements
runleveldev Oct 24, 2025
7f64710
replace portmap.js with static templates
runleveldev Oct 24, 2025
955703f
Merge branch 'main' into 59-nginx-reverse-proxycreate-a-container-sha…
runleveldev Oct 24, 2025
29e75b3
add nginx-reverse-proxy README
runleveldev Oct 24, 2025
d7fbdc2
add create-a-container README
runleveldev Oct 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -150,81 +150,33 @@ if [ ! -z "$ADDITIONAL_PROTOCOLS" ]; then
ss_protocols="$(IFS=, ; echo "${list_all_protocols[*]}")"
ss_ports="$(IFS=, ; echo "${list_all_ports[*]}")"

#Update NGINX port map JSON on the remote host safely using a heredoc and positional parameters

ssh [email protected] bash -s -- "$hostname" "$container_ip" "$ssh_port" "$http_port" "$ss_protocols" "$ss_ports" "$proxmox_user" "$os_release" "$CTID" "$mac" <<'EOF'
set -euo pipefail

hostname="$1"
container_ip="$2"
ssh_port="$3"
http_port="$4"
protos_json=$(echo "$5" | tr ',' '\n' | jq -R . | jq -s .)
ports_json=$(echo "$6" | tr ',' '\n' | jq -R . | jq -s 'map(tonumber)')
user="$7"
os_release="$8"
ctid="$9"
mac="${10}"

jq --arg hn "$hostname" \
--arg ip "$container_ip" \
--arg user "$user" \
--arg osr "$os_release" \
--argjson ssh "$ssh_port" \
--argjson http "$http_port" \
--argjson protos "$protos_json" \
--argjson ports_list "$ports_json" \
--argjson ctid "$ctid" \
--arg mac "$mac" \
'. + {($hn): {
ip: $ip,
user: $user,
os_release: $osr,
ctid: $ctid,
mac: $mac,
ports: ( reduce range(0; $protos | length) as $i (
{ssh: $ssh, http: $http};
. + { ($protos[$i]): $ports_list[$i]}
))
}}' /etc/nginx/port_map.json > /tmp/port_map.json.new

mv -f /tmp/port_map.json.new /etc/nginx/port_map.json
nginx -s reload
EOF
# Register container with additional protocols via API
curl -X POST https://create-a-container.opensource.mieweb.org/containers \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "hostname=$hostname" \
--data-urlencode "ipv4Address=$container_ip" \
--data-urlencode "username=$proxmox_user" \
--data-urlencode "osRelease=$os_release" \
--data-urlencode "containerId=$CTID" \
--data-urlencode "macAddress=$mac" \
--data-urlencode "aiContainer=$AI_CONTAINER" \
--data-urlencode "sshPort=$ssh_port" \
--data-urlencode "httpPort=$http_port" \
--data-urlencode "additionalProtocols=$ss_protocols" \
--data-urlencode "additionalPorts=$ss_ports"
else
# Update NGINX port map JSON on the remote host safely using a heredoc and positional parameters
ssh [email protected] bash -s -- "$hostname" "$container_ip" "$ssh_port" "$http_port" "$proxmox_user" "$os_release" "$CTID" "$mac" <<'EOF'
set -euo pipefail

hostname="$1"
container_ip="$2"
ssh_port="$3"
http_port="$4"
user="$5"
os_release="$6"
ctid="$7"
mac="$8"

jq --arg hn "$hostname" \
--arg ip "$container_ip" \
--arg user "$user" \
--arg osr "$os_release" \
--argjson http "$http_port" \
--argjson ssh "$ssh_port" \
--argjson ctid "$ctid" \
--arg mac "$mac" \
'. + {($hn): {
ip: $ip,
user: $user,
os_release: $osr,
ctid: $ctid,
mac: $mac,
ports: {ssh: $ssh, http: $http}
}}' /etc/nginx/port_map.json > /tmp/port_map.json.new

mv -f /tmp/port_map.json.new /etc/nginx/port_map.json
nginx -s reload
EOF
# Register container without additional protocols via API
curl -X POST https://create-a-container.opensource.mieweb.org/containers \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "hostname=$hostname" \
--data-urlencode "ipv4Address=$container_ip" \
--data-urlencode "username=$proxmox_user" \
--data-urlencode "osRelease=$os_release" \
--data-urlencode "containerId=$CTID" \
--data-urlencode "macAddress=$mac" \
--data-urlencode "aiContainer=$AI_CONTAINER" \
--data-urlencode "sshPort=$ssh_port" \
--data-urlencode "httpPort=$http_port"
fi

# Results
Expand Down
Loading