From df5e3c2ff16f076a064799f46ec5eb125f550df3 Mon Sep 17 00:00:00 2001 From: Eric van der Vlist Date: Thu, 15 Feb 2018 17:59:24 +0100 Subject: [PATCH] Supporting CE and PE and MySQL as well as embedded eXist --- .gitignore | 4 +- Dockerfile | 11 +- Dockerfile-mysql | 3 + docker-compose-ce.yml | 2 +- docker-compose-embedded-exist.yml | 6 + docker-compose-mysql.yml | 27 +++++ docker-compose-pe.yml | 4 +- .../tomcat/conf/Catalina/localhost/orbeon.xml | 8 ++ .../mysql-2017_2.sql | 111 ++++++++++++++++++ .../resources/config/properties-local.xml | 17 +++ .../tomcat/conf/Catalina/localhost/orbeon.xml | 18 +++ 11 files changed, 203 insertions(+), 8 deletions(-) create mode 100644 Dockerfile-mysql create mode 100644 docker-compose-embedded-exist.yml create mode 100644 docker-compose-mysql.yml create mode 100644 embedded-exist/tomcat/conf/Catalina/localhost/orbeon.xml create mode 100644 mysql/docker-entrypoint-initdb.d/mysql-2017_2.sql create mode 100644 mysql/orbeon/WEB-INF/resources/config/properties-local.xml create mode 100644 mysql/tomcat/conf/Catalina/localhost/orbeon.xml diff --git a/.gitignore b/.gitignore index a694146..b9ed39a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -*.xpr \ No newline at end of file +*.xpr +secrets/ +mysql-connector-java*.jar \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d445848..9f6a09f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ FROM tomcat:alpine ARG tag ARG build +ARG flavour RUN \ cd /tmp \ @@ -13,8 +14,10 @@ RUN \ && unzip $build.zip \ && cd $build \ && unzip orbeon.war \ - && rm -rf /usr/local/tomcat/webapps \ - && mkdir -p /usr/local/tomcat/webapps/ROOT \ - && mv WEB-INF/ /usr/local/tomcat/webapps/ROOT \ + && mkdir -p /usr/local/orbeon \ + && mv WEB-INF/ /usr/local/orbeon \ && cd \ - && rm -rf /tmp/orbeon \ No newline at end of file + && rm -rf /tmp/orbeon + +COPY ./$flavour/tomcat/ /usr/local/tomcat/ +COPY ./$flavour/orbeon/ /usr/local/orbeon/ \ No newline at end of file diff --git a/Dockerfile-mysql b/Dockerfile-mysql new file mode 100644 index 0000000..6751fc7 --- /dev/null +++ b/Dockerfile-mysql @@ -0,0 +1,3 @@ +FROM mysql + +COPY ./mysql/docker-entrypoint-initdb.d /docker-entrypoint-initdb.d diff --git a/docker-compose-ce.yml b/docker-compose-ce.yml index 0df0977..a613d80 100644 --- a/docker-compose-ce.yml +++ b/docker-compose-ce.yml @@ -1,4 +1,4 @@ -version: "3" +version: "3.3" services: servlet: build: diff --git a/docker-compose-embedded-exist.yml b/docker-compose-embedded-exist.yml new file mode 100644 index 0000000..07fd86a --- /dev/null +++ b/docker-compose-embedded-exist.yml @@ -0,0 +1,6 @@ +version: "3.3" +services: + servlet: + build: + args: + flavour: "embedded-exist" diff --git a/docker-compose-mysql.yml b/docker-compose-mysql.yml new file mode 100644 index 0000000..f3a1aa0 --- /dev/null +++ b/docker-compose-mysql.yml @@ -0,0 +1,27 @@ +version: "3.3" +services: + servlet: + depends_on: + - db + build: + args: + flavour: "mysql" + networks: + - net + db: + build: + context: . + dockerfile: Dockerfile-mysql + image: mysql-orbeon + restart: always + environment: + MYSQL_ROOT_PASSWORD: osuaL4Ru + MYSQL_DATABASE: orbeon + MYSQL_USER: orbeon + MYSQL_PASSWORD: osuaL4Ru + networks: + - net + +networks: + net: + diff --git a/docker-compose-pe.yml b/docker-compose-pe.yml index 5712b98..d3b9f31 100644 --- a/docker-compose-pe.yml +++ b/docker-compose-pe.yml @@ -9,11 +9,11 @@ services: image: orbeon-pe secrets: - source: license - target: /usr/local/tomcat/webapps/ROOT/WEB-INF/resources/config/license.xml + target: /usr/local/orbeon/WEB-INF/resources/config/license.xml ports: - "8080:8080" secrets: license: - file: ~/.orbeon/license.xml + file: secrets/license.xml diff --git a/embedded-exist/tomcat/conf/Catalina/localhost/orbeon.xml b/embedded-exist/tomcat/conf/Catalina/localhost/orbeon.xml new file mode 100644 index 0000000..2432fe2 --- /dev/null +++ b/embedded-exist/tomcat/conf/Catalina/localhost/orbeon.xml @@ -0,0 +1,8 @@ + + + \ No newline at end of file diff --git a/mysql/docker-entrypoint-initdb.d/mysql-2017_2.sql b/mysql/docker-entrypoint-initdb.d/mysql-2017_2.sql new file mode 100644 index 0000000..16e2bcb --- /dev/null +++ b/mysql/docker-entrypoint-initdb.d/mysql-2017_2.sql @@ -0,0 +1,111 @@ +USE orbeon; +set sql_mode='ALLOW_INVALID_DATES'; + +ALTER DATABASE CHARACTER SET utf8 COLLATE utf8_general_ci; + +CREATE TABLE orbeon_form_definition ( + created TIMESTAMP(6) , + last_modified_time TIMESTAMP(6) , + last_modified_by VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + app VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + form VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + form_version INT NOT NULL, + form_metadata VARCHAR(4000) COLLATE utf8_bin , + deleted CHAR(1) COLLATE utf8_bin NOT NULL, + xml MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci +) ENGINE = InnoDB; + +CREATE TABLE orbeon_form_definition_attach ( + created TIMESTAMP(6) , + last_modified_time TIMESTAMP(6) , + last_modified_by VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + app VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + form VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + form_version INT NOT NULL, + deleted CHAR(1) COLLATE utf8_bin NOT NULL, + file_name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + file_content LONGBLOB +) ENGINE = InnoDB; + +CREATE TABLE orbeon_form_data ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + created TIMESTAMP(6) , + last_modified_time TIMESTAMP(6) , + last_modified_by VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + username VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + groupname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + organization_id INT , + app VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + form VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + form_version INT NOT NULL, + document_id VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + draft CHAR(1) COLLATE utf8_bin NOT NULL, + deleted CHAR(1) COLLATE utf8_bin NOT NULL, + xml MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci +) ENGINE = InnoDB; + +CREATE TABLE orbeon_form_data_attach ( + created TIMESTAMP(6) , + last_modified_time TIMESTAMP(6) , + last_modified_by VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + username VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + groupname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + organization_id INT , + app VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + form VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + form_version INT NOT NULL, + document_id VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + draft CHAR(1) COLLATE utf8_bin NOT NULL, + deleted CHAR(1) COLLATE utf8_bin NOT NULL, + file_name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + file_content LONGBLOB +) ENGINE = InnoDB; + +CREATE TABLE orbeon_form_data_lease ( + document_id VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL PRIMARY KEY, + username VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL , + groupname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + expiration TIMESTAMP(6) NOT NULL +); + +CREATE TABLE orbeon_organization ( + id INT NOT NULL, + depth INT NOT NULL, + pos INT NOT NULL, + name VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL +) ENGINE = InnoDB; + +CREATE TABLE orbeon_seq ( + val INT PRIMARY KEY AUTO_INCREMENT NOT NULL +) ENGINE = InnoDB; + +CREATE TABLE orbeon_i_current ( + data_id INT NOT NULL, + created TIMESTAMP(6) NOT NULL, + last_modified_time TIMESTAMP(6) NOT NULL, + last_modified_by VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + username VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + groupname VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin , + organization_id INT , + app VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, + form VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, + form_version INT NOT NULL, + document_id VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, + draft CHAR(1) NOT NULL, + FOREIGN KEY (data_id) REFERENCES orbeon_form_data(id) +) ENGINE = InnoDB; + +CREATE TABLE orbeon_i_control_text ( + data_id INT NOT NULL, + pos INT NOT NULL, + control VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, + val MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, + FOREIGN KEY (data_id) REFERENCES orbeon_form_data(id) +) ENGINE = InnoDB; + +CREATE INDEX orbeon_form_definition_i1 ON orbeon_form_definition (app, form); +CREATE INDEX orbeon_form_definition_att_i1 ON orbeon_form_definition_attach (app, form, file_name); +CREATE INDEX orbeon_from_data_i1 ON orbeon_form_data (app, form, document_id, draft); +CREATE INDEX orbeon_from_data_attach_i1 ON orbeon_form_data_attach (app, form, document_id, file_name, draft); +CREATE UNIQUE INDEX orbeon_i_current_i1 ON orbeon_i_current (data_id, draft); +CREATE INDEX orbeon_i_control_text_i1 ON orbeon_i_control_text (data_id); diff --git a/mysql/orbeon/WEB-INF/resources/config/properties-local.xml b/mysql/orbeon/WEB-INF/resources/config/properties-local.xml new file mode 100644 index 0000000..b6cf249 --- /dev/null +++ b/mysql/orbeon/WEB-INF/resources/config/properties-local.xml @@ -0,0 +1,17 @@ + + + + + + + diff --git a/mysql/tomcat/conf/Catalina/localhost/orbeon.xml b/mysql/tomcat/conf/Catalina/localhost/orbeon.xml new file mode 100644 index 0000000..1a95329 --- /dev/null +++ b/mysql/tomcat/conf/Catalina/localhost/orbeon.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file