Skip to content

yaegashi/p4p-docker

Repository files navigation

Helix Core Proxy Server (P4P) Docker Container

Introduction

This is a Docker container for the Helix Core Proxy Server (P4P).

The container includes the following executable binaries from the Perforce distribution:

The container images are published at ghcr.io/yaegashi/p4p-docker/p4p.

It supports linux/amd64 and linux/arm64 platforms starting from the r24.2 release.

Running Container

It is recommended to use Docker Compose with compose.yml like the following:

services:
  p4p:
    image: ghcr.io/yaegashi/p4p-docker/p4p:r24.2
    # P4P command line options
    # https://www.perforce.com/manuals/p4sag/Content/P4SAG/chapter.proxy.html
    command: -v proxy.monitor.level=0
    # P4P Environment variables
    # https://www.perforce.com/manuals/cmdref/Content/CmdRef/envars.html
    environment:
      TZ: Asia/Tokyo
      P4DEBUG: server=1
      P4PORT: ssl:1666
      P4TARGET: ssl:target-server:1666
    ports:
      - 1666:1666
    volumes:
      - ./data:/data
    logging:
      driver: json-file
      options:
        max-size: "1g"
        max-file: "10"

To create and launch a container:

docker compose up -d

To stop the container:

docker compose down

To view container status:

docker compose ps

To view container logs:

docker compose logs

Note: You can use --tail=N to limit the log output. Logs will be lost when the container is removed by docker compose down.

To stream logs in real-time (type Ctrl+C to stop):

docker compose logs --tail=100 -f

To compress and archive logs:

docker compose logs -t --no-log-prefix | gzip -c9 > p4p.log.gz

To check the expiration date of the certificate generated by p4p:

openssl x509 -text -noout -in ./data/ssl/certificate.txt | grep -a3 'Not After'

Example output:

        Issuer: C = US, ST = CA, L = Alameda, O = Perforce Autogen Cert, CN = 94647952efa8
        Validity
            Not Before: Nov 16 04:00:13 2024 GMT
            Not After : Nov 16 04:00:13 2026 GMT
        Subject: C = US, ST = CA, L = Alameda, O = Perforce Autogen Cert, CN = 94647952efa8
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption

To regenerate the certificate, just remove files data/ssl/*.txt and restart the container:

rm ./data/ssl/*.txt
docker compose restart