From aeafd6f82bf991e699473019c5881fa6fe880b56 Mon Sep 17 00:00:00 2001 From: Luca Rullo Date: Fri, 21 Oct 2022 15:48:15 +0000 Subject: [PATCH] Add: Tomcat, Solr, Fedora Docker files && basic config --- Dockerfile | 3 +- README.md | 21 + Solr.Dockerfile | 6 + Tomcat.Dockerfile | 45 + config/schema.xml | 1144 ++++++++++++++++++++++++ config/solrconfig.xml | 1793 ++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 33 + fcrepo/allowed_hosts.txt | 1 + fcrepo/fcrepo-config.xml | 88 ++ fcrepo/i8_namespaces.cnd | 31 + fcrepo/repository.json | 39 + fcrepo/setenv.sh | 4 + fcrepo/tomcat-users.xml | 12 + fcrepo/tomcat.service | 11 + 14 files changed, 3230 insertions(+), 1 deletion(-) create mode 100644 Solr.Dockerfile create mode 100644 Tomcat.Dockerfile create mode 100644 config/schema.xml create mode 100644 config/solrconfig.xml create mode 100644 fcrepo/allowed_hosts.txt create mode 100644 fcrepo/fcrepo-config.xml create mode 100644 fcrepo/i8_namespaces.cnd create mode 100644 fcrepo/repository.json create mode 100644 fcrepo/setenv.sh create mode 100644 fcrepo/tomcat-users.xml create mode 100644 fcrepo/tomcat.service diff --git a/Dockerfile b/Dockerfile index 8bff0e6..36c2fc3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,8 +13,9 @@ RUN apt install -y \ php5.6-gd php5.6-curl php5.6-mcrypt php5.6-imagick php5.6-json php5.6-xsl php5.6-mysql php5.6-apcu php5.6-common RUN a2enmod proxy* +RUN a2enmod rewrite -COPY data/ /var/www/2017.artxibo.arteleku.net/ +COPY server/data/ /var/www/2017.artxibo.arteleku.net/ RUN chown -R www-data:www-data /var/www/ diff --git a/README.md b/README.md index 1b2e300..641c6b5 100644 --- a/README.md +++ b/README.md @@ -28,5 +28,26 @@ docker-compose up -d docker exec -i mysql -u -p < database.dump.sql +## Config Drupal + +/sites/default/ + +$databases = array ( +.... + database => 'name', + username => user + password => pass + host => host +) +$base_url = "http://myhost.drupal.net"; + +## Config Islandora + +### Configure Solr + +/es/user/3#overlay=es/admin/islandora/search/islandora_solr + +Server: 172.17.0.1:8080/solr + diff --git a/Solr.Dockerfile b/Solr.Dockerfile new file mode 100644 index 0000000..3f22b3b --- /dev/null +++ b/Solr.Dockerfile @@ -0,0 +1,6 @@ +FROM solr:8 + +USER solr + +COPY config/schema.xml /var/solr/data/collection1/conf/schema.xml +COPY config/solrconfig.xml /var/solr/data/collection1/conf/solrconfig.xml diff --git a/Tomcat.Dockerfile b/Tomcat.Dockerfile new file mode 100644 index 0000000..77cdc18 --- /dev/null +++ b/Tomcat.Dockerfile @@ -0,0 +1,45 @@ +FROM debian:stable-slim + +ENV TOMCAT_TARBALL_LINK https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.68/bin/apache-tomcat-9.0.68.tar.gz +ENV TOMCAT_DIRECTORY apache-tomcat-9.0.68 + +RUN apt-get update && apt-get dist-upgrade -y + +RUN apt-get -y install openjdk-11-jdk openjdk-11-jre + +RUN addgroup tomcat +RUN adduser tomcat --ingroup tomcat --home /opt/tomcat --shell /usr/bin + +RUN apt-get -y install wget + +RUN wget -O /tmp/tomcat.tar.gz $TOMCAT_TARBALL_LINK +RUN tar -zxvf /tmp/tomcat.tar.gz + +WORKDIR /opt/tomcat +RUN mv /$TOMCAT_DIRECTORY/* /opt/tomcat/ + +RUN chown -R tomcat:tomcat /opt/tomcat + +COPY fcrepo/setenv.sh /opt/tomcat/bin/setenv.sh + +COPY fcrepo/tomcat.service /etc/systemd/system/tomcat.service + +## Fedora + +COPY fcrepo/i8_namespaces.cnd /opt/fcrepo/config/i8_namespaces.cnd +COPY fcrepo/allowed_hosts.txt /opt/fcrepo/config/allowed_hosts.txt +COPY fcrepo/repository.json /opt/fcrepo/config/repository.json +COPY fcrepo/fcrepo-config.xml /opt/fcrepo/config/fcrepo-config.xml +COPY fcrepo/tomcat-users.xml /opt/tomcat/conf/tomcat-users.xml + +RUN mkdir -p /opt/fcrepo/data/objects +RUN mkdir -p /opt/fcrepo/config +RUN chown -R tomcat:tomcat /opt/fcrepo + +ENV FCREPO_WAR_URL https://github.com/fcrepo/fcrepo/releases/download/fcrepo-6.2.0/fcrepo-webapp-6.2.0.war +RUN wget -O fcrepo.war $FCREPO_WAR_URL +RUN mv fcrepo.war /opt/tomcat/webapps +RUN chown tomcat:tomcat /opt/tomcat/webapps/fcrepo.war + + +ENTRYPOINT /opt/tomcat/bin/catalina.sh run diff --git a/config/schema.xml b/config/schema.xml new file mode 100644 index 0000000..d8ac8c5 --- /dev/null +++ b/config/schema.xml @@ -0,0 +1,1144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PID + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/solrconfig.xml b/config/solrconfig.xml new file mode 100644 index 0000000..9b1a8cc --- /dev/null +++ b/config/solrconfig.xml @@ -0,0 +1,1793 @@ + + + + + + + + + LUCENE_42 + + + + + + + + + + + + + + + + + + + + + + + + ${solr.data.dir:} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${solr.lock.type:native} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${solr.ulog.dir:} + + + + + 15000 + false + + + + + + + + + + + + + + + + + + + + + 1024 + + + + + + + + + + + + + + + + + + + + + + true + + + + + + 20 + + + 200 + + + + + + + + + + + + static firstSearcher warming in solrconfig.xml + + + + + + false + + + 2 + + + + + + + + + + + + + + + + + + + + + + + explicit + 10 + text + + + + + + + + + + + + + + explicit + json + true + text + + + + + + + + true + json + true + + + + + + + + explicit + + + velocity + browse + layout + Solritas + + + edismax + + text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 + title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0 + + text + 100% + *:* + 10 + *,score + + + text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 + title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0 + + text,features,name,sku,id,manu,cat,title,description,keywords,author,resourcename + 3 + + + on + cat + manu_exact + content_type + author_s + ipod + GB + 1 + cat,inStock + after + price + 0 + 600 + 50 + popularity + 0 + 10 + 3 + manufacturedate_dt + NOW/YEAR-10YEARS + NOW + +1YEAR + before + after + + + on + content features title name + html + <b> + </b> + 0 + title + 0 + name + 3 + 200 + content + 750 + + + on + false + 5 + 2 + 5 + true + true + 5 + 3 + + + + + spellcheck + + + + + + + + + + + + + + application/json + + + + + application/csv + + + + + + + true + ignored_ + + + true + links + ignored_ + + + + + + + + + + + + + + + + + + + + + + solrpingquery + + + all + + + + + + + + + explicit + true + + + + + + + + + + + + + + + + textSpell + + + + + + default + name + solr.DirectSolrSpellChecker + + internal + + 0.5 + + 2 + + 1 + + 5 + + 4 + + 0.01 + + + + + + wordbreak + solr.WordBreakSolrSpellChecker + name + true + true + 10 + + + + + + + + + + + + + + + + text + + default + wordbreak + on + true + 10 + 5 + 5 + true + true + 10 + 5 + + + spellcheck + + + + + + + + + + text + true + + + tvComponent + + + + + + + + + default + + + org.carrot2.clustering.lingo.LingoClusteringAlgorithm + + + 20 + + + clustering/carrot2 + + + ENGLISH + + + stc + org.carrot2.clustering.stc.STCClusteringAlgorithm + + + + + + + true + default + true + + name + id + + features + + true + + + + false + + edismax + + text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 + + *:* + 10 + *,score + + + clustering + + + + + + + + + + true + false + + + terms + + + + + + + + string + elevate.xml + + + + + + explicit + text + + + elevator + + + + + + + + + + + 100 + + + + + + + + 70 + + 0.5 + + [-\w ,/\n\"']{20,200} + + + + + + + ]]> + ]]> + + + + + + + + + + + + + + + + + + + + + + + + ,, + ,, + ,, + ,, + ,]]> + ]]> + + + + + + 10 + .,!? + + + + + + + WORD + + + en + US + + + + + + + + + + + + + + + + + + + + + + text/plain; charset=UTF-8 + + + + + + + + + 5 + + + + + + + + + + + + + + + + + + *:* + + + diff --git a/docker-compose.yml b/docker-compose.yml index ac6a125..bdf16fd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,5 @@ +volumes: + solr: version: "2.4" services: db: @@ -16,3 +18,34 @@ services: restart: always ports: - 8888:80 + phpmyadmin: + image: phpmyadmin + restart: always + ports: + - 8889:80 + environment: + - PMA_HOST=db + solr: + image: solr:5.5 + #build: + # context: . + # dockerfile: Solr.Dockerfile + volumes: + - solr:/opt/solr/server/solr + restart: always + ports: + - 8887:8983 + tomcat: + build: + context: . + dockerfile: Tomcat.Dockerfile + restart: always + ports: + - 8886:8080 + pg: + image: postgres:15 + restart: always + environment: + - POSTGRES_DB=fedora + - POSTGRES_USER=fedora + - POSTGRES_PASSWORD=fedora diff --git a/fcrepo/allowed_hosts.txt b/fcrepo/allowed_hosts.txt new file mode 100644 index 0000000..e5f81ab --- /dev/null +++ b/fcrepo/allowed_hosts.txt @@ -0,0 +1 @@ +http://CRAYFISH_HOST:CRAYFISH_PORT/ diff --git a/fcrepo/fcrepo-config.xml b/fcrepo/fcrepo-config.xml new file mode 100644 index 0000000..a175d06 --- /dev/null +++ b/fcrepo/fcrepo-config.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /** = servletContainerAuthFilter,headerProvider,delegatedPrincipalProvider,webACFilter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fcrepo/i8_namespaces.cnd b/fcrepo/i8_namespaces.cnd new file mode 100644 index 0000000..61a814d --- /dev/null +++ b/fcrepo/i8_namespaces.cnd @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fcrepo/repository.json b/fcrepo/repository.json new file mode 100644 index 0000000..69a369f --- /dev/null +++ b/fcrepo/repository.json @@ -0,0 +1,39 @@ +{ + "name" : "repo", + "jndiName" : "", + "workspaces" : { + "predefined" : ["default"], + "default" : "default", + "allowCreation" : true, + "cacheSize" : 10000 + }, + "storage" : { + "persistence": { + "type" : "db", + "connectionUrl": "jdbc:postgresql://pg:5432/fedora", + "driver" : "org.postgresql.Driver", + "username" : "fedora", + "password" : "fedora" + }, + "binaryStorage" : { + "type" : "file", + "directory" : "/opt/fcrepo/data/binaries", + "minimumBinarySizeInBytes" : 4096 + } + }, + "security" : { + "anonymous" : { + "roles" : ["readonly","readwrite","admin"], + "useOnFailedLogin" : false + }, + "providers" : [ + { "classname" : "org.fcrepo.auth.common.BypassSecurityServletAuthenticationProvider" } + ] + }, + "garbageCollection" : { + "threadPool" : "modeshape-gc", + "initialTime" : "00:00", + "intervalInHours" : 24 + }, + "node-types" : ["fedora-node-types.cnd", "file:/opt/fcrepo/config/i8_namespaces.cnd"] +} diff --git a/fcrepo/setenv.sh b/fcrepo/setenv.sh new file mode 100644 index 0000000..5ba240f --- /dev/null +++ b/fcrepo/setenv.sh @@ -0,0 +1,4 @@ +export CATALINA_HOME="/opt/tomcat" +export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64" +#export JAVA_OPTS="-Djava.awt.headless=true -server -Xmx1500m -Xms1000m" +export JAVA_OPTS="-Djava.awt.headless=true -Dfcrepo.home=/otp/fcrepo/data -Dfcrepo.velocity.runtime.log=/opt/tomcat/logs/velocity.log -Dfcrepo.jms.baseUrl=http://localhost:8080/fcrepo/rest -Dfcrepo.autoversioning.enabled=false -DconnectionTimeout=-1 -Dfcrepo.db.url=jdbc:postgresql://pg:5432/fedora -Dfcrepo.db.user=fedora -Dfcrepo.db.password=fedora -server -Xmx1500m -Xms1000m" diff --git a/fcrepo/tomcat-users.xml b/fcrepo/tomcat-users.xml new file mode 100644 index 0000000..22cd831 --- /dev/null +++ b/fcrepo/tomcat-users.xml @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/fcrepo/tomcat.service b/fcrepo/tomcat.service new file mode 100644 index 0000000..0035ae2 --- /dev/null +++ b/fcrepo/tomcat.service @@ -0,0 +1,11 @@ +[Unit] +Description=Tomcat + +[Service] +Type=forking +ExecStart=/opt/tomcat/bin/startup.sh +ExecStop=/opt/tomcat/bin/shutdown.sh +SyslogIdentifier=tomcat + +[Install] +WantedBy=multi-user.target