From 593327f5d348949a0bede504ed3884cd85c81a15 Mon Sep 17 00:00:00 2001
From: stedif <stefano.difrischia@inaf.it>
Date: Wed, 10 Nov 2021 11:50:58 +0100
Subject: [PATCH] L2SS-429: add readme file

---
 docker-compose/timescaledb/Dockerfile |  5 -----
 docker-compose/timescaledb/README.md  | 18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 5 deletions(-)
 create mode 100644 docker-compose/timescaledb/README.md

diff --git a/docker-compose/timescaledb/Dockerfile b/docker-compose/timescaledb/Dockerfile
index ae5930dbf..21385d861 100644
--- a/docker-compose/timescaledb/Dockerfile
+++ b/docker-compose/timescaledb/Dockerfile
@@ -6,8 +6,3 @@ COPY resources/02_hdb_schema.sql docker-entrypoint-initdb.d/003_hdb_schema.sql
 COPY resources/03_hdb_roles.sql docker-entrypoint-initdb.d/004_hdb_roles.sql
 COPY resources/04_hdb_ext_aggregates.sql docker-entrypoint-initdb.d/005_hdb_ext_aggregates.sql
 COPY resources/05_cleanup.sql docker-entrypoint-initdb.d/006_cleanup.sql
-
-# 2nd version
-#COPY resources_v2/schema.sql docker-entrypoint-initdb.d/002_schema.sql
-#COPY resources_v2/schema.sql docker-entrypoint-initdb.d/003_users.sql
-#COPY resources_v2/schema.sql docker-entrypoint-initdb.d/004_cluster.sql
diff --git a/docker-compose/timescaledb/README.md b/docker-compose/timescaledb/README.md
new file mode 100644
index 000000000..0059422d6
--- /dev/null
+++ b/docker-compose/timescaledb/README.md
@@ -0,0 +1,18 @@
+# TimescaleDB Docker Image
+
+The Dockerfile in this directory allows to create a container with a PostrgreSQL-Timescale DBMS (https://www.timescale.com/), and then initialise it with the DB schema required by the Tango Archiving framework.
+
+The main image is pulled from the official PostgreSQL repository in the Docker Hub (https://hub.docker.com/_/postgres). This image offers several features to customize and extend itself.
+
+## Initialization scripts
+
+If you would like to do additional initialization in an image derived from the Postgres official one, add one or more *.sql, *.sql.gz, or *.sh scripts under /docker-entrypoint-initdb.d (creating the directory if necessary). After the entrypoint calls initdb to create the default postgres user and database, it will run any *.sql files, run any executable *.sh scripts, and source any non-executable *.sh scripts found in that directory to do further initialization before starting the service.
+
+The script files in the directory /docker-entrypoint-initdb.d are sequentially executed following their preempted number in the filename. Hence, the first ones (000_install_timescaledb.sh and 001_timescaledb_tune.sh) are provided by default. 
+The next ones have been pulled from the official Tango repository in order to create the desired DB schema. These files are in the 'resources' directory and they have been pulled from Tango-Hdbpp_Timescale_Project (https://github.com/tango-controls-hdbpp/hdbpp-timescale-project/tree/master/resources/schema):
+- admin.sql creates the admin user that will create the tables
+- hdb_schema.sql creates the standard Tango Archiving DB (This is the only MANDATORY script)
+- hdb_roles.sql creates additional roles
+- hdb_ext_aggregates.sql creates the continuous aggregate views (https://docs.timescale.com/timescaledb/latest/how-to-guides/continuous-aggregates/)
+- cleanup.sql strips the SUPERUSER trait from hdb_admin
+
-- 
GitLab