Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #18

Merged
merged 4 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules
config/*
config
web/inc/*
*.log
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ RUN npm ci
RUN rc-update add sysctl
RUN rc-update add docker

# Ensure entrypoint is executable
RUN chmod +x /usr/src/app/entrypoint.sh

# Set the entrypoint of the container
ENTRYPOINT ["/usr/src/app/entrypoint.sh"]
10 changes: 6 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/bin/sh

# Start wireguard interface using the /etc/wireguard/wg.conf configuration file
wg-quick up /etc/wireguard/wg0.conf
# Enable docker daemon, redirect output to /dev/null
dockerd >/dev/null 2>&1 &

# Enable IP forwarding
echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
service networking restart
sudo sysctl -w net.ipv4.ip_forward=1

# Route all outgoing docker traffic through the wireguard interface, or not at all
iptables -A FORWARD -i wg0 -o docker0 -j ACCEPT
Expand All @@ -14,5 +13,8 @@ iptables -A FORWARD -i wg0 -o eth0 -j ACCEPT
iptables -A FORWARD -i eth0 -o wg0 -j ACCEPT
iptables -P FORWARD DROP

# Start wireguard interface using the /etc/wireguard/wg.conf configuration file
wg-quick up /etc/wireguard/wg0.conf

# Start node.js main webapp
node /usr/src/app/server.js
2 changes: 2 additions & 0 deletions extension/dockerode.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ async function containerGetName(containerId) {

async function containerCreate() {
try {
if (!isRunning) return; // Break if Docker is not running

// Create a new Docker container with the --rm flag
const container = await docker.createContainer({
Image: imageName,
Expand Down
Loading