From 9cbf0d47dd420a64f69c5c4d2a48a150dbd08fab Mon Sep 17 00:00:00 2001 From: M3dinar Date: Wed, 22 Jul 2026 15:03:03 +0200 Subject: [PATCH 01/13] Updated Ubuntu base image to 24.04 (noble) Removed helix-swarm Updated perforce to 2026.1 --- helix-p4d/Dockerfile | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/helix-p4d/Dockerfile b/helix-p4d/Dockerfile index ce6b520..4975d66 100644 --- a/helix-p4d/Dockerfile +++ b/helix-p4d/Dockerfile @@ -1,27 +1,34 @@ # -------------------------------------------------------------------------------- # Docker configuration for P4D # -------------------------------------------------------------------------------- - -FROM ubuntu:focal +# Ubuntu noble and 24.04 are the same, but noble is the codename for 24.04 +FROM ubuntu:24.04 LABEL vendor="Sourcegraph" LABEL maintainer="Joe Chen (joe@sourcegraph.com)" -# Update Ubuntu and add Perforce Package Source RUN apt-get update && \ - apt-get install -y wget gnupg2 && \ - wget -qO - https://package.perforce.com/perforce.pubkey | apt-key add - && \ - echo "deb http://package.perforce.com/apt/ubuntu focal release" > /etc/apt/sources.list.d/perforce.list && \ - apt-get update + apt-get install -y wget gnupg2 # -------------------------------------------------------------------------------- # Docker BUILD # -------------------------------------------------------------------------------- # Create perforce user and install Perforce Server -# Do in-page search over https://package.perforce.com/apt/ubuntu/dists/focal/release/binary-amd64/Packages -# for both "Package: helix-p4d" and "Package: helix-swarm-triggers". -RUN apt-get update && apt-get install -y helix-p4d=2024.1-2625008~focal helix-swarm-triggers=2024.3-2628402~focal +# Do in-page search over https://package.perforce.com/apt/ubuntu/dists/noble/release/binary-amd64/Packages +# for "Package: helix-p4d" +# Update Ubuntu and add Perforce Package Source +RUN apt-get update && apt-get install -y wget gnupg && \ + wget -qO - https://package.perforce.com/perforce.pubkey | gpg --dearmor -o /etc/apt/keyrings/perforce.gpg && \ + echo "deb [signed-by=/etc/apt/keyrings/perforce.gpg] http://package.perforce.com/apt/ubuntu noble release" > /etc/apt/sources.list.d/perforce.list && \ + apt-get update && \ + apt-get install -y helix-p4d=2026.1-2951233~noble + +RUN apt-get remove -y wget gnupg2 && \ + apt-get autoremove -y && \ + apt-get clean -y && \ + rm -rf /var/lib/apt/lists/* + # Add external files COPY files/restore.sh /usr/local/bin/restore.sh COPY files/setup.sh /usr/local/bin/setup.sh From 2dc7d674cb67860d84ec30f50b22f8ebcf388f20 Mon Sep 17 00:00:00 2001 From: M3dinar Date: Wed, 22 Jul 2026 15:18:08 +0200 Subject: [PATCH 02/13] Removed NAME env variable Fixed log target --- README.md | 29 ++++++++++++++++++++++------- helix-p4d/Dockerfile | 8 +++----- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index f15d40a..fda6fcd 100644 --- a/README.md +++ b/README.md @@ -21,24 +21,23 @@ To have a disposable Perforce Helix core server running, simply do: ```sh docker run --rm \ --publish 1666:1666 \ - sourcegraph/helix-p4d:2023.1 + sourcegraph/helix-p4d:latest ``` The above command makes the server avaialble locally at `:1666`, with a default super user `admin` and its password `pass12349ers`. +#### Environment variables All available options and their default values: ```sh -NAME=perforce-server P4HOME=/p4 -P4NAME=master +P4NAME=perforce-server P4TCP=1666 P4PORT=1666 P4USER=admin P4PASSWD=pass12349ers P4CASE=-C0 P4CHARSET=utf8 -JNL_PREFIX=perforce-server ``` Use the `--env` flag to override default: @@ -48,12 +47,13 @@ docker run --rm \ --publish 1666:1666 \ --env P4USER=amy \ --env P4PASSWD=securepassword \ - sourcegraph/helix-p4d:2023.1 + sourcegraph/helix-p4d:latest ``` > [!WARNING] > Please be noted that although the server survives over restarts (i.e. data are kept), but it may break if you change the options after the initial bootstrap (i.e. the very first run of the image, at when options are getting hard-coded to the Perforce Helix core server own configuration). +#### Volumes To start a long-running production container, do remember to volume the data directory (`P4HOME`) and replace the `--rm` flag with `-d` (detach): ```sh @@ -61,7 +61,7 @@ docker run -d \ --publish 1666:1666 \ --env P4PASSWD=securepassword \ --volume ~/.helix-p4d-home:/p4 \ - sourcegraph/helix-p4d:2023.1 + sourcegraph/helix-p4d:latest ``` Now you have a running server, please read our handbook for [how to set up the client side](https://handbook.sourcegraph.com/departments/technical-success/support/process/p4-enablement/). @@ -93,4 +93,19 @@ docker run --rm \ ## Credits -This repository is heavily inspired by https://github.com/p4paul/helix-docker and https://github.com/ambakshi/docker-perforce. +This repository is heavily inspired by https://github.com/p4paul/helix-docker and https://github.com/ambakshi/docker-perforce + +## Fork + +The fork was done to allow some changes +- Update of the dependancies + - Ubuntu focal to noble (no support for racoon ATM) + - Helix perforce to 2026.1 +- Removed helix swarm +- Changed the whole restore checkpoint logic +- Improvements + - Unified folder name + - Unified the use of the setup in each case to configure and start the server + - Use of p4dctl +- Fixes + - Charset when there is no one selected diff --git a/helix-p4d/Dockerfile b/helix-p4d/Dockerfile index 4975d66..adae737 100644 --- a/helix-p4d/Dockerfile +++ b/helix-p4d/Dockerfile @@ -46,8 +46,7 @@ RUN \ # -------------------------------------------------------------------------------- # Default Environment -ARG NAME=perforce-server -ARG P4NAME=master +ARG P4NAME=perforce-server ARG P4TCP=1666 ARG P4USER=admin ARG P4PASSWD=pass12349ers @@ -55,8 +54,7 @@ ARG P4CASE=-C0 ARG P4CHARSET=utf8 # Dynamic Environment -ENV NAME=$NAME \ - P4NAME=$P4NAME \ +ENV P4NAME=$P4NAME \ P4TCP=$P4TCP \ P4PORT=$P4TCP \ P4USER=$P4USER \ @@ -83,7 +81,7 @@ VOLUME $P4HOME ENTRYPOINT \ init.sh && \ - /usr/bin/tail -F $P4ROOT/logs/log + /usr/bin/tail -F $P4HOME/logs/log HEALTHCHECK \ --interval=2m \ From 6a1f677c173c4e50c264b0b799cdc3dc9c71a744 Mon Sep 17 00:00:00 2001 From: M3dinar Date: Wed, 22 Jul 2026 16:06:47 +0200 Subject: [PATCH 03/13] Setup is called at start or after restoring a checkpoint (all the time) Check the charset value Use of p4dctl for the services --- helix-p4d/files/init.sh | 14 +++++++++----- helix-p4d/files/setup.sh | 28 ++++++++++++++++++---------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/helix-p4d/files/init.sh b/helix-p4d/files/init.sh index 405913c..f5ab561 100644 --- a/helix-p4d/files/init.sh +++ b/helix-p4d/files/init.sh @@ -10,18 +10,22 @@ if [ -L "$P4CKP/latest" ]; then echo "Restoring checkpoint..." restore.sh rm "$P4CKP/latest" -else - echo "Create empty or start existing server..." - setup.sh fi +echo "Configuring the server..." +setup.sh + +# Start the server +echo "Perforce Server starting..." +p4dctl start -t p4d "$P4NAME" + +# Retrieving server information to be displayed in the logs p4 login < /dev/null; do sleep 1; done -echo "Perforce Server [RUNNING]" ## Remove all triggers echo "Triggers:" | p4 triggers -i diff --git a/helix-p4d/files/setup.sh b/helix-p4d/files/setup.sh index 615b6d0..2eadfe7 100644 --- a/helix-p4d/files/setup.sh +++ b/helix-p4d/files/setup.sh @@ -1,19 +1,27 @@ #!/bin/bash -if [ ! -d "$P4ROOT/etc" ]; then - echo >&2 "First time installation, copying configuration from /etc/perforce to $P4ROOT/etc and relinking" - mkdir -p "$P4ROOT/etc" - cp -r /etc/perforce/* "$P4ROOT/etc/" -fi +opts=() -mv /etc/perforce /etc/perforce.orig -ln -s "$P4ROOT/etc" /etc/perforce +# Check P4CHARSET environment variable +if [ -z "${P4CHARSET:-}" ]; then + echo "Error: P4CHARSET environment variable is not set." + exit 255 +fi +if [ "${P4CHARSET:-}" != "none" && "${P4CHARSET:-}" != "utf8" ]; then + echo "Error: P4CHARSET value unknown, expected 'none' or 'utf8'." + exit 255 +fi -if ! p4dctl list 2>/dev/null | grep -q "$NAME"; then - /opt/perforce/sbin/configure-helix-p4d.sh "$NAME" -n -p "$P4PORT" -r "$P4ROOT" -u "$P4USER" -P "${P4PASSWD}" --case "$P4CASE" --unicode +# If P4CHARSET is set to "none", do not pass --unicode. Otherwise include it. +if [ "${P4CHARSET:-}" != "none" ]; then + opts+=(--unicode) fi +# Run the container and get a terminal into it so you can cat the file to get the list of option (No known web documentation) +/opt/perforce/sbin/configure-helix-p4d.sh "$P4NAME" -n -p "$P4PORT" -r "$P4HOME" -u "$P4USER" -P "${P4PASSWD}" --case="$P4CASE" "${opts[@]}" + p4 configure set $P4NAME#server.depot.root=$P4DEPOTS p4 configure set $P4NAME#journalPrefix=$P4CKP/$JNL_PREFIX -p4dctl start -t p4d "$NAME" +# Stopping the server so the previous configuration are taken into account +p4dctl stop -t p4d "$P4NAME" \ No newline at end of file From bd57ea6c3b9ef03562b033f5203c5fd7d9b5a7c8 Mon Sep 17 00:00:00 2001 From: M3dinar Date: Wed, 22 Jul 2026 16:13:10 +0200 Subject: [PATCH 04/13] Refacto restore from checkpoint --- README.md | 9 +++++++++ helix-p4d/files/latest_checkpoint.sh | 16 ---------------- helix-p4d/files/restore.sh | 24 ++++++++++-------------- 3 files changed, 19 insertions(+), 30 deletions(-) delete mode 100644 helix-p4d/files/latest_checkpoint.sh diff --git a/README.md b/README.md index fda6fcd..a724d49 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,9 @@ docker run --rm \ > [!WARNING] > Please be noted that although the server survives over restarts (i.e. data are kept), but it may break if you change the options after the initial bootstrap (i.e. the very first run of the image, at when options are getting hard-coded to the Perforce Helix core server own configuration). +`P4CASE` : `-C0` means Unix-style and `-C1` Windows-style (only these 2 values are valid) +`P4CHARSET` : `none` and `utf8` are the only valid values + #### Volumes To start a long-running production container, do remember to volume the data directory (`P4HOME`) and replace the `--rm` flag with `-d` (detach): @@ -91,6 +94,12 @@ docker run --rm \ sourcegraph/helix-p4d:2023.1 ``` +### Restore from a checkpoint +With a journal and checkpoint, generate a gz file +Put them in the folder `/p4/checkpoints/` (`$P4CKP`) +Create a simlink to the gz file named latest in the folder `$P4CKP` +Run the container, it will generate the DB from the checkpoint and remove the sym link. The gz can be removed once you're good with it. + ## Credits This repository is heavily inspired by https://github.com/p4paul/helix-docker and https://github.com/ambakshi/docker-perforce diff --git a/helix-p4d/files/latest_checkpoint.sh b/helix-p4d/files/latest_checkpoint.sh deleted file mode 100644 index 5466195..0000000 --- a/helix-p4d/files/latest_checkpoint.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -## Find latest checkpoint -unset -v latest -for file in "$P4CKP"/"$JNL_PREFIX".ckp.*.gz; do - [[ $file -nt $latest ]] && latest=$file -done - -## If file exists update symlink -if [ "$latest" ]; then - echo "Updating latest symlink to: $latest" - ln -f -s "$latest" "$P4CKP/latest" -else - echo "Error: Unable to find a checkpoint" - exit 255 -fi diff --git a/helix-p4d/files/restore.sh b/helix-p4d/files/restore.sh index c132cff..f9f67d6 100644 --- a/helix-p4d/files/restore.sh +++ b/helix-p4d/files/restore.sh @@ -1,20 +1,20 @@ #!/bin/bash -## Test for latest link -if [ ! -L "$P4CKP/latest" ]; then - echo "Link not found - looking for checkpoint" - /usr/local/bin/latest_checkpoint.sh -fi - ## Test Checkpoint exists if [ ! -L "$P4CKP/latest" ]; then echo "Error: Checkpoint for link $P4CKP/latest not found." exit 255 fi -## Stop Perforce -#p4 admin stop -#until ! p4 info -s 2> /dev/null; do sleep 1; done +## Check P4CASE environment variable +if [ -z "${P4CASE:-}" ]; then + echo "Error: P4CASE environment variable is not set." + exit 255 +fi +if [ "${P4CASE:-}" != "-C0" ] && [ "${P4CASE:-}" != "-C1" ]; then + echo "Error: P4CASE must be set to -C0 (Unix-style) or -C1 (Windows-style)." + exit 255 +fi ## Remove current data base rm -rf $P4ROOT/* @@ -23,13 +23,9 @@ rm -rf $P4ROOT/* echo $P4NAME > $P4ROOT/server.id ## Restore and Upgrade Checkpoint +echo "Restoring checkpoint..." p4d $P4CASE -r $P4ROOT -jr -z $P4CKP/latest p4d $P4CASE -r $P4ROOT -xu ## Set key environment variables p4d $P4CASE -r $P4ROOT "-cset security=2" -p4d $P4CASE -r $P4ROOT "-cset ${P4NAME}#server.depot.root=${P4DEPOTS}" -p4d $P4CASE -r $P4ROOT "-cset ${P4NAME}#journalPrefix=${P4CKP}/${JNL_PREFIX}" - -## Start Perforce -p4d $P4CASE -r$P4ROOT -p$P4TCP -L$P4LOG -J$P4JOURNAL -d From ac24ca6b5d8a60290fad2ca7da0de576e3c3fef2 Mon Sep 17 00:00:00 2001 From: M3dinar Date: Sun, 26 Jul 2026 15:22:39 +0200 Subject: [PATCH 05/13] Added information about env variable JNL_PREFIX --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a724d49..4230d4b 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ docker run --rm \ `P4CASE` : `-C0` means Unix-style and `-C1` Windows-style (only these 2 values are valid) `P4CHARSET` : `none` and `utf8` are the only valid values +`JNL_PREFIX` : prefix for the perforce journal file #### Volumes To start a long-running production container, do remember to volume the data directory (`P4HOME`) and replace the `--rm` flag with `-d` (detach): From 9ae3ac842024413adbe51ff3a5cf9027c42d9d1f Mon Sep 17 00:00:00 2001 From: M3dinar Date: Sun, 26 Jul 2026 15:25:04 +0200 Subject: [PATCH 06/13] Changed helix-p4d with the latest available --- helix-p4d/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-p4d/Dockerfile b/helix-p4d/Dockerfile index adae737..1d04f48 100644 --- a/helix-p4d/Dockerfile +++ b/helix-p4d/Dockerfile @@ -22,7 +22,7 @@ RUN apt-get update && apt-get install -y wget gnupg && \ wget -qO - https://package.perforce.com/perforce.pubkey | gpg --dearmor -o /etc/apt/keyrings/perforce.gpg && \ echo "deb [signed-by=/etc/apt/keyrings/perforce.gpg] http://package.perforce.com/apt/ubuntu noble release" > /etc/apt/sources.list.d/perforce.list && \ apt-get update && \ - apt-get install -y helix-p4d=2026.1-2951233~noble + apt-get install -y helix-p4d=2026.1-2972966~noble RUN apt-get remove -y wget gnupg2 && \ apt-get autoremove -y && \ From 548aab70615a9ca8091dc723eab233609a897346 Mon Sep 17 00:00:00 2001 From: M3dinar Date: Sun, 26 Jul 2026 15:25:44 +0200 Subject: [PATCH 07/13] Fixed remaining issue in the build due after removed files in previous work --- helix-p4d/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/helix-p4d/Dockerfile b/helix-p4d/Dockerfile index 1d04f48..36c57d2 100644 --- a/helix-p4d/Dockerfile +++ b/helix-p4d/Dockerfile @@ -33,13 +33,11 @@ RUN apt-get remove -y wget gnupg2 && \ COPY files/restore.sh /usr/local/bin/restore.sh COPY files/setup.sh /usr/local/bin/setup.sh COPY files/init.sh /usr/local/bin/init.sh -COPY files/latest_checkpoint.sh /usr/local/bin/latest_checkpoint.sh RUN \ chmod +x /usr/local/bin/restore.sh && \ chmod +x /usr/local/bin/setup.sh && \ - chmod +x /usr/local/bin/init.sh && \ - chmod +x /usr/local/bin/latest_checkpoint.sh + chmod +x /usr/local/bin/init.sh # -------------------------------------------------------------------------------- # Docker ENVIRONMENT From 4757b46458e2fd2330ccb60b4a3504d672007287 Mon Sep 17 00:00:00 2001 From: M3dinar Date: Sun, 26 Jul 2026 15:28:18 +0200 Subject: [PATCH 08/13] Removed trigger (not working) --- helix-p4d/files/init.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/helix-p4d/files/init.sh b/helix-p4d/files/init.sh index f5ab561..8696a3b 100644 --- a/helix-p4d/files/init.sh +++ b/helix-p4d/files/init.sh @@ -26,6 +26,3 @@ EOF echo "Perforce Server [RUNNING] with the following configuration" until p4 info -s 2> /dev/null; do sleep 1; done - -## Remove all triggers -echo "Triggers:" | p4 triggers -i From 79adbf9fb2e60d59092d41dff45b29a77547e6fc Mon Sep 17 00:00:00 2001 From: M3dinar Date: Sun, 26 Jul 2026 15:30:35 +0200 Subject: [PATCH 09/13] Added prefix to logs Setup is only run after a restore (new install will not work) Added helper for configure-helix-p4d.sh Added conversion for case option between setup and restore --- helix-p4d/files/init.sh | 15 ++++++----- helix-p4d/files/restore.sh | 8 +++--- helix-p4d/files/setup.sh | 53 ++++++++++++++++++++++++++++++++++---- 3 files changed, 61 insertions(+), 15 deletions(-) diff --git a/helix-p4d/files/init.sh b/helix-p4d/files/init.sh index 8696a3b..b830f2b 100644 --- a/helix-p4d/files/init.sh +++ b/helix-p4d/files/init.sh @@ -7,16 +7,19 @@ mkdir -p "$P4CKP" # Restore checkpoint if symlink latest exists if [ -L "$P4CKP/latest" ]; then - echo "Restoring checkpoint..." + echo "[INFO] Restoring checkpoint..." restore.sh rm "$P4CKP/latest" -fi + echo "[INFO] Server restored" -echo "Configuring the server..." -setup.sh + echo "[INFO] Configuring the server..." + setup.sh + echo "[INFO] Server configured, restart required" + exit 0 +fi # Start the server -echo "Perforce Server starting..." +echo "[INFO] Starting Server..." p4dctl start -t p4d "$P4NAME" # Retrieving server information to be displayed in the logs @@ -24,5 +27,5 @@ p4 login < /dev/null; do sleep 1; done diff --git a/helix-p4d/files/restore.sh b/helix-p4d/files/restore.sh index f9f67d6..daf6beb 100644 --- a/helix-p4d/files/restore.sh +++ b/helix-p4d/files/restore.sh @@ -2,17 +2,17 @@ ## Test Checkpoint exists if [ ! -L "$P4CKP/latest" ]; then - echo "Error: Checkpoint for link $P4CKP/latest not found." + echo "[ERROR] Checkpoint for link $P4CKP/latest not found." exit 255 fi ## Check P4CASE environment variable if [ -z "${P4CASE:-}" ]; then - echo "Error: P4CASE environment variable is not set." + echo "[ERROR] P4CASE environment variable is not set." exit 255 fi if [ "${P4CASE:-}" != "-C0" ] && [ "${P4CASE:-}" != "-C1" ]; then - echo "Error: P4CASE must be set to -C0 (Unix-style) or -C1 (Windows-style)." + echo "[ERROR] P4CASE must be set to -C0 (Unix-style) or -C1 (Windows-style)." exit 255 fi @@ -23,7 +23,7 @@ rm -rf $P4ROOT/* echo $P4NAME > $P4ROOT/server.id ## Restore and Upgrade Checkpoint -echo "Restoring checkpoint..." +echo "[INFO] Restoring checkpoint with option $P4CASE" p4d $P4CASE -r $P4ROOT -jr -z $P4CKP/latest p4d $P4CASE -r $P4ROOT -xu diff --git a/helix-p4d/files/setup.sh b/helix-p4d/files/setup.sh index 2eadfe7..1113ef1 100644 --- a/helix-p4d/files/setup.sh +++ b/helix-p4d/files/setup.sh @@ -4,11 +4,11 @@ opts=() # Check P4CHARSET environment variable if [ -z "${P4CHARSET:-}" ]; then - echo "Error: P4CHARSET environment variable is not set." + echo "[ERROR] P4CHARSET environment variable is not set." exit 255 fi -if [ "${P4CHARSET:-}" != "none" && "${P4CHARSET:-}" != "utf8" ]; then - echo "Error: P4CHARSET value unknown, expected 'none' or 'utf8'." +if [ "${P4CHARSET:-}" != "none" ] && [ "${P4CHARSET:-}" != "utf8" ]; then + echo "[ERROR] P4CHARSET value unknown, expected 'none' or 'utf8'." exit 255 fi @@ -17,9 +17,52 @@ if [ "${P4CHARSET:-}" != "none" ]; then opts+=(--unicode) fi -# Run the container and get a terminal into it so you can cat the file to get the list of option (No known web documentation) -/opt/perforce/sbin/configure-helix-p4d.sh "$P4NAME" -n -p "$P4PORT" -r "$P4HOME" -u "$P4USER" -P "${P4PASSWD}" --case="$P4CASE" "${opts[@]}" +## Check P4CASE environment variable +if [ -z "${P4CASE:-}" ]; then + echo "[ERROR] P4CASE environment variable is not set." + exit 255 +fi +if [ "${P4CASE:-}" != "-C0" ] && [ "${P4CASE:-}" != "-C1" ]; then + echo "[ERROR] P4CASE must be set to -C0 (Unix-style) or -C1 (Windows-style)." + exit 255 +fi +if [ "${P4CASE:-}" == "-C1" ]; then + opts+=(--case=1) +else + opts+=(--case=0) +fi + +# Script to configure the server with the given param so a p4dctl is created. +# Helper of the script available in it +#------------------------------------------------------------------------------- +# Configuration script for P4 Server +# Copyright 2025, Perforce Software Inc. All rights reserved. +# +# Synopsis: +# +# configure-p4d.sh [service-name] [options] +# +# Where options are: +# +# -n - Use the following flags in non-interactive mode +# -p - Set P4 Server's address +# -r - Set P4 Server's root directory +# -u - P4 super-user login name +# -P - P4 super-user password +# --unicode - Enable unicode mode on server +# --case - Case-sensitivity (0=sensitive[default],1=insensitive) +# +# Password is only needed on initial configuration when the super-user +# account is created. If reconfiguring an existing Perforce Server, the +# super-user name and password are left alone. +# +# Unicode mode is disabled by default. Specify --unicode if you +# want it. This will change in a future release. +# +#------------------------------------------------------------------------------- +/opt/perforce/sbin/configure-helix-p4d.sh "$P4NAME" -n -p "$P4PORT" -r "$P4HOME" -u "$P4USER" -P "${P4PASSWD}" "${opts[@]}" +echo "[INFO] Configuring server settings..." p4 configure set $P4NAME#server.depot.root=$P4DEPOTS p4 configure set $P4NAME#journalPrefix=$P4CKP/$JNL_PREFIX From 8c5f524be0819e0115cd6f449f41e8c6d50903f0 Mon Sep 17 00:00:00 2001 From: M3dinar Date: Thu, 30 Jul 2026 07:56:39 +0200 Subject: [PATCH 10/13] Added fresh install if no p4dctl services was found --- helix-p4d/files/init.sh | 7 +++++++ helix-p4d/files/setup.sh | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/helix-p4d/files/init.sh b/helix-p4d/files/init.sh index b830f2b..3186759 100644 --- a/helix-p4d/files/init.sh +++ b/helix-p4d/files/init.sh @@ -18,6 +18,13 @@ if [ -L "$P4CKP/latest" ]; then exit 0 fi +# Configure the server on a fresh install when no instance is registered +# Header of p4dctl list and the message when there is no instance are ouput to stderr. +if [ -z "$(p4dctl list 2>/dev/null)" ]; then + echo "[INFO] No existing server configuration detected. Running setup..." + setup.sh +fi + # Start the server echo "[INFO] Starting Server..." p4dctl start -t p4d "$P4NAME" diff --git a/helix-p4d/files/setup.sh b/helix-p4d/files/setup.sh index 1113ef1..5875641 100644 --- a/helix-p4d/files/setup.sh +++ b/helix-p4d/files/setup.sh @@ -50,7 +50,7 @@ fi # -u - P4 super-user login name # -P - P4 super-user password # --unicode - Enable unicode mode on server -# --case - Case-sensitivity (0=sensitive[default],1=insensitive) +# --case - Case-sensitivity (0=sensitive[default],1=insensitive) # # Password is only needed on initial configuration when the super-user # account is created. If reconfiguring an existing Perforce Server, the From 3017b920a39b7d2d27bf303d6a64998163969677 Mon Sep 17 00:00:00 2001 From: M3dinar Date: Thu, 30 Jul 2026 08:17:46 +0200 Subject: [PATCH 11/13] Removed configuration setting during restore process Added security to 2 when creating a setup Changed printing server configuration instead of client information --- helix-p4d/files/init.sh | 7 +------ helix-p4d/files/restore.sh | 3 --- helix-p4d/files/setup.sh | 8 +++++++- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/helix-p4d/files/init.sh b/helix-p4d/files/init.sh index 3186759..6454a9e 100644 --- a/helix-p4d/files/init.sh +++ b/helix-p4d/files/init.sh @@ -29,10 +29,5 @@ fi echo "[INFO] Starting Server..." p4dctl start -t p4d "$P4NAME" -# Retrieving server information to be displayed in the logs -p4 login < /dev/null; do sleep 1; done +until p4 configure show -s 2> /dev/null; do sleep 1; done diff --git a/helix-p4d/files/restore.sh b/helix-p4d/files/restore.sh index daf6beb..3924535 100644 --- a/helix-p4d/files/restore.sh +++ b/helix-p4d/files/restore.sh @@ -26,6 +26,3 @@ echo $P4NAME > $P4ROOT/server.id echo "[INFO] Restoring checkpoint with option $P4CASE" p4d $P4CASE -r $P4ROOT -jr -z $P4CKP/latest p4d $P4CASE -r $P4ROOT -xu - -## Set key environment variables -p4d $P4CASE -r $P4ROOT "-cset security=2" diff --git a/helix-p4d/files/setup.sh b/helix-p4d/files/setup.sh index 5875641..ff67f63 100644 --- a/helix-p4d/files/setup.sh +++ b/helix-p4d/files/setup.sh @@ -62,9 +62,15 @@ fi #------------------------------------------------------------------------------- /opt/perforce/sbin/configure-helix-p4d.sh "$P4NAME" -n -p "$P4PORT" -r "$P4HOME" -u "$P4USER" -P "${P4PASSWD}" "${opts[@]}" +# Server configuration is set to default security 4, so we need to get a ticket with p4 login to change configuration settings. +p4 login < Date: Thu, 30 Jul 2026 08:25:10 +0200 Subject: [PATCH 12/13] Updated README.md to inform the default server configuration set by the container --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 4230d4b..acb3fcc 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,12 @@ This repository contains a collection of source files for building Docker images This directory contains the source files for building a Perforce Helix core server Docker image. The published Docker images are available as [`sourcegraph/helix-p4d` on Docker Hub](https://hub.docker.com/r/sourcegraph/helix-p4d). +### Default server configuration + +- `security` : 2 instead of 4 +- `server.depots.root` : `P4DEPOTS` +- `journalPrefix` : `P4CKP/JNL_PREFIX` + ### Build the docker image The `helix-p4d/build.sh` script will build the docker image for you. If you don't provide a tag to the script it will tag the image as `sourcegraph/helix-p4d:latest` From a460b9e460d0bfff9968c67c005032afefe25b36 Mon Sep 17 00:00:00 2001 From: M3dinar Date: Thu, 30 Jul 2026 08:46:58 +0200 Subject: [PATCH 13/13] Show triggers when the server is configured Removed triggers when the server is configured --- README.md | 1 + helix-p4d/files/init.sh | 3 ++- helix-p4d/files/setup.sh | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index acb3fcc..12d02ea 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,7 @@ With a journal and checkpoint, generate a gz file Put them in the folder `/p4/checkpoints/` (`$P4CKP`) Create a simlink to the gz file named latest in the folder `$P4CKP` Run the container, it will generate the DB from the checkpoint and remove the sym link. The gz can be removed once you're good with it. +Triggers are removed. ## Credits diff --git a/helix-p4d/files/init.sh b/helix-p4d/files/init.sh index 6454a9e..b017036 100644 --- a/helix-p4d/files/init.sh +++ b/helix-p4d/files/init.sh @@ -30,4 +30,5 @@ echo "[INFO] Starting Server..." p4dctl start -t p4d "$P4NAME" echo "[INFO] Server [RUNNING] with the following configuration" -until p4 configure show -s 2> /dev/null; do sleep 1; done +until p4 info -s 2> /dev/null; do sleep 1; done +until p4 configure show 2> /dev/null; do sleep 1; done diff --git a/helix-p4d/files/setup.sh b/helix-p4d/files/setup.sh index ff67f63..0b04101 100644 --- a/helix-p4d/files/setup.sh +++ b/helix-p4d/files/setup.sh @@ -72,5 +72,11 @@ p4 configure set $P4NAME#security=2 p4 configure set $P4NAME#server.depot.root=$P4DEPOTS p4 configure set $P4NAME#journalPrefix=$P4CKP/$JNL_PREFIX +# In the case where we restore a checkpoint, we must ensure that triggers are removed +echo "[INFO] Existing triggers :" +p4 triggers -o +echo "[INFO] Removing triggers ..." +echo "Triggers:" | p4 triggers -i + # Stopping the server so the new configuration is taken into account p4dctl stop -t p4d "$P4NAME" \ No newline at end of file