Skip to content
Open
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
4 changes: 1 addition & 3 deletions .docker/druid-install-command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ fi
BASEDIR=$(dirname "$0")

wget --show-progress -q -O $BASEDIR/druid https://github.com/highcard-dev/druid-cli/releases/$URL_PATH/druid
wget --show-progress -q -O $BASEDIR/druid_rcon https://github.com/highcard-dev/druid-cli/releases/$URL_PATH/druid_rcon
wget --show-progress -q -O $BASEDIR/druid_rcon_web_rust https://github.com/highcard-dev/druid-cli/releases/$URL_PATH/druid_rcon_web_rust
wget --show-progress -q -O $BASEDIR/entrypoint.sh https://github.com/highcard-dev/druid-cli/releases/$URL_PATH/entrypoint.sh
chmod +x $BASEDIR/druid $BASEDIR/druid_rcon $BASEDIR/druid_rcon_web_rust
chmod +x $BASEDIR/druid

# Modify the PATH variable to prioritize /app/resources
export PATH=$BASEDIR:$PATH
Expand Down
110 changes: 6 additions & 104 deletions .docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env bash

set -e
SD="./"
input=$@

# Global args derived from envs that apply to multiple commands
Expand All @@ -16,123 +15,26 @@ then
global_args+=("--config=$DRUID_CONFIG")
fi

# Migrate legacy .scroll layout:
# Before: .scroll/<scroll files> + <serverfiles>
# After: <scroll files> + data/<serverfiles>
if [ -d "${SD}.scroll" ]; then
echo "Migrating legacy .scroll layout..."
mkdir -p "${SD}data"
for item in "${SD}"* "${SD}".[!.]*; do
[ -e "$item" ] || continue
name=$(basename "$item")
[ "$name" != "data" ] && [ "$name" != ".scroll" ] && mv "$item" "${SD}data/"
done
mv "${SD}.scroll"/* "${SD}"
rm -rf "${SD}.scroll"
echo "Legacy migration complete"
fi

echo "Druid Version: $(druid version)"

if [ ! -z "${DRUID_REGISTRY_HOST}" ] && [ ! -z "${DRUID_REGISTRY_USER}" ] && [ ! -z "${DRUID_REGISTRY_PASSWORD}" ];
then
echo "Logging into registry ${DRUID_REGISTRY_HOST}"
druid registry login --host "${DRUID_REGISTRY_HOST}" -u "${DRUID_REGISTRY_USER}" -p "${DRUID_REGISTRY_PASSWORD}"
fi

if [ "${ENSURE_NIX}" = "true" ];
then
if [ ! -e "$HOME/.nix-profile" ];
then
echo "Installing Nix package manager"
sh <(curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install) --no-daemon
echo "Nix installed"
fi
nix-channel --update
druid login --host "${DRUID_REGISTRY_HOST}" -u "${DRUID_REGISTRY_USER}" -p "${DRUID_REGISTRY_PASSWORD}"
fi

#Check if we should serve as default or when only artifact is specified
if [ -z "$input" ] || [[ $input =~ ([^/]+)/([^:]+):([^/]+) ]] && [[ $input != *" "* ]]; then artifact="${input}"
if [ -z "${artifact}" ];
then
artifact=$DRUID_SCROLL_ARTIFACT
fi

echo "Artifact: $artifact"

#Update command
if [ "${DRUID_AUTO_UPDATE}" = "true" ] && [ -f "${SD}/scroll.yaml" ];
then
echo "Updating artifact"

# Build args for `druid update` so that global envs apply as well
update_args=(update "${global_args[@]}")

druid "${update_args[@]}"
echo "Updated artifact"
fi


#ignore-version-check otherwise we have missmatch after update
args=(serve --ignore-version-check --additional-endpoints annotations)

if [ ! -z "${artifact}" ];
then
args+=($artifact)
fi

# Map envs to args (--cwd = scroll dir, --config = path to .druid.yaml)
if [ ! -z "${DRUID_JWKS_SERVER}" ];
then
args+=("--jwks-server" "${DRUID_JWKS_SERVER}")
fi

if [ ! -z "${DRUID_USER_ID}" ];
then
args+=("--user-id" "${DRUID_USER_ID}")
fi
# Serve as default when no command is provided.
if [ -z "$input" ]; then
args=(serve)

if [ ! -z "${DRUID_PORT}" ];
then
args+=("--tcp")
args+=("--port" "${DRUID_PORT}")
fi

if [ ! -z "${DRUID_IDLE}" ];
then
args+=("--idle=$DRUID_IDLE")
fi
if [ ! -z "${DRUID_WATCH_PORTS}" ];
then
args+=("--watch-ports=$DRUID_WATCH_PORTS")
fi

if [ ! -z "${DRUID_WATCH_PORTS_INTERFACES}" ];
then
args+=("--watch-ports-interfaces" "${DRUID_WATCH_PORTS_INTERFACES}")
fi

if [ ! -z "${DRUID_COLDSTARTER}" ];
then
args+=("--coldstarter=$DRUID_COLDSTARTER")
fi

if [ ! -z "${DRUID_INIT_SNAPSHOT_URL}" ];
then
args+=("--init-snapshot-url=$DRUID_INIT_SNAPSHOT_URL")
fi

if [ ! -z "${DRUID_SKIP_ARTIFACT_DOWNLOAD}" ];
then
args+=("--skip-artifact-download")
fi

# Reuse global args (cwd/config) for serve as well
args+=("${global_args[@]}")

if [ ! -z "${PPROF_BIND}" ];
then
args+=("--pprof=$PPROF_BIND")
fi

echo "Running druid with args from env: ${args[@]}"
exec druid "${args[@]}"
Expand All @@ -156,4 +58,4 @@ else
done

exec druid "${args[@]}"
fi
fi
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
examples
__debug_bin*
.git
.runtime-state
bin
dist
tmp
*.db
*.sock
.DS_Store
21 changes: 9 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "^1.21"
- run: make test-integration-docker
name: Run integration tests inside Docker
go-version: "^1.24"
- uses: azure/setup-kubectl@v4
- run: make test-integration
name: Run CLI backend integration tests
- run: make test
name: Unit tests

Expand All @@ -21,19 +22,17 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "^1.21"
go-version: "^1.24"
- run: make build
name: Build
- run: make build-plugins
name: Build plugins
- uses: actions/upload-artifact@v4
name: Upload build artifacts
with:
name: build-artifacts
path: |
bin/druid
bin/druid_rcon
bin/druid_rcon_web_rust
bin/druid-client
bin/druid-coldstarter
.docker/entrypoint.sh
.docker/druid-install-command.sh

Expand All @@ -57,8 +56,6 @@ jobs:
name: Build
env:
VERSION: ${{ steps.version.outputs.version_tag }}
- run: make build-plugins
name: Build plugins
- name: Release
uses: softprops/action-gh-release@v2
with:
Expand All @@ -67,8 +64,8 @@ jobs:
make_latest: true
files: |
bin/druid
bin/druid_rcon
bin/druid_rcon_web_rust
bin/druid-client
bin/druid-coldstarter
.docker/entrypoint.sh
.docker/druid-install-command.sh

Expand Down
Loading
Loading