Skip to content

Commit

Permalink
chore: store umbrelos deployment files
Browse files Browse the repository at this point in the history
  • Loading branch information
bochaco committed Jan 13, 2025
1 parent 62a9155 commit b226526
Show file tree
Hide file tree
Showing 5 changed files with 762 additions and 0 deletions.
52 changes: 52 additions & 0 deletions deploy/umbrelos/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
version: "3.7"

services:
app_proxy:
environment:
APP_HOST: formicaio-apps-formicaio_nginx_1
APP_PORT: 52100
container_name: formicaio-apps-formicaio_app_proxy_1
nginx:
image: nginx:alpine
volumes:
- ${APP_DATA_DIR}/nginx.conf:/etc/nginx/conf.d/default.conf
extra_hosts:
- host.docker.internal:host-gateway
container_name: formicaio-apps-formicaio_nginx_1
docker:
image: >-
docker:27.4.1-dind@sha256:3c8fb358b82767a38189e54a89a2ba8d71109f0a17efa87fd009ef8283c46df6
privileged: true
network_mode: host
stop_grace_period: 1m
restart: on-failure
environment:
DOCKER_ENSURE_BRIDGE: dind0:10.32.0.1/16
entrypoint: /entrypoint.sh
command: |
dockerd
--bridge dind0
--data-root /data/data
--exec-root /data/exec
--host unix:///data/docker.sock
--pidfile /data/docker.pid
volumes:
- ${APP_DATA_DIR}/entrypoint.sh:/entrypoint.sh
- ${APP_DATA_DIR}/data/docker:/data
container_name: formicaio-apps-formicaio_docker_1
formicaio:
image: bochaco/formicaio:latest
privileged: true
network_mode: host
restart: on-failure
stop_grace_period: 5s
environment:
NODE_CONTAINER_IMAGE_TAG: latest
DOCKER_SOCKET_PATH: /var/run/docker.sock
DB_PATH: /data
volumes:
- ${APP_DATA_DIR}/data/formicaio:/data
- ${APP_DATA_DIR}/data/docker:/var/run
devices:
- /dev:/dev
container_name: formicaio-apps-formicaio_formicaio_1
47 changes: 47 additions & 0 deletions deploy/umbrelos/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/sh

# This hack can be removed if https://github.com/docker-library/docker/pull/444 gets merged.

# Remove docker pidfile if it exists to ensure Docker can start up after a bad shutdown
pidfile="/var/run/docker.pid"
if [[ -f "${pidfile}" ]]
then
rm -f "${pidfile}"
fi

# Use nftables as the backend for iptables
for command in iptables iptables-restore iptables-restore-translate iptables-save iptables-translate
do
ln -sf /sbin/xtables-nft-multi /sbin/$command
done

# Ensure that a bridge exists with the given name
ensure_bridge_exists() {
local name="${1}"
local ip_range="${2}"

# Check if the bridge already exists
if ip link show "${name}" &>/dev/null
then
echo "Bridge '${name}' already exists. Skipping creation."
ip addr show "${name}"
return
fi

echo "Bridge '${name}' does not exist. Creating..."
ip link add "${name}" type bridge
ip addr add "${ip_range}" dev "${name}"
ip link set "${name}" up

echo "Bridge '${name}' is now up with IP range '${ip_range}'."
ip addr show "${name}"
}

if [[ "${DOCKER_ENSURE_BRIDGE}" != "" ]]
then
bridge="${DOCKER_ENSURE_BRIDGE%%:*}"
ip_range="${DOCKER_ENSURE_BRIDGE#*:}"
ensure_bridge_exists "${bridge}" "${ip_range}"
fi

exec dockerd-entrypoint.sh $@
Loading

0 comments on commit b226526

Please sign in to comment.