Commit 228de368 authored by Bikram Dhoju's avatar Bikram Dhoju

new codes

parent 3636c17a
This diff is collapsed.
Copyright (c) 2016 1science Devops Team <devops@1science.org>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
## Docker Status by tag
[![](https://images.microbadger.com/badges/version/unixelias/docker-dspace.svg)](https://microbadger.com/images/unixelias/docker-dspace "Docker tag version") [![](https://images.microbadger.com/badges/image/unixelias/docker-dspace.svg)](https://microbadger.com/images/unixelias/docker-dspace "Content layers") [![](https://images.microbadger.com/badges/commit/unixelias/docker-dspace.svg)](https://microbadger.com/images/unixelias/docker-dspace "Last commit")
[![](https://images.microbadger.com/badges/version/unixelias/docker-dspace:5.6.svg)](https://microbadger.com/images/unixelias/docker-dspace:5.6 "Docker tag version") [![](https://images.microbadger.com/badges/image/unixelias/docker-dspace:5.6.svg)](https://microbadger.com/images/unixelias/docker-dspace:5.6 "Content layers") [![](https://images.microbadger.com/badges/commit/unixelias/docker-dspace:5.6.svg)](https://microbadger.com/images/unixelias/docker-dspace:5.6 "Last commit")
[![](https://images.microbadger.com/badges/version/unixelias/docker-dspace:dev.svg)](https://microbadger.com/images/unixelias/docker-dspace:dev "Docker tag version") [![](https://images.microbadger.com/badges/image/unixelias/docker-dspace:5.x-dev.svg)](https://microbadger.com/images/unixelias/docker-dspace:5.x-dev "Content layers") [![](https://images.microbadger.com/badges/commit/unixelias/docker-dspace:5.x-dev.svg)](https://microbadger.com/images/unixelias/docker-dspace:5.x-dev "Last commit")
[![](https://images.microbadger.com/badges/version/unixelias/docker-dspace:5.7-ibict.svg)](https://microbadger.com/images/unixelias/docker-dspace:5.7-ibict "Docker tag version") [![](https://images.microbadger.com/badges/image/unixelias/docker-dspace:5.7-ibict.svg)](https://microbadger.com/images/unixelias/docker-dspace:5.7-ibict "Content layers") [![](https://images.microbadger.com/badges/commit/unixelias/docker-dspace:5.7-ibict.svg)](https://microbadger.com/images/unixelias/docker-dspace:5.7-ibict "Last commit")
## Build Status
[![Build Status](https://travis-ci.org/unixelias/docker-dspace.svg?branch=master)](https://travis-ci.org/unixelias/docker-dspace)
# What is DSpace?
![logo](https://github.com/unixelias/docker-dspace/raw/master/logo.png)
[DSpace](https://wiki.duraspace.org/display/DSDOC6x/Introduction) is an open source repository software package typically used for creating open access repositories for scholarly and/or published digital content. While DSpace shares some feature overlap with content management systems and document management systems, the DSpace repository software serves a specific need as a digital archives system, focused on the long-term storage, access and preservation of digital content.
This image is based on official [Ubuntu image](https://hub.docker.com/_/ubuntu/) and use [Tomcat](http://tomcat.apache.org/) to run DSpace as defined in the [installation guide](https://wiki.duraspace.org/display/DSDOC6x/Installing+DSpace).
# Usage
DSpace use [PostgreSQL](http://www.postgresql.org/) as database.
[![](https://badge.imagelayers.io/1science/dspace:latest.svg)](https://imagelayers.io/?images=1science/dspace:latest 'Get your own badge on imagelayers.io')
# What is DSpace?
......@@ -16,6 +39,14 @@ We might use an external database or create a PostgreSQL container linked to the
## Postgres as a container
[![](https://images.microbadger.com/badges/image/unixelias/postgres-dspace:9.6-dev.svg)](https://microbadger.com/images/unixelias/postgres-dspace:9.6-dev "Get your own image badge on microbadger.com") [![](https://images.microbadger.com/badges/version/unixelias/postgres-dspace:9.6-dev.svg)](https://microbadger.com/images/unixelias/postgres-dspace:9.6-dev "Get your own version badge on microbadger.com") [![](https://images.microbadger.com/badges/commit/unixelias/postgres-dspace:9.6-dev.svg)](https://microbadger.com/images/unixelias/postgres-dspace:9.6-dev "Get your own commit badge on microbadger.com")
We have a custom [PostgreSQL Docker Image](https://hub.docker.com/r/unixelias/postgres-dspace/) used to change default locale of PostgreSQL to pt-BR. If you will use the default english language you may not need this, but it can be useful if you need a custom language. The source is avaliable at docker/postgres/Dockerfile
First, we have to create the PostgreSQL container:
```
docker run -d --name dspace_db -p 5432:5432 unixelias/postgres-dspace
First, we have to create the PostgreSQL container:
```
......@@ -25,6 +56,7 @@ docker run -d --name dspace_db -p 5432:5432 postgres
then run DSpace linking the PostgreSQL container:
```
docker run -d --link dspace_db:postgres -p 8080:8080 unixelias/docker-dspace
docker run -d --link dspace_db:postgres -p 8080:8080 1science/dspace
```
......@@ -36,7 +68,7 @@ docker run -d --link dspace_db:postgres \
-e POSTGRES_SCHEMA=my_dspace \
-e POSTGRES_USER=my_user \
-e POSTGRES_PASSWORD=my_password \
-p 8080:8080 1science/dspace
-p 8080:8080 unixelias/docker-dspace
```
We might also used the Docker compose project in the `sample` directory.
......@@ -44,16 +76,15 @@ We might also used the Docker compose project in the `sample` directory.
## External database
When you use an external Postgres, you have to set some environment variables :
- `POSTGRES_DB_HOST` (required): The server host name or ip.
- `POSTGRES_DB_PORT` (optional): The server port (`5432` by default)
- `POSTGRES_SCHEMA` (optional): The database schema (`dspace` by default)
- `POSTGRES_USER` (optional): The user used by DSpace (`dspace` by default)
- `POSTGRES_PASSWORD` (optional): The password of the user used by DSpace (`dspace` by default)
- `POSTGRES_ADMIN_USER` (optional): The admin user creating the Database and the user (`postgres` by default)
- `POSTGRES_ADMIN_PASSWORD` (optional): The password of the admin user
```
docker run -d \
-e POSTGRES_DB_HOST=my_host \
-e POSTGRES_ADMIN_USER=my_admin \
......@@ -61,9 +92,7 @@ docker run -d \
-e POSTGRES_SCHEMA=my_dspace \
-e POSTGRES_USER=my_user \
-e POSTGRES_PASSWORD=my_password \
-p 8080:8080 1science/dspace
```
-p 8080:8080 unixelias/docker-dspace
After few seconds DSpace should be accessible from:
......@@ -86,6 +115,9 @@ docker run -d --link dspace_db:postgres \
The command above only installed the webapps `jspui` `xmlui` and `rest`.
# Build
This project is configured as an [automated build in Dockerhub](https://hub.docker.com/r/unixelias/docker-dspace/).
# Build
......@@ -96,6 +128,7 @@ Each branch give the related image tag.
# License
All the code contained in this repository, unless explicitly stated, is
licensed under Apache License Version 2.0.
licensed under ISC license.
A copy of the license can be found inside the [LICENSE](LICENSE) file.
#!/bin/bash
shopt -s extglob
for i in $( ls docker); do
if [ "$i" == "postgres" ]; then
### Build DB
docker build -t unixelias/postgres-dspace:9.6-ptbr \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=`git rev-parse --short HEAD` docker/postgres \
&& docker push unixelias/postgres-dspace:9.6-ptbr
else
case "$i" in
*-test ) ;;
* ) docker build -t unixelias/docker-dspace:$i \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=`git rev-parse --short HEAD` docker/$i \
&& docker push unixelias/docker-dspace:$i ;;
esac
fi
done
docker tag unixelias/docker-dspace:6.0 unixelias/docker-dspace:latest && docker push unixelias/docker-dspace:latest
#
# # Build DB
# docker build -t unixelias/postgres-dspace:9.6-ptbr \
# --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
# --build-arg VCS_REF=`git rev-parse --short HEAD` docker/postgres \
# && docker push unixelias/postgres-dspace:9.6-ptbr
## Build DSpace
#
# docker build -t unixelias/docker-dspace:5.6-dev \
# --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
# --build-arg VCS_REF=`git rev-parse --short HEAD` docker/5.6 \
# && docker push unixelias/docker-dspace:5.6-dev
#
#
# docker build -t unixelias/docker-dspace:5.x-dev \
# --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
# --build-arg VCS_REF=`git rev-parse --short HEAD` docker/dev \
# && docker push unixelias/docker-dspace:5.x-dev
version: "2"
services:
postgres:
image: unixelias/postgres-dspace:9.6-ptbr
hostname: postgres
restart: always
volumes:
- db_data:/var/lib/postgresql/data
dspace:
image: unixelias/docker-dspace:dev
# If you wanto to change the configuration you can build again
# and add custom config files
#build: ./dspace
ports:
- 8080:8080
depends_on:
- postgres
environment:
- POSTGRES_DB_HOST=postgres
- POSTGRES_ADMIN_USER=postgres
- POSTGRES_ADMIN_PASSWORD=postgres
- POSTGRES_SCHEMA=dspace
- POSTGRES_USER=dspace
- POSTGRES_PASSWORD=password
command: start-dspace
volumes:
db_data:
# This Dockerfile is needed just to control the startup order
# see: https://docs.docker.com/compose/startup-order/
FROM unixelias/docker-dspace:dev
#Some configs for 6.0
COPY ./config/setenv.sh "$CATALINA_HOME"/bin
# COPY ./config/server.xml "$CATALINA_HOME"/conf
#
# COPY ./config/setup-postgres /dspace/bin
# COPY ./config/start-dspace /dspace/bin
# COPY ./config/local.cfg.UTF-8 /dspace/config
#
# RUN rm /dspace/config/local.cfg \
# && iconv -f UTF-8 -t ISO-8859-1 /dspace/config/local.cfg.UTF-8 > /dspace/config/local.cfg \
# && cat /dspace/config/local.cfg
# && locale-gen pt en es \
#&& unlink /etc/localtime \
#&& ln -s /usr/share/zoneinfo/Brazil/East /etc/localtime
# #EXPOSE 8080
# ENV DSPACE_HOME=/dspace
# WORKDIR /dspace
CMD ["start-dspace"]
# EXAMPLE "local.cfg" for DSpace.
#
# Any configurations added to this file will automatically OVERRIDE configurations
# of the same name in any of the DSpace *.cfg files. This includes overriding
# settings in any of these files:
# * [dspace]/config/dspace.cfg
# * Or any configuration file that is included in 'dspace.cfg'
# (See "include = [filepath]" settings near the end of dspace.cfg.
# By default, it includes all [dspace]/config/modules/*.cfg files)
#
# By default, this EXAMPLE file includes a number of commonly overridden configurations.
# * ADD configurations by simply copying them into this file from any existing *.cfg file.
# * REMOVE configurations by simply commenting them out or deleting them below.
#
# Any commented out settings in this file are simply ignored. A configuration
# will only override another configuration if it has the EXACT SAME key/name.
# For example, including "dspace.dir" in this local.cfg will override the
# default value of "dspace.dir" in the dspace.cfg file.
# Similarly, including "oai.solr.url" in this local.cfg will override the
# default value of "oai.solr.url" in the modules/oai.cfg file.
#
##########################
# SERVER CONFIGURATION #
##########################
# DSpace installation directory.
# This is the location where you want to install DSpace.
# Windows note: Please remember to use forward slashes for all paths (e.g. C:/dspace)
dspace.dir=/dspace
# DSpace host name - should match base URL. Do not include port number
dspace.hostname = localhost
# DSpace base host URL. Include port number etc.
dspace.baseUrl = http://localhost:8080
# The user interface you will be using for DSpace. Common usage is either xmlui or jspui
####################################################
# Changed #
dspace.ui = jspui
# Full link your end users will use to access DSpace. In most cases, this will be the baseurl followed by
# the context path to the UI you are using.
#
# Alternatively, you can use a url redirect or deploy the web application under the servlet container root.
# In this case, make sure to remove the /${dspace.ui} from the dspace.url property.
#dspace.url = ${dspace.baseUrl}/${dspace.ui}
####################################################
# Changed #
# This overrides the default value of "dspace.baseUrl" in dspace.cfg
#dspace.baseUrl = http://acervo.ufvjm.edu.br
# The overrides the default "dspace.url" setting it to the same value as my "baseUrl" above
#dspace.url = ${dspace.baseUrl}
# Name of the site
####################################################
# Changed #
dspace.name = Repositório Institucional - R.I. UFVJM
# assetstore.dir, look at DSPACE/config/spring/api/bitstore.xml for more options
# default is ${dspace.dir}/assetstore, uncomment and modify if you need to use a different path
#assetstore.dir = ${dspace.dir}/assetstore
assetstore.dir = ${dspace.dir}/assetstore
# Default language for metadata values
####################################################
# Change defaulto to Brazilian PT #
default.language = pt_BR
# Solr server/webapp.
# DSpace uses Solr for all search/browse capability (and for usage statistics by default).
# The included 'solr' webapp MUST be deployed to Tomcat for DSpace to function.
# Usually it will be available via port 8080 and the 'solr' context path. But,
# But, you may need to modify this if you are running DSpace on a custom port, etc.
solr.server = http://localhost:8080/solr
##########################
# DATABASE CONFIGURATION #
##########################
# DSpace only supports two database types: PostgreSQL or Oracle
# URL for connecting to database
# * Postgres template: jdbc:postgresql://localhost:5432/dspace
# * Oracle template: jdbc:oracle:thin:@//localhost:1521/xe
####################################################
# Change defaulto to work in docker-compose #
db.url = jdbc:postgresql://postgres:5432/dspace
# JDBC Driver
# * For Postgres: org.postgresql.Driver
# * For Oracle: oracle.jdbc.OracleDriver
db.driver = org.postgresql.Driver
# Database Dialect (for Hibernate)
# * For Postgres: org.dspace.storage.rdbms.hibernate.postgres.DSpacePostgreSQL82Dialect
# * For Oracle: org.hibernate.dialect.Oracle10gDialect
db.dialect = org.dspace.storage.rdbms.hibernate.postgres.DSpacePostgreSQL82Dialect
# Database username and password
db.username = dspace
db.password = dspace
# Database Schema name
# * For Postgres, this is often "public" (default schema)
# * For Oracle, schema is equivalent to the username of your database account,
# so this may be set to ${db.username} in most scenarios.
db.schema = public
## Connection pool parameters
# Maximum number of DB connections in pool (default = 30)
#db.maxconnections = 30
# Maximum time to wait before giving up if all connections in pool are busy (milliseconds)
# (default = 5000ms or 5 seconds)
#db.maxwait = 5000
# Maximum number of idle connections in pool (-1 = unlimited)
# (default = 10)
#db.maxidle = 10
#######################
# EMAIL CONFIGURATION #
#######################
# SMTP mail server (allows DSpace to send email notifications)
#mail.server = smtp.example.com
# SMTP mail server authentication username and password (if required)
#mail.server.username = myusername
#mail.server.password = mypassword
# SMTP mail server alternate port (defaults to 25)
#mail.server.port = 25
# From address for mail
# All mail from the DSpace site will use this 'from' address
#mail.from.address = dspace-noreply@myu.edu
# When feedback is submitted via the Feedback form, it is sent to this address
# Currently limited to one recipient!
#feedback.recipient = dspace-help@myu.edu
# General site administration (Webmaster) e-mail
#mail.admin = dspace-help@myu.edu
# Recipient for server errors and alerts (defaults to mail.admin)
#alert.recipient = ${mail.admin}
# Recipient for new user registration emails (defaults to unspecified)
#registration.notify =
########################
# HANDLE CONFIGURATION #
########################
#
# Canonical Handle URL prefix
#
# Items in DSpace receive a unique URL, stored in dc.identifier.uri
# after it is generated during the submission process.
#
# If you register with CNRI's handle service at http://www.handle.net/,
# these links can be generated as permalinks using http://hdl.handle.net/
# as canonical prefix. Please make sure to change handle.canonical.prefix
# after registering with handle.net by uncommenting one of the following
# lines, depending if you prefer to use http or https:
# handle.canonical.prefix = http://hdl.handle.net/
# handle.canonical.prefix = https://hdl.handle.net/
#
# Note that this will not alter dc.identifer.uri metadata for existing
# items (only for subsequent submissions), but it will alter the URL
# in JSPUI's 'identifier' message on item record pages for existing items.
# CNRI Handle prefix
# (Defaults to a dummy/fake prefix of 123456789)
#handle.prefix = 123456789
#######################
# PROXY CONFIGURATION #
#######################
# uncomment and specify both properties if proxy server required
# proxy server for external http requests - use regular hostname without port number
#http.proxy.host =
# port number of proxy server
#http.proxy.port =
##########################
# AUTHENTICATION METHODS #
##########################
# EXAMPLE OVERRIDE:
# Override the default authentication method(s) defined in authentication.cfg
# by defining your own custom ordered list in this local.cfg.
#
# By default, all of these methods are commented out and DSpace will use the
# settings from authentication.cfg. But you may uncomment whichever plugins you
# need in order to change the default settings (or reorder them below).
#
# You may also copy default settings from the corresponding authentication-*.cfg
# configuration file and override them in this local.cfg.
# IP-based authentication/authorization. See authentication-ip.cfg for default configuration.
#plugin.sequence.org.dspace.authenticate.AuthenticationMethod = org.dspace.authenticate.IPAuthentication
# LDAP authentication/authorization. See authentication-ldap.cfg for default configuration.
#plugin.sequence.org.dspace.authenticate.AuthenticationMethod = org.dspace.authenticate.LDAPAuthentication
# Shibboleth authentication/authorization. See authentication-shibboleth.cfg for default configuration.
#plugin.sequence.org.dspace.authenticate.AuthenticationMethod = org.dspace.authenticate.ShibAuthentication
# X.509 certificate authentication. See authentication-x509.cfg for default configuration.
#plugin.sequence.org.dspace.authenticate.AuthenticationMethod = org.dspace.authenticate.X509Authentication
# Authentication by Password (encrypted in DSpace's database). See authentication-password.cfg for default configuration.
# Enabled by default in authentication.cfg
#plugin.sequence.org.dspace.authenticate.AuthenticationMethod = org.dspace.authenticate.PasswordAuthentication
####################################################
# Changed #
##########################
# LOCALE CONFIGURATION #
##########################
default.locale = pt_BR
webui.supported.locales = pt_BR, en
##########################
# LOG CONFIGURATION #
##########################
log.init.config = ${dspace.dir}/config/log4j.properties
log.init.config = ${dspace.dir}/config/log4j-console.properties
log.dir = ${dspace.dir}/log
loglevel.dspace = INFO
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina">
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
-->
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
-->
<!-- ##############################################################
Custom Dspace configuration following
https://wiki.duraspace.org/display/DSDOC6x/Installing+DSpace
##############################################################
-->
<Connector port="8080"
maxThreads="150"
minSpareThreads="25"
enableLookups="false"
redirectPort="8443"
acceptCount="100"
connectionTimeout="20000"
disableUploadTimeout="true"
URIEncoding="UTF-8"/>
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
This connector uses the NIO implementation. The default
SSLImplementation will depend on the presence of the APR/native
library and the useOpenSSL attribute of the
AprLifecycleListener.
Either JSSE or OpenSSL style configuration may be used regardless of
the SSLImplementation selected. JSSE style configuration is used below.
-->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true">
<SSLHostConfig>
<Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
type="RSA" />
</SSLHostConfig>
</Connector>
-->
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
This connector uses the APR/native implementation which always uses
OpenSSL for TLS.
Either JSSE or OpenSSL style configuration may be used. OpenSSL style
configuration is used below.
-->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
maxThreads="150" SSLEnabled="true" >
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
<SSLHostConfig>
<Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
certificateFile="conf/localhost-rsa-cert.pem"
certificateChainFile="conf/localhost-rsa-chain.pem"
type="RSA" />
</SSLHostConfig>
</Connector>
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t &quot;%r&quot; %s %b" />
</Host>
</Engine>
</Service>
</Server>
export CATALINA_OPTS="$CATALINA_OPTS -Xms512m"
export CATALINA_OPTS="$CATALINA_OPTS -Xmx2048m"
export MAVEN_OPTS="-Xmx2048m"
export JAVA_OPTS="-Xmx2048m -Xms512m -Dfile.encoding=UTF-8 -Djava.awt.headless=true -XX:+UseParallelGC -XX:MaxGCPauseMillis=1500 -XX:GCTimeRatio=9 -server -XX:+DisableExplicitGC"
# Check for application specific parameters at startup
if [ -r "$CATALINA_BASE/bin/appenv.sh" ]; then
. "$CATALINA_BASE/bin/appenv.sh"
fi
echo "Using CATALINA_OPTS:"
for arg in $CATALINA_OPTS
do
echo ">> " $arg
done
echo ""
echo "Using JAVA_OPTS:"
for arg in $JAVA_OPTS
do
echo ">> " $arg
done
echo ""
echo "Using MAVEN_OPTS:"
for arg in $MAVEN_OPTS
do
echo ">> " $arg
done
echo "_______________________________________________"
echo ""
#!/usr/bin/env bash
set -e
POSTGRES_DB_HOST=${POSTGRES_DB_HOST:-$POSTGRES_PORT_5432_TCP_ADDR}
POSTGRES_DB_PORT=${POSTGRES_DB_PORT:-$POSTGRES_PORT_5432_TCP_PORT}
POSTGRES_DB_PORT=${POSTGRES_DB_PORT:-5432}
POSTGRES_USER=${POSTGRES_USER:-dspace}
POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-dspace}
POSTGRES_SCHEMA=${POSTGRES_SCHEMA:-dspace}
POSTGRES_ADMIN_USER=${POSTGRES_ADMIN_USER:-postgres}
POSTGRES_ADMIN_PASSWORD=${POSTGRES_ADMIN_PASSWORD}
if [ -z $POSTGRES_DB_HOST -a -z $POSTGRES_DB_PORT ]; then
echo "Please create a postgres container and link it to this one:"
echo "> docker run -d --name dspace_db postgres"
echo "> docker run --link dspace_db:postgres -p 8080:8080 unixelias/docker-dspace setup-postgres"
exit 1
fi
DSPACE_CFG=/dspace/config/dspace.cfg
if [ -n $POSTGRES_ADMIN_PASSWORD ]; then
export PGPASSWORD=$POSTGRES_ADMIN_PASSWORD
fi
# Create database if not exists
SCHEMA_EXISTS=$(psql -h "$POSTGRES_DB_HOST" -p "$POSTGRES_DB_PORT" -U "$POSTGRES_ADMIN_USER" -lqt | cut -d \| -f 1 | grep -qw "$POSTGRES_SCHEMA";echo $?)
if [ $SCHEMA_EXISTS -eq 1 ]; then
psql -h "$POSTGRES_DB_HOST" -p "$POSTGRES_DB_PORT" -d postgres -U "$POSTGRES_ADMIN_USER" -c "CREATE DATABASE $POSTGRES_SCHEMA;" 2>&1 > /dev/null
echo "Database '${POSTGRES_SCHEMA}' created"
fi
# Install extension pgcrypto
EXTENSION_EXISTS=$(psql -h "$POSTGRES_DB_HOST" -p "$POSTGRES_DB_PORT" -U "$POSTGRES_ADMIN_USER" -d dspace -c "SELECT extname FROM pg_extension" | cut -d \| -f 3 | grep "pgcrypto" 2>&1 > /dev/null;echo $?)
if [ "$EXTENSION_EXISTS" -eq 1 ]; then
psql -h "$POSTGRES_DB_HOST" -p "$POSTGRES_DB_PORT" -d dspace -U "$POSTGRES_ADMIN_USER" -c "CREATE EXTENSION pgcrypto;" 2>&1 > /dev/null
echo "Extension 'pgcrypto' installed on '${POSTGRES_SCHEMA}' database"
fi
# Create user
USER_EXISTS=$(psql -h "$POSTGRES_DB_HOST" -p "$POSTGRES_DB_PORT" -d postgres -U "$POSTGRES_ADMIN_USER" -c "SELECT 1 FROM pg_roles WHERE rolname='${POSTGRES_USER}';" | grep "1" 2>&1 > /dev/null; echo $?)
if [ $USER_EXISTS -eq 1 ]; then
psql -h "$POSTGRES_DB_HOST" -p "$POSTGRES_DB_PORT" -d postgres -U "$POSTGRES_ADMIN_USER" -c "CREATE USER $POSTGRES_USER WITH LOGIN PASSWORD '$POSTGRES_PASSWORD';" 2>&1 > /dev/null
psql -h "$POSTGRES_DB_HOST" -p "$POSTGRES_DB_PORT" -d postgres -U "$POSTGRES_ADMIN_USER" -c "GRANT ALL PRIVILEGES ON DATABASE $POSTGRES_SCHEMA to $POSTGRES_USER;" 2>&1 > /dev/null
echo "User '${POSTGRES_USER}' created"
fi
# Configure database in dspace.cfg
sed -i "s#db.url = jdbc:postgresql://localhost:5432/dspace#db.url = jdbc:postgresql://${POSTGRES_DB_HOST}:${POSTGRES_DB_PORT}/${POSTGRES_SCHEMA}#" ${DSPACE_CFG}
sed -i "s#db.username = dspace#db.username = ${POSTGRES_USER}#" ${DSPACE_CFG}
sed -i "s#db.password = dspace#db.password = ${POSTGRES_PASSWORD}#" ${DSPACE_CFG}
echo "Dspace configuration changed"
# Create DSpace administrator
dspace create-administrator -e ${ADMIN_EMAIL:-admin@mail.com} -f ${ADMIN_FIRSTNAME:-DSpace} -l ${ADMIN_LASTNAME:-Admin} -p ${ADMIN_PASSWD:-admin123} -c ${ADMIN_LANGUAGE:-en}
#!/usr/bin/env bash
POSTGRES_DB_HOST=${POSTGRES_DB_HOST:-$POSTGRES_PORT_5432_TCP_ADDR}
POSTGRES_DB_PORT=${POSTGRES_DB_PORT:-$POSTGRES_PORT_5432_TCP_PORT}
POSTGRES_DB_PORT=${POSTGRES_DB_PORT:-5432}
# Create and configure database
if [ -n "$POSTGRES_DB_HOST" -a -n "$POSTGRES_DB_PORT" ]; then
# Check if database is up
until psql -h "$POSTGRES_DB_HOST" -U "postgres" -c '\l'; do
>&2 echo "Postgres is unavailable - sleeping"
sleep 1
done
# Setup postgres
>&2 echo "Postgres is up - executing command"