Skip to content

Instantly share code, notes, and snippets.

@oscar9
Last active July 11, 2022 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oscar9/3687e922dc33a369cbc08bad926339eb to your computer and use it in GitHub Desktop.
Save oscar9/3687e922dc33a369cbc08bad926339eb to your computer and use it in GitHub Desktop.
Docker solution proposal for re3gistry v2.3.2
## YAML Template.
---
version: '3.3'
services:
db:
image: postgres:10.20-alpine
container_name: reg-postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-d", "db_prod"]
interval: 30s
timeout: 60s
retries: 5
start_period: 80s
restart: always
environment:
- POSTGRES_USER=name
- POSTGRES_PASSWORD=password
- POSTGRES_DB=registrydb
- ALLOW_IP_RANGE="0.0.0.0/0"
volumes:
- ./dist/db-scripts/registry2_drop-and-create-and-init.sql.orig:/docker-entrypoint-initdb.d/init.sql
# Test database tu use it without installation
# Be sure file sources-main/resources-configurations_files/system.installed
# is removed from the war file. If not, installation will be not detected.
- ./dist/customize-interface/example-profile-developer-docker/dump-docker-202205180929.sql:/docker-entrypoint-initdb.d/init_backup.sql
# login from example db: name@example.com password
expose:
- "5432"
ports:
- 5432:5432
networks:
- main
web:
depends_on:
- db
- solr
build:
context: .
container_name: reg-tomcat
ports:
- 8080:8080
- 8888:8888
- 9000:9000
- 8000:8000
restart: always
networks:
- main
environment:
JPDA_ADDRESS: 8000
JPDA_TRANSPORT: dt_socket
dbport: 5432
dbhost: host.docker.internal
dbname: registrydb
dbuser: name
dbpassword: password
statusbaseuri: http://host.docker.internal
solrurl: http://host.docker.internal:8983/solr/
smtphost: host.docker.internal
applicationrooturl: http://host.docker.internal/registry
rsspath: webapps/re3gistry2/WEB-INF/classes
diskcachepath: work/ehcache
apache:
image: httpd:2.4.53-alpine
container_name: reg-httpd
ports:
- 80:80
depends_on:
- db
- solr
- web
volumes:
customize-interface/example-profile-developer-docker/Re3gistry2ServiceWebapp/
- ./dist/customize-interface/example-profile-developer-docker/Re3gistry2ServiceWebapp/httpd.conf:/usr/local/apache2/conf/httpd.conf
- ./dist/webapp/public_html:/var/www/host.docker.internal/public_html
- ./dist/customize-interface/example-profile-developer-docker/Re3gistry2ServiceWebapp/httpd-vhosts.conf:/usr/local/apache2/conf/extra/httpd-vhosts.conf
restart: always
networks:
- main
solr:
image: solr:8.11.1
container_name: reg-solr
ports:
- "9983:9983"
- "8983:8983"
# volumes:
# - ../../../solr:/opt/solr/server/solr/re3gistry2
entrypoint:
- docker-entrypoint.sh
- solr-precreate
- re3gistry
mailserver:
image: marcopas/docker-mailslurper
container_name: mailserver
ports:
- 2500:2500
- 8081:8080 # http://172.17.0.1:8081/
- 8085:8085
networks:
main:
FROM tomcat:7.0.109-jdk8-adoptopenjdk-hotspot
MAINTAINER ec-jrc-re3gistry
RUN mkdir /usr/local/prep/
COPY ./dist/app/re3gistry2 /usr/local/prep/re3gistry2
COPY ./dist/app/re3gistry2restapi /usr/local/prep/re3gistry2restapi
WORKDIR /usr/local/prep/
COPY ./dist/app/re3gistry2/WEB-INF/shiro.ini.orig /usr/local/prep/re3gistry2/WEB-INF/shiro.ini
COPY ./dist/app/re3gistry2/WEB-INF/classes/configurations_files/configuration.properties.orig /usr/local/prep/re3gistry2/WEB-INF/classes/configurations_files/configuration.properties
COPY ./dist/app/re3gistry2/WEB-INF/classes/META-INF/persistence.xml.orig /usr/local/prep/re3gistry2/WEB-INF/classes/META-INF/persistence.xml
COPY ./dist/app/re3gistry2restapi/WEB-INF/classes/META-INF/persistence.xml.orig /usr/local/prep/re3gistry2restapi/WEB-INF/classes/META-INF/persistence.xml
COPY ./dist/app/re3gistry2restapi/WEB-INF/classes/configurations_files/configuration.properties.orig /usr/local/prep/re3gistry2restapi/WEB-INF/classes/configurations_files/configuration.properties
RUN pwd
WORKDIR /usr/local/prep/
COPY ./entrypoint.sh /usr/local/prep/entrypoint.sh
WORKDIR /usr/local/tomcat/
EXPOSE 8080
ENTRYPOINT ["/bin/sh", "/usr/local/prep/entrypoint.sh"]
#!/bin/bash
echo "Changes in re3gistry2/shiro.ini"
sed -i "s dbhost $dbhost g" "/usr/local/prep/re3gistry2/WEB-INF/shiro.ini"
sed -i "s dbname $dbname g" "/usr/local/prep/re3gistry2/WEB-INF/shiro.ini"
sed -i "s dbuser $dbuser g" "/usr/local/prep/re3gistry2/WEB-INF/shiro.ini"
sed -i "s dbpassword $dbpassword g" "/usr/local/prep/re3gistry2/WEB-INF/shiro.ini"
echo "Changes in re3gistry2/configuration.properties"
sed -i "s applicationrooturl $applicationrooturl g" "/usr/local/prep/re3gistry2/WEB-INF/classes/configurations_files/configuration.properties"
sed -i "s solrurl $solrurl g" "/usr/local/prep/re3gistry2/WEB-INF/classes/configurations_files/configuration.properties"
sed -i "s smtphost $smtphost g" "/usr/local/prep/re3gistry2/WEB-INF/classes/configurations_files/configuration.properties"
sed -i "s rsspath $rsspath g" "/usr/local/prep/re3gistry2/WEB-INF/classes/configurations_files/configuration.properties"
echo "Changes in re3gistry2/persistence.xml"
sed -i "s dbhost $dbhost g" "/usr/local/prep/re3gistry2/WEB-INF/classes/META-INF/persistence.xml"
sed -i "s dbport $dbport g" "/usr/local/prep/re3gistry2/WEB-INF/classes/META-INF/persistence.xml"
sed -i "s dbname $dbname g" "/usr/local/prep/re3gistry2/WEB-INF/classes/META-INF/persistence.xml"
sed -i "s dbpassword $dbpassword g" "/usr/local/prep/re3gistry2/WEB-INF/classes/META-INF/persistence.xml"
sed -i "s dbuser $dbuser g" "/usr/local/prep/re3gistry2/WEB-INF/classes/META-INF/persistence.xml"
echo "Changes in re3gistry2restapi/persistence.xml"
sed -i "s dbhost $dbhost g" "/usr/local/prep/re3gistry2restapi/WEB-INF/classes/META-INF/persistence.xml"
sed -i "s dbport $dbport g" "/usr/local/prep/re3gistry2restapi/WEB-INF/classes/META-INF/persistence.xml"
sed -i "s dbname $dbname g" "/usr/local/prep/re3gistry2restapi/WEB-INF/classes/META-INF/persistence.xml"
sed -i "s dbpassword $dbpassword g" "/usr/local/prep/re3gistry2restapi/WEB-INF/classes/META-INF/persistence.xml"
sed -i "s dbuser $dbuser g" "/usr/local/prep/re3gistry2restapi/WEB-INF/classes/META-INF/persistence.xml"
echo "Changes in re3gistry2restapi/configuration.properties"
sed -i "s diskcachepath $diskcachepath g" "/usr/local/prep/re3gistry2restapi/WEB-INF/classes/configurations_files/configuration.properties"
#mkdir /usr/local/tomcat/webapps/re3gistry2/
#mkdir /usr/local/tomcat/webapps/re3gistry2restapi/
mv /usr/local/prep/re3gistry2 /usr/local/tomcat/webapps/re3gistry2/
mv /usr/local/prep/re3gistry2restapi /usr/local/tomcat/webapps/re3gistry2restapi/
set -x
sleep 1
catalina.sh run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment