diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..673b29a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +**/.env +**/.directory diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..12aa88b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM ubuntu:18.04 + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update && \ +apt-get install -y wget gnupg2 curl apt-utils && \ +wget -qO - https://package.perforce.com/perforce.pubkey | apt-key add - && echo 'deb http://package.perforce.com/apt/ubuntu bionic release' > /etc/apt/sources.list.d/perforce.sources.list && \ +apt-get update && apt-get install -y helix-p4d=2019.2-1942501~bionic && \ +rm -rf /var/log/* && \ +rm -rf /var/lib/apt/lists/* + +VOLUME /opt/perforce/servers +VOLUME /opt/perforce/triggers + +COPY run.sh / +CMD ["/run.sh"] \ No newline at end of file diff --git a/README.md b/README.md index a3577c8..6fbe77f 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,37 @@ +> [!IMPORTANT] +> +> # **NOTICE:** +> +> ## Development of this project has been migrated to: https://codeberg.org/GlitchedPolygons/docker-perforce +> +> ## All pull requests and issues on GitHub will be ignored from the 16th of August, 2025 onwards. + docker-perforce =============== [![License: MIT](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/noonien/docker-perforce-server/blob/master/LICENSE) -This is a collection of docker images to run products provided by [Perforce](http://www.perforce.com/). +Quick and easy way of setting up a Perforce Helix server using [docker-compose](https://docs.docker.com/compose/). + +## How to get started + +1. - Clone this repo +2. - Create a `.env` file inside the repo's root directory. +3. - Set the following environment variables to your desired values **(must be in `VARNAME=VALUE` format!)**. -Details -------- -This collection currently includes: +* **P4USER** - default is `p4admin` +* **P4PORT** - default is `ssl:1666` +* **P4PORTNUM** - default is `1666` +* * This should be the same number as the one used in your **P4PORT** string. +* **P4PASSWD** - Don't use a default value; please choose a super **strong** password! +* **P4DOCKERVOL** - default is `/mnt/dockervolumes/perforce` +* * This is where the docker volume will be mounted to on your host machine. Your entire perforce server instance lives inside there. It's therefore recommended to pick a path with abundant disk space... +* **SERVER_NAME** - default is `p4dsrv` - - [perforce-base](perforce-base) - Base container, includes the Perforce APT repositories. - - [perforce-server](perforce-server/) - Perforce Helix Server container. +4. - Open the p4d port (default is port number 1666) +5. - Install [Docker Engine](https://docs.docker.com/engine/install/) and [docker-compose](https://docs.docker.com/compose/install/) if you haven't already. +6. - run `sudo docker-compose up -d` +Your server should now be up and running, listening to the specified port, using the specified user credentials. -Contributing ------------- -Contributing is always welcome and appreciated! Pull requests and issues will -be processed as fast as possible! +If anything goes wrong and your server doesn't work, run `sudo docker-compose down --remove-orphans` and then `sudo docker-compose up`. +Without the `-d` argument, you will see what's logged to the terminal and act accordingly. Once everything works, `Ctrl + C` (this shuts the helix server down) and then you can proceed to repeat step 6 above. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..dfba7b1 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +version: "3" +services: + perforce: + restart: always + container_name: "perforce-server" + environment: + DEBIAN_FRONTEND: noninteractive + P4USER: ${P4USER:-p4admin} + P4PORT: ${P4PORT:-ssl:1666} + P4PASSWD: ${P4PASSWD:-PLEASEdontForgetTOsetASTRONGpw337723817290} + SERVER_NAME: ${SERVER_NAME:-p4dsrv} + build: + context: . + dockerfile: Dockerfile + volumes: + - ${P4DOCKERVOL:-/mnt/dockervolumes/perforce}/servers:/opt/perforce/servers + - ${P4DOCKERVOL:-/mnt/dockervolumes/perforce}/triggers:/opt/perforce/triggers + ports: + - "${P4PORTNUM:-1666}:${P4PORTNUM:-1666}" + networks: + - perforce-network +networks: + perforce-network: + driver: bridge \ No newline at end of file diff --git a/perforce-base/Dockerfile b/perforce-base/Dockerfile deleted file mode 100644 index 2331b56..0000000 --- a/perforce-base/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM ubuntu:18.04 -LABEL maintainer="George Jiglau " - -ENV DEBIAN_FRONTEND noninteractive - -# Update package list and install wget -RUN apt-get update && apt-get install -y wget gnupg2 && \ - # Get perforce packages - wget -q http://package.perforce.com/perforce.pubkey -O - | apt-key add - && \ - echo 'deb http://package.perforce.com/apt/ubuntu bionic release' > /etc/apt/sources.list.d/perforce.sources.list && \ - # clean up the layer. - rm -rf /var/log/* \ - rm -rf /var/lib/apt/lists/* - diff --git a/perforce-base/README.md b/perforce-base/README.md deleted file mode 100644 index 996b9ba..0000000 --- a/perforce-base/README.md +++ /dev/null @@ -1,5 +0,0 @@ -perforce-base -============= -[![Docker Build Status](http://hubstatus.container42.com/noonien/perforce-base)](https://registry.hub.docker.com/u/noonien/perforce-base) - -This docker image is based on `ubuntu:18.04` and contains the [Perforce APT repositories](http://package.perforce.com/). diff --git a/perforce-search/Dockerfile b/perforce-search/Dockerfile deleted file mode 100644 index ff83cde..0000000 --- a/perforce-search/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM noonien/perforce-base -LABEL maintainer="George Jiglau " - -RUN apt-get install -y perforce-cli default-jre-headless - -RUN wget -q -O- http://www.perforce.com/downloads/perforce/r14.1/bin.java/p4search.tgz | tar zx -C /opt \ - && mv /opt/p4search-2014.1.828661 /opt/perforce/search \ - && cd /opt/perforce/search \ - && mv jetty jetty-config \ - && tar zxf solr-4.5.1.tgz \ - && tar zxf jetty-distribution-8.1.14.v20131031.tar.gz \ - && mv solr-4.5.1 solr \ - && mv jetty-distribution-8.1.14.v20131031 jetty \ - && mv solr-config/4.5.1/schema.xml solr/example/solr/collection1/conf \ - && mv scripts/solr-control.sh solr/example \ - && rm -rf jetty/webapps/* jetty/contexts/* \ - && mv p4-search*.war jetty/webapps/p4-search.war \ - && mv jetty-config/contexts/*.xml jetty/contexts \ - && mv conf/search.config jetty/resources \ - && mv scripts/p4search-control.sh jetty \ - && rm -rf conf jetty-* solr-* scripts install.sh - -COPY run.sh / -CMD ["/run.sh"] - diff --git a/perforce-search/README.md b/perforce-search/README.md deleted file mode 100644 index 64b5899..0000000 --- a/perforce-search/README.md +++ /dev/null @@ -1,23 +0,0 @@ -perforce-search -=============== -[![Docker Build Status](http://hubstatus.container42.com/noonien/perforce-search)](https://registry.hub.docker.com/u/noonien/perforce-search) - -This is a docker image for the [Perforce Search](http://www.perforce.com/). - -Usage ------ - - docker run -e P4PORT= -e P4USER= -e P4PASSWD= -e P4TOKEN= noonien/perforce-search - -Details -------- -The following environment variables are available: - - - P4PORT - Address on which to listen. Described [here](http://www.perforce.com/perforce/doc.current/manuals/cmdref/P4PORT.html). Required. - - P4USER - Superuser username. Only created when creating a new search. Required. - - P4PASSWD - Superuser password. Required when creating a new search. Required. - - P4TOKEN - Token to use when receving pushes from perforce. Required. - - P4CHARSET - Server charset. Optional. - - P4COMMONSURL - Commons URL. Optional. - - P4WEBURL - Perforce Web URL. Optional. - - P4SWARMURL - Perforce Swarm URL. Optional diff --git a/perforce-search/run.sh b/perforce-search/run.sh deleted file mode 100755 index 6329245..0000000 --- a/perforce-search/run.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash - -for config in P4PORT P4USER P4PASSWD P4TOKEN; do - if [ -z "${!config:-}" ]; then - echo FAIL: $config not defined 1>&2 - exit 1 - fi -done - - -# Trust the server when connecting over ssl -if [[ $P4PORT == "ssl"* ]]; then - echo SSL connection detected, establishing trust - if ! p4 trust -y; then - echo FAIL: Could not establish trust for $P4PORT 1>&2 - exit 1 - fi -fi - -# Check login -if ! echo $P4PASSWD | p4 login > /dev/null; then - echo FAIL: Could not login using provided user/password - exit 1 -fi - -cd /opt/perforce/search - -# Configure files -## Server connection details -PROTOCOL=none -HOST=127.0.0.1 -parts=(${P4PORT//:/ }) -case ${#parts[@]} in - 1) - PORT=${parts[0]} - ;; - 2) - HOST=${parts[0]} - PORT=${parts[1]} - ;; - 3) - PROTOCOL=${parts[0]} - HOST=${parts[1]} - PORT=${parts[2]} - ;; -esac - -sed -i 's/\(serverProtocol\)=.*/\1='$PROTOCOL'/' jetty/resources/search.config -sed -i 's/\(serverHost\)=.*/\1='$HOST'/' jetty/resources/search.config -sed -i 's/\(serverPort\)=.*/\1='$PORT'/' jetty/resources/search.config -sed -i 's/\(indexerUser\)=.*/\1='$P4USER'/' jetty/resources/search.config -sed -i 's/\(indexerPassword\)=.*/\1='$P4PASSWD'/' jetty/resources/search.config -if [ ! -z "$P4CHARSET" ]; then - sed -i 's/\(serverCharset\)=.*/\1='$P4CHARSET'/' jetty/resources/search.config -fi -if [ ! -z "$P4COMMONSURL" ]; then - sed -i 's>^\(# \|\)\(com.perforce.search.commonsURL\)=.*>\2='$P4COMMONSURL'>' jetty/resources/search.config -fi -if [ ! -z "$P4WEBURL" ]; then - sed -i 's>^\(# \|\)\(com.perforce.search.webURL\)=.*>\2='$P4WEBURL'>' jetty/resources/search.config -fi -if [ ! -z "$P4SWARMURL" ]; then - sed -i 's>^\(# \|\)\(com.perforce.search.swarmURL\)=.*>\2='$P4SWARMURL'>' jetty/resources/search.config -fi - -# Token -sed -i 's/^# \(com.perforce.search.fileScannerToken\)/\1/' jetty/resources/search.config -sed -i 's/\(searchEngineToken\)=.*/\1='$P4TOKEN'/' jetty/resources/search.config - -## Solr config -sed -i 's/^JPORT=.*/JPORT=8983/' solr/example/solr-control.sh -sed -i 's/^STOP=.*/STOP=8984/' solr/example/solr-control.sh - -# Start solr and jetty/p4search -solr/example/solr-control.sh start -jetty/p4search-control.sh start - -JETTY_PID=$(ps axf | grep jetty/start.jar | grep -v grep | awk '{print $1}') -tail --pid=$JETTY_PID -f start.log logs/solr.log diff --git a/perforce-server/Dockerfile b/perforce-server/Dockerfile deleted file mode 100644 index a2d917e..0000000 --- a/perforce-server/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM noonien/perforce-base -LABEL maintainer="George Jiglau " - -# Install the perforce server -RUN apt-get update && apt-get install -y helix-p4d=2018.2-1751184~bionic curl && \ - # clean temporary files - rm -rf /var/log/* && \ - rm -rf /var/lib/apt/lists/* - -# Volumes for server roots and triggers -VOLUME /opt/perforce/servers -VOLUME /opt/perforce/triggers - -# Add startup file and run it by default -COPY run.sh / -CMD ["/run.sh"] diff --git a/perforce-server/README.md b/perforce-server/README.md deleted file mode 100644 index 7830098..0000000 --- a/perforce-server/README.md +++ /dev/null @@ -1,21 +0,0 @@ -perforce-server -=============== -[![Docker Build Status](http://hubstatus.container42.com/noonien/perforce-server)](https://registry.hub.docker.com/u/noonien/perforce-server) - -This is a docker image for the [Perforce Helix Server](http://www.perforce.com/). - -Usage ------ - - docker run -e SERVER_NAME=server-name -e P4PASSWD= -p 1666:1666 noonien/perforce-server - -Details -------- -The following environment variables are available: - - - SERVER_NAME - Server name. Required. - - P4PORT - Address on which to listen. Described [here](http://www.perforce.com/perforce/doc.current/manuals/cmdref/P4PORT.html). Defaults to ssl:1666. - - P4USER - Superuser username. Only created when creating a new server. Defaults to p4admin. - - P4PASSWD - Superuser password. Required when creating a new server. - -The path `/opt/perforce/server` is mounted as a volume because that's where the server roots are stored. diff --git a/perforce-server/run.sh b/run.sh similarity index 94% rename from perforce-server/run.sh rename to run.sh index 0a0ba9e..99ee4bb 100755 --- a/perforce-server/run.sh +++ b/run.sh @@ -2,7 +2,7 @@ set -e # Perforce paths -CONFIGURE_SCRIPT=/opt/perforce/sbin/configure-perforce-server.sh +CONFIGURE_SCRIPT=/opt/perforce/sbin/configure-helix-p4d.sh SERVERS_ROOT=/opt/perforce/servers CONFIG_ROOT=/etc/perforce/p4dctl.conf.d