Compare commits
2 Commits
94af2a2065
...
1eb76ea122
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1eb76ea122 | ||
|
|
acf7b28086 |
Submodule apps/ws-scrcpy deleted from ef273d97c6
6
apps/ws-scrcpy/config.yaml
Normal file
6
apps/ws-scrcpy/config.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
runGoogTracker: true
|
||||||
|
runApplTracker: false
|
||||||
|
|
||||||
|
server:
|
||||||
|
- secure: false
|
||||||
|
port: 8000
|
||||||
13
apps/ws-scrcpy/entrypoint.sh
Normal file
13
apps/ws-scrcpy/entrypoint.sh
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
adb start-server
|
||||||
|
|
||||||
|
if [ -n "$ADB_DEVICE_HOST" ]; then
|
||||||
|
echo "Connecting to ADB device at $ADB_DEVICE_HOST:${ADB_DEVICE_PORT:-5555}"
|
||||||
|
adb connect "$ADB_DEVICE_HOST:${ADB_DEVICE_PORT:-5555}"
|
||||||
|
sleep 2
|
||||||
|
adb devices
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec node index.js
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
FROM node:25.6.1-bookworm-slim AS app-builder
|
|
||||||
|
|
||||||
ARG ANDROID_SDK_ROOT=/opt/android-sdk
|
|
||||||
ARG ANDROID_CMDLINE_TOOLS_VERSION=13114758
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
||||||
bash \
|
|
||||||
ca-certificates \
|
|
||||||
curl \
|
|
||||||
git \
|
|
||||||
openjdk-17-jdk \
|
|
||||||
unzip \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
|
|
||||||
ENV ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}
|
|
||||||
ENV ANDROID_HOME=${ANDROID_SDK_ROOT}
|
|
||||||
ENV PATH=${JAVA_HOME}/bin:${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin:${ANDROID_SDK_ROOT}/platform-tools:${PATH}
|
|
||||||
|
|
||||||
RUN mkdir -p ${ANDROID_SDK_ROOT}/cmdline-tools /tmp/android-sdk && \
|
|
||||||
curl -fsSL -o /tmp/android-sdk/cmdline-tools.zip \
|
|
||||||
https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_CMDLINE_TOOLS_VERSION}_latest.zip && \
|
|
||||||
unzip -q /tmp/android-sdk/cmdline-tools.zip -d /tmp/android-sdk && \
|
|
||||||
mv /tmp/android-sdk/cmdline-tools ${ANDROID_SDK_ROOT}/cmdline-tools/latest && \
|
|
||||||
yes | sdkmanager --licenses > /dev/null && \
|
|
||||||
sdkmanager \
|
|
||||||
"platform-tools" \
|
|
||||||
"platforms;android-36" \
|
|
||||||
"build-tools;36.0.0" && \
|
|
||||||
rm -rf /tmp/android-sdk
|
|
||||||
|
|
||||||
RUN npm i -g pnpm
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml turbo.json ./
|
|
||||||
COPY apps/app-builder/package.json ./apps/app-builder/package.json
|
|
||||||
COPY packages ./packages
|
|
||||||
|
|
||||||
RUN pnpm install --frozen-lockfile
|
|
||||||
|
|
||||||
COPY apps/app-builder ./apps/app-builder
|
|
||||||
COPY mobile ./mobile
|
|
||||||
|
|
||||||
EXPOSE 3000
|
|
||||||
|
|
||||||
CMD ["pnpm", "--filter", "@apps/app-builder", "run", "prod"]
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
FROM node:25.6.1-alpine AS deps
|
|
||||||
|
|
||||||
RUN npm i -g pnpm
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml turbo.json ./
|
|
||||||
|
|
||||||
COPY apps/processor/package.json ./apps/processor/package.json
|
|
||||||
|
|
||||||
COPY packages ./packages
|
|
||||||
|
|
||||||
RUN pnpm install --frozen-lockfile
|
|
||||||
|
|
||||||
COPY apps/processor ./apps/processor
|
|
||||||
|
|
||||||
RUN pnpm install
|
|
||||||
|
|
||||||
EXPOSE 3000
|
|
||||||
|
|
||||||
CMD ["pnpm", "--filter", "@apps/processor", "run", "prod"]
|
|
||||||
27
dockerfiles/ws-scrcpy.Dockerfile
Normal file
27
dockerfiles/ws-scrcpy.Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
FROM node:25-bookworm
|
||||||
|
|
||||||
|
# System deps: ADB for device communication, build tools for native modules (node-pty)
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y android-tools-adb python3 make g++ git && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Clone and build ws-scrcpy
|
||||||
|
WORKDIR /build
|
||||||
|
RUN git clone --depth 1 https://github.com/NetrisTV/ws-scrcpy.git . && \
|
||||||
|
npm install && \
|
||||||
|
npm run dist:prod
|
||||||
|
|
||||||
|
# Set up runtime
|
||||||
|
WORKDIR /app
|
||||||
|
RUN cp -r /build/dist/* . && \
|
||||||
|
npm install && \
|
||||||
|
rm -rf /build
|
||||||
|
|
||||||
|
# Copy config and entrypoint from repo
|
||||||
|
COPY apps/ws-scrcpy/config.yaml /app/config.yaml
|
||||||
|
COPY apps/ws-scrcpy/entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
@@ -1,5 +1,89 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Detect version from environment variable or detect latest stable from GitHub
|
||||||
|
# Usage with curl (export first): export DOKPLOY_VERSION=canary && curl -sSL https://dokploy.com/install.sh | sh
|
||||||
|
# Usage with curl (export first): export DOKPLOY_VERSION=latest && curl -sSL https://dokploy.com/install.sh | sh
|
||||||
|
# Usage with curl (bash -s): DOKPLOY_VERSION=canary bash -s < <(curl -sSL https://dokploy.com/install.sh)
|
||||||
|
# Usage with curl (default): curl -sSL https://dokploy.com/install.sh | sh (detects latest stable version)
|
||||||
|
# Usage with bash: DOKPLOY_VERSION=canary bash install.sh
|
||||||
|
# Usage with bash: DOKPLOY_VERSION=latest bash install.sh
|
||||||
|
# Usage with bash: bash install.sh (detects latest stable version)
|
||||||
|
detect_version() {
|
||||||
|
local version="${DOKPLOY_VERSION}"
|
||||||
|
|
||||||
|
# If no version specified, get latest stable version from GitHub releases
|
||||||
|
if [ -z "$version" ]; then
|
||||||
|
echo "Detecting latest stable version from GitHub..." >&2
|
||||||
|
|
||||||
|
# Try to get latest release from GitHub by following redirects
|
||||||
|
version=$(curl -fsSL -o /dev/null -w '%{url_effective}\n' \
|
||||||
|
https://github.com/dokploy/dokploy/releases/latest 2>/dev/null | \
|
||||||
|
sed 's#.*/tag/##')
|
||||||
|
|
||||||
|
# Fallback to latest tag if detection fails
|
||||||
|
if [ -z "$version" ]; then
|
||||||
|
echo "Warning: Could not detect latest version from GitHub, using fallback version latest" >&2
|
||||||
|
version="latest"
|
||||||
|
else
|
||||||
|
echo "Latest stable version detected: $version" >&2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$version"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to detect if running in Proxmox LXC container
|
||||||
|
is_proxmox_lxc() {
|
||||||
|
# Check for LXC in environment
|
||||||
|
if [ -n "$container" ] && [ "$container" = "lxc" ]; then
|
||||||
|
return 0 # LXC container
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for LXC in /proc/1/environ
|
||||||
|
if grep -q "container=lxc" /proc/1/environ 2>/dev/null; then
|
||||||
|
return 0 # LXC container
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1 # Not LXC
|
||||||
|
}
|
||||||
|
|
||||||
|
generate_random_password() {
|
||||||
|
# Generate a secure random password using multiple methods with fallbacks
|
||||||
|
local password=""
|
||||||
|
|
||||||
|
# Try using openssl (most reliable, available on most systems)
|
||||||
|
if command -v openssl >/dev/null 2>&1; then
|
||||||
|
password=$(openssl rand -base64 32 | tr -d "=+/" | cut -c1-32)
|
||||||
|
# Fallback to /dev/urandom with tr (most Linux systems)
|
||||||
|
elif [ -r /dev/urandom ]; then
|
||||||
|
password=$(tr -dc 'A-Za-z0-9' < /dev/urandom | head -c 32)
|
||||||
|
# Last resort fallback using date and simple hashing
|
||||||
|
else
|
||||||
|
if command -v sha256sum >/dev/null 2>&1; then
|
||||||
|
password=$(date +%s%N | sha256sum | base64 | head -c 32)
|
||||||
|
elif command -v shasum >/dev/null 2>&1; then
|
||||||
|
password=$(date +%s%N | shasum -a 256 | base64 | head -c 32)
|
||||||
|
else
|
||||||
|
# Very basic fallback - combines multiple sources of entropy
|
||||||
|
password=$(echo "$(date +%s%N)-$(hostname)-$$-$RANDOM" | base64 | tr -d "=+/" | head -c 32)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure we got a password of correct length
|
||||||
|
if [ -z "$password" ] || [ ${#password} -lt 20 ]; then
|
||||||
|
echo "Error: Failed to generate random password" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$password"
|
||||||
|
}
|
||||||
|
|
||||||
install_dokploy() {
|
install_dokploy() {
|
||||||
|
# Detect version tag
|
||||||
|
VERSION_TAG=$(detect_version)
|
||||||
|
DOCKER_IMAGE="dokploy/dokploy:${VERSION_TAG}"
|
||||||
|
|
||||||
|
echo "Installing Dokploy version: ${VERSION_TAG}"
|
||||||
if [ "$(id -u)" != "0" ]; then
|
if [ "$(id -u)" != "0" ]; then
|
||||||
echo "This script must be run as root" >&2
|
echo "This script must be run as root" >&2
|
||||||
exit 1
|
exit 1
|
||||||
@@ -43,9 +127,22 @@ install_dokploy() {
|
|||||||
if command_exists docker; then
|
if command_exists docker; then
|
||||||
echo "Docker already installed"
|
echo "Docker already installed"
|
||||||
else
|
else
|
||||||
curl -sSL https://get.docker.com | sh
|
curl -sSL https://get.docker.com | sh -s -- --version 28.5.0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if running in Proxmox LXC container and set endpoint mode
|
||||||
|
endpoint_mode=""
|
||||||
|
if is_proxmox_lxc; then
|
||||||
|
echo "⚠️ WARNING: Detected Proxmox LXC container environment!"
|
||||||
|
echo "Adding --endpoint-mode dnsrr to Docker services for LXC compatibility."
|
||||||
|
echo "This may affect service discovery but is required for LXC containers."
|
||||||
|
echo ""
|
||||||
|
endpoint_mode="--endpoint-mode dnsrr"
|
||||||
|
echo "Waiting for 5 seconds before continuing..."
|
||||||
|
sleep 5
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
docker swarm leave --force 2>/dev/null
|
docker swarm leave --force 2>/dev/null
|
||||||
|
|
||||||
get_ip() {
|
get_ip() {
|
||||||
@@ -91,13 +188,31 @@ install_dokploy() {
|
|||||||
echo "$ip"
|
echo "$ip"
|
||||||
}
|
}
|
||||||
|
|
||||||
advertise_addr="${ADVERTISE_ADDR:-$(get_ip)}"
|
get_private_ip() {
|
||||||
|
ip addr show | grep -E "inet (192\.168\.|10\.|172\.1[6-9]\.|172\.2[0-9]\.|172\.3[0-1]\.)" | head -n1 | awk '{print $2}' | cut -d/ -f1
|
||||||
|
}
|
||||||
|
|
||||||
|
advertise_addr="${ADVERTISE_ADDR:-$(get_private_ip)}"
|
||||||
|
|
||||||
|
if [ -z "$advertise_addr" ]; then
|
||||||
|
echo "ERROR: We couldn't find a private IP address."
|
||||||
|
echo "Please set the ADVERTISE_ADDR environment variable manually."
|
||||||
|
echo "Example: export ADVERTISE_ADDR=192.168.1.100"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
echo "Using advertise address: $advertise_addr"
|
echo "Using advertise address: $advertise_addr"
|
||||||
|
|
||||||
docker swarm init \
|
# Allow custom Docker Swarm init arguments via DOCKER_SWARM_INIT_ARGS environment variable
|
||||||
--advertise-addr $advertise_addr \
|
# Example: export DOCKER_SWARM_INIT_ARGS="--default-addr-pool 172.20.0.0/16 --default-addr-pool-mask-length 24"
|
||||||
--default-addr-pool 10.200.0.0/16 \
|
# This is useful to avoid CIDR overlapping with cloud provider VPCs (e.g., AWS)
|
||||||
--default-addr-pool-mask-length 24
|
swarm_init_args="${DOCKER_SWARM_INIT_ARGS:-}"
|
||||||
|
|
||||||
|
if [ -n "$swarm_init_args" ]; then
|
||||||
|
echo "Using custom swarm init arguments: $swarm_init_args"
|
||||||
|
docker swarm init --advertise-addr $advertise_addr $swarm_init_args
|
||||||
|
else
|
||||||
|
docker swarm init --advertise-addr $advertise_addr
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Error: Failed to initialize Docker Swarm" >&2
|
echo "Error: Failed to initialize Docker Swarm" >&2
|
||||||
@@ -107,7 +222,7 @@ install_dokploy() {
|
|||||||
echo "Swarm initialized"
|
echo "Swarm initialized"
|
||||||
|
|
||||||
docker network rm -f dokploy-network 2>/dev/null
|
docker network rm -f dokploy-network 2>/dev/null
|
||||||
docker network create --driver overlay --attachable --subnet 10.201.0.0/16 dokploy-network
|
docker network create --driver overlay --attachable dokploy-network
|
||||||
|
|
||||||
echo "Network created"
|
echo "Network created"
|
||||||
|
|
||||||
@@ -116,7 +231,7 @@ install_dokploy() {
|
|||||||
chmod 777 /etc/dokploy
|
chmod 777 /etc/dokploy
|
||||||
|
|
||||||
# Generate secure random password for Postgres
|
# Generate secure random password for Postgres
|
||||||
POSTGRES_PASSWORD=$(openssl rand -base64 32 | tr -d "=+/" | cut -c1-32)
|
POSTGRES_PASSWORD=$(generate_random_password)
|
||||||
|
|
||||||
# Store password as Docker Secret (encrypted and secure)
|
# Store password as Docker Secret (encrypted and secure)
|
||||||
echo "$POSTGRES_PASSWORD" | docker secret create dokploy_postgres_password - 2>/dev/null || true
|
echo "$POSTGRES_PASSWORD" | docker secret create dokploy_postgres_password - 2>/dev/null || true
|
||||||
@@ -132,6 +247,7 @@ install_dokploy() {
|
|||||||
--secret source=dokploy_postgres_password,target=/run/secrets/postgres_password \
|
--secret source=dokploy_postgres_password,target=/run/secrets/postgres_password \
|
||||||
--env POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password \
|
--env POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password \
|
||||||
--mount type=volume,source=dokploy-postgres,target=/var/lib/postgresql/data \
|
--mount type=volume,source=dokploy-postgres,target=/var/lib/postgresql/data \
|
||||||
|
$endpoint_mode \
|
||||||
postgres:16
|
postgres:16
|
||||||
|
|
||||||
docker service create \
|
docker service create \
|
||||||
@@ -139,9 +255,20 @@ install_dokploy() {
|
|||||||
--constraint 'node.role==manager' \
|
--constraint 'node.role==manager' \
|
||||||
--network dokploy-network \
|
--network dokploy-network \
|
||||||
--mount type=volume,source=dokploy-redis,target=/data \
|
--mount type=volume,source=dokploy-redis,target=/data \
|
||||||
|
$endpoint_mode \
|
||||||
redis:7
|
redis:7
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
# Set RELEASE_TAG environment variable for canary/feature versions
|
||||||
|
release_tag_env=""
|
||||||
|
if [[ "$VERSION_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
|
||||||
|
# Specific version (v0.26.6, v0.26.7, etc.) → latest
|
||||||
|
release_tag_env="-e RELEASE_TAG=latest"
|
||||||
|
elif [ "$VERSION_TAG" != "latest" ]; then
|
||||||
|
# canary, feature/*, etc. → use the tag as-is
|
||||||
|
release_tag_env="-e RELEASE_TAG=$VERSION_TAG"
|
||||||
|
fi
|
||||||
|
|
||||||
docker service create \
|
docker service create \
|
||||||
--name dokploy \
|
--name dokploy \
|
||||||
--replicas 1 \
|
--replicas 1 \
|
||||||
@@ -154,10 +281,13 @@ install_dokploy() {
|
|||||||
--update-parallelism 1 \
|
--update-parallelism 1 \
|
||||||
--update-order stop-first \
|
--update-order stop-first \
|
||||||
--constraint 'node.role == manager' \
|
--constraint 'node.role == manager' \
|
||||||
|
$endpoint_mode \
|
||||||
|
$release_tag_env \
|
||||||
-e ADVERTISE_ADDR=$advertise_addr \
|
-e ADVERTISE_ADDR=$advertise_addr \
|
||||||
-e POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password \
|
-e POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password \
|
||||||
dokploy/dokploy:latest
|
$DOCKER_IMAGE
|
||||||
|
|
||||||
|
sleep 4
|
||||||
|
|
||||||
docker run -d \
|
docker run -d \
|
||||||
--name dokploy-traefik \
|
--name dokploy-traefik \
|
||||||
@@ -180,7 +310,7 @@ install_dokploy() {
|
|||||||
# --network dokploy-network \
|
# --network dokploy-network \
|
||||||
# --mount type=bind,source=/etc/dokploy/traefik/traefik.yml,target=/etc/traefik/traefik.yml \
|
# --mount type=bind,source=/etc/dokploy/traefik/traefik.yml,target=/etc/traefik/traefik.yml \
|
||||||
# --mount type=bind,source=/etc/dokploy/traefik/dynamic,target=/etc/dokploy/traefik/dynamic \
|
# --mount type=bind,source=/etc/dokploy/traefik/dynamic,target=/etc/dokploy/traefik/dynamic \
|
||||||
# --mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock,readonly \
|
# --mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
|
||||||
# --publish mode=host,published=443,target=443 \
|
# --publish mode=host,published=443,target=443 \
|
||||||
# --publish mode=host,published=80,target=80 \
|
# --publish mode=host,published=80,target=80 \
|
||||||
# --publish mode=host,published=443,target=443,protocol=udp \
|
# --publish mode=host,published=443,target=443,protocol=udp \
|
||||||
@@ -202,7 +332,8 @@ install_dokploy() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
formatted_addr=$(format_ip_for_url "$advertise_addr")
|
public_ip="${ADVERTISE_ADDR:-$(get_ip)}"
|
||||||
|
formatted_addr=$(format_ip_for_url "$public_ip")
|
||||||
echo ""
|
echo ""
|
||||||
printf "${GREEN}Congratulations, Dokploy is installed!${NC}\n"
|
printf "${GREEN}Congratulations, Dokploy is installed!${NC}\n"
|
||||||
printf "${BLUE}Wait 15 seconds for the server to start${NC}\n"
|
printf "${BLUE}Wait 15 seconds for the server to start${NC}\n"
|
||||||
@@ -210,15 +341,19 @@ install_dokploy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_dokploy() {
|
update_dokploy() {
|
||||||
echo "Updating Dokploy..."
|
# Detect version tag
|
||||||
|
VERSION_TAG=$(detect_version)
|
||||||
|
DOCKER_IMAGE="dokploy/dokploy:${VERSION_TAG}"
|
||||||
|
|
||||||
# Pull the latest image
|
echo "Updating Dokploy to version: ${VERSION_TAG}"
|
||||||
docker pull dokploy/dokploy:latest
|
|
||||||
|
# Pull the image
|
||||||
|
docker pull $DOCKER_IMAGE
|
||||||
|
|
||||||
# Update the service
|
# Update the service
|
||||||
docker service update --image dokploy/dokploy:latest dokploy
|
docker service update --image $DOCKER_IMAGE dokploy
|
||||||
|
|
||||||
echo "Dokploy has been updated to the latest version."
|
echo "Dokploy has been updated to version: ${VERSION_TAG}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Main script execution
|
# Main script execution
|
||||||
Reference in New Issue
Block a user