Skip to content

perf(db): close panel database connections after a minute idle #198

perf(db): close panel database connections after a minute idle

perf(db): close panel database connections after a minute idle #198

name: Bun Migration Docker Check
on:
workflow_dispatch:
inputs:
railpack-frontend:
description: "Railpack frontend for the sample app build, e.g. a version existing applications keep (empty: the image's Railpack version)"
type: string
default: ""
pull_request:
branches: [AgentHits-Dev]
paths:
- ".github/workflows/bun-migration-docker-check.yml"
- ".trivyignore.yaml"
- "Dockerfile"
- "Dockerfile.cloud"
- "Dockerfile.server"
- "Dockerfile.schedule"
- "apps/**"
- "packages/**"
- "package.json"
- "bun.lock"
# Tests and docs never reach an image; rebuilding all four images for
# them only delays the PR by ~6 minutes. Negations must come last.
- "!apps/dokploy/__test__/**"
- "!**/*.md"
permissions:
contents: read
jobs:
main-image-smoke:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Prepare production env file
run: |
cp apps/dokploy/.env.production.example .env.production
cp apps/dokploy/.env.production.example apps/dokploy/.env.production
echo "POSTGRES_PASSWORD=build-time-postgres-password" >> .env.production
echo "POSTGRES_PASSWORD=build-time-postgres-password" >> apps/dokploy/.env.production
- name: Build main image for smoke
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
load: true
push: false
tags: dokploy-bun-check:main
build-args: |
DOKPLOY_OFFICIAL_VERSION=ci-bun-check
DOKPLOY_FORK_VERSION=ci-bun-check
- name: Smoke main image
run: |
docker run --rm --entrypoint bun dokploy-bun-check:main --version
docker run --rm --entrypoint sh dokploy-bun-check:main -lc '
test -f /app/packages/server/dist/index.js
node --input-type=module -e "console.log(await import.meta.resolve(\"@dokploy/server\"))"
'
# The panel calls these at runtime; the image installs them without
# apt recommends and without the Docker engine.
docker run --rm --entrypoint sh dokploy-bun-check:main -ec '
docker --version
docker buildx version
docker compose version
rclone version | head -n 1
railpack --version
pack --version
nixpacks --version
git lfs version
ssh -V
for tool in ssh-keyscan pkill htpasswd rsync jq zip unzip ip tini; do command -v "$tool"; done
'
# Repeats the panel's Railpack path (railpack prepare, then buildx with the
# Railpack frontend on a docker-container builder) from inside the image,
# so a Railpack bump that cannot build a plain Node app fails here.
- name: Build a sample app with Railpack
env:
RAILPACK_FRONTEND: ${{ inputs.railpack-frontend }}
run: |
app="$RUNNER_TEMP/railpack-app"
mkdir -p "$app"
printf '%s\n' '{"name":"railpack-smoke","private":true,"scripts":{"start":"node index.js"}}' > "$app/package.json"
printf '%s\n' 'require("node:http").createServer((_, res) => res.end("railpack-ok")).listen(process.env.PORT || 3000);' > "$app/index.js"
frontend="${RAILPACK_FRONTEND:-$(docker run --rm --entrypoint railpack dokploy-bun-check:main --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -n 1)}"
echo "Railpack frontend: $frontend"
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v "$app:/src" -e FRONTEND="$frontend" --entrypoint sh dokploy-bun-check:main -ec '
railpack prepare /src --plan-out /src/railpack-plan.json --info-out /src/railpack-info.json
docker buildx create --name railpack-smoke --driver docker-container
docker buildx build --builder railpack-smoke --build-arg "BUILDKIT_SYNTAX=ghcr.io/railwayapp/railpack-frontend:v$FRONTEND" -f /src/railpack-plan.json --output type=docker,name=railpack-smoke /src
docker buildx rm railpack-smoke
'
docker run -d --name railpack-smoke -e PORT=3000 -p 127.0.0.1:3999:3000 railpack-smoke
for _ in $(seq 1 30); do
if [ "$(curl -fs http://127.0.0.1:3999 || true)" = railpack-ok ]; then exit 0; fi
sleep 1
done
docker logs railpack-smoke
exit 1
# Same scan as image-audit.yml, on the image this PR builds.
- name: Scan main image
env:
TRIVY_IMAGE: aquasec/trivy:0.76.1@sha256:790fd66d1697395d8693d1acaa1ea702406a20f109b6fc7bac8db623eca6c06c
run: |
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v "$PWD:/src:ro" -w /src "$TRIVY_IMAGE" image \
--image-src docker --scanners vuln --severity CRITICAL,HIGH \
--ignore-unfixed --ignorefile .trivyignore.yaml --exit-code 1 \
--no-progress dokploy-bun-check:main
service-image-builds:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- name: cloud
file: ./Dockerfile.cloud
- name: server
file: ./Dockerfile.server
- name: schedule
file: ./Dockerfile.schedule
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Prepare production env file
run: |
cp apps/dokploy/.env.production.example .env.production
cp apps/dokploy/.env.production.example apps/dokploy/.env.production
echo "POSTGRES_PASSWORD=build-time-postgres-password" >> .env.production
echo "POSTGRES_PASSWORD=build-time-postgres-password" >> apps/dokploy/.env.production
- name: Build ${{ matrix.name }} image
uses: docker/build-push-action@v7
with:
context: .
file: ${{ matrix.file }}
load: true
push: false
tags: dokploy-bun-check:${{ matrix.name }}
- name: Smoke ${{ matrix.name }} image
run: |
docker run --rm --entrypoint bun dokploy-bun-check:${{ matrix.name }} --version
docker run --rm --entrypoint sh dokploy-bun-check:${{ matrix.name }} -lc '
test -f /app/packages/server/dist/index.js
node --input-type=module -e "console.log(await import.meta.resolve(\"@dokploy/server\"))"
'