From 6b4c4fe2e0889f28371a5ba4d33a4605792dc0ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20Sch=C3=A4rtl?= <andreas@schaertl.me>
Date: Tue, 3 Nov 2020 09:26:29 +0100
Subject: [PATCH] deployment: make ports configurable

---
 README.md                     | 16 ++++++++++++++--
 deployment/.env               |  3 +++
 deployment/docker-compose.yml | 16 ++++++++--------
 3 files changed, 25 insertions(+), 10 deletions(-)
 create mode 100644 deployment/.env

diff --git a/README.md b/README.md
index b3ed4d8..6e99cab 100644
--- a/README.md
+++ b/README.md
@@ -18,8 +18,20 @@ Directories
 	- `/src/ulo-rdf4j`: Script for generating `ULO.java` which contains
 	  constants for use with RDF4J.
 
-Configuration
--------------
+Configuration for Docker Compose
+--------------------------------
+
+Configuration of the `/deployment` Docker Compose setup consists of
+three port numbers.
+
+* `ULOCOMPOSE_DBPORT` is the port the GraphDB instance listens on.
+
+* `ULOCOMPOSE_COLLECTPORT` is the port the collector listens on.
+
+* `ULOCOMPOSE_APPPORT` is the port the application listens on.
+
+Configuration for Local Installs
+--------------------------------
 
 The `src/ulo-storage-applications` web interface listens on
 `0.0.0.0:7400`. If you wish to change this, you can set the
diff --git a/deployment/.env b/deployment/.env
new file mode 100644
index 0000000..7d664db
--- /dev/null
+++ b/deployment/.env
@@ -0,0 +1,3 @@
+ULOCOMPOSE_DBPORT=7200
+ULOCOMPOSE_COLLECTPORT=7300
+ULOCOMPOSE_APPPORT=7400
diff --git a/deployment/docker-compose.yml b/deployment/docker-compose.yml
index d2b7238..a407ad7 100644
--- a/deployment/docker-compose.yml
+++ b/deployment/docker-compose.yml
@@ -1,10 +1,5 @@
 version: '3'
 services:
-        ulocollectweb:
-                image: "schaertl/ulocollectweb"
-                ports:
-                        - 7300:7300
-
         ulographdb:
                 # We use an unoffcial image as there is no official
                 # image for the free version. It is possible to build
@@ -12,12 +7,17 @@ services:
                 # prefer this solution as it means no special downloads.
                 image: "khaller/graphdb-free:1.2.2-graphdb9.1.1"
                 ports:
-                        - 7200:7200
+                        - ${ULOCOMPOSE_DBPORT}:7200
+
+        ulocollectweb:
+                image: "schaertl/ulocollectweb"
+                ports:
+                        - ${ULOCOMPOSE_COLLECTPORT}:7300
 
         uloapps:
                 image: "schaertl/uloapps:latest"
                 environment:
-                        - ULOAPPS_REMOTE_SERVER=http://ulographdb:7200
+                        - ULOAPPS_REMOTE_SERVER=http://ulographdb:${ULOCOMPOSE_DBPORT}
                         - ULOAPPS_REMOTE_REPOSITORY=compose
                 ports:
-                        - 7400:7400
+                        - ${ULOCOMPOSE_APPPORT}:7400
-- 
GitLab