Skip to content

Commit

Permalink
Add images and containers
Browse files Browse the repository at this point in the history
  • Loading branch information
YXME committed Jan 25, 2024
1 parent 9bcbea3 commit 111ac5f
Show file tree
Hide file tree
Showing 603 changed files with 455,246 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
VERSION=1.0.0

REPO=citelibre/ident_ez
build: ## Build the containers
docker build ident_ez_citelibre -t $(REPO):ihm
docker build ident_ez_citelibre -t $(REPO):ihm-$(VERSION)
docker build ident_ez_fake-smtp -t $(REPO):fake-smtp
docker build ident_ez_fake-smtp -t $(REPO):fake-smtp-$(VERSION)
docker build ident_ez_matomo -t $(REPO):matomo
docker build ident_ez_matomo -t $(REPO):matomo-$(VERSION)
docker build ident_ez_solr -t $(REPO):solr
docker build ident_ez_solr -t $(REPO):solr-$(VERSION)
docker build ident_ez_mysql -t $(REPO):db
docker build ident_ez_mysql -t $(REPO):db-$(VERSION)

publish: repo-login publish-latest publish-version ## Publish the `{VERSION}` ans `latest` tagged containers

publish-latest: ## Publish the `latest` tagged container
@echo 'publish latest to $(REPO)'
docker push $(REPO):solr
docker push $(REPO):db
docker push $(REPO):ihm
docker push $(REPO):matomo
docker push $(REPO):fake-smtp

publish-version: ## Publish the `{version}` tagged container t
@echo 'publish $(VERSION) to $(REPO)'
docker push $(REPO):solr-$(VERSION)
docker push $(REPO):db-$(VERSION)
docker push $(REPO):ihm-$(VERSION)
docker push $(REPO):matomo-$(VERSION)
docker push $(REPO):fake-smtp-$(VERSION)

repo-login:
docker login
7 changes: 7 additions & 0 deletions citelibre-identEZ/Docker-builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM lutece/builder as builder
ARG site=site-citelibre-identEZ-1.0.9

# build the site and assemble the webapp
WORKDIR /app
ADD pom.xml /app/pom.xml
CMD ["mvn", "-e", "lutece:site-assembly","-Pdev"]
43 changes: 43 additions & 0 deletions citelibre-identEZ/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM tomcat:9.0-jdk11

RUN apt update && apt install -y haproxy

ARG site=site-citelibre-identEZ-1.0.0

ARG tomcat=/usr/local/tomcat
WORKDIR ${tomcat}
COPY target/${site}.war webapps
COPY haproxy.cfg /etc/haproxy/haproxy.cfg

RUN cd webapps && mkdir identEZ && mv ${site}.war identEZ/identEZ.war && cd identEZ && jar xvf identEZ.war && rm identEZ.war

COPY webapp/WEB-INF webapps/identEZ/WEB-INF/



COPY entrypoint.sh /entrypoint.sh

COPY wait /wait

RUN chmod +x /wait
RUN chmod +x /entrypoint.sh
RUN apt -y install haproxy
ENV LUTECE_DB_HOST=
ENV LUTECE_DB_PORT=
ENV LUTECE_DB_NAME=
ENV LUTECE_DB_USER=
ENV LUTECE_DB_PWD=
ENV LUTECE_MAIL_HOST=
ENV LUTECE_MAIL_PORT=
ENV LUTECE_MAIL_USER=
ENV LUTECE_MAIL_PWD=
ENV LUTECE_INTERNAL_KEYCLOAK=



ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]





76 changes: 76 additions & 0 deletions citelibre-identEZ/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash

tomcat=/usr/local/tomcat

# If the LUTECE_DB_HOST variable is set, then we use an external database
if [[ ! -z "$LUTECE_DB_HOST" && ! -z "$LUTECE_DB_USER" && ! -z "$LUTECE_DB_PWD" && ! -z "$LUTECE_DB_NAME" ]]
then
port="${LUTECE_DB_PORT:-3306}"
echo "Launch with external database"
sed -i "s/portal.user=.*/portal\.user=$LUTECE_DB_USER/" ${tomcat}/webapps/identEZ/WEB-INF/conf/db.properties
sed -i "s/portal.password=.*/portal\.password=$LUTECE_DB_PWD/" ${tomcat}/webapps/identEZ/WEB-INF/conf/db.properties
sed -i "s/\/lutece/\/$LUTECE_DB_NAME/" ${tomcat}/webapps/identEZ/WEB-INF/conf/db.properties
sed -i "s/db:3306/$LUTECE_DB_HOST:$port/" ${tomcat}/webapps/identEZ/WEB-INF/conf/db.properties
echo "configure database is "
cat ${tomcat}/webapps/identEZ/WEB-INF/conf/db.properties
fi

# SMTP
# Pb with new version => delete this file
rm ${tomcat}/webapps/identEZ/WEB-INF/conf/override/config.properties
if [[ -z "$LUTECE_MAIL_HOST" ]]
then
echo "Launch with internal SMTP"
sed -i "s/mail.server=.*/mail.server=fake-smtp/g" ${tomcat}/webapps/identEZ/WEB-INF/conf/config.properties
sed -i "s/mail.username=.*//" ${tomcat}/webapps/identEZ/WEB-INF/conf/config.properties
sed -i "s/mail.password=.*//" ${tomcat}/webapps/identEZ/WEB-INF/conf/config.properties
# report in html because after tomcatstarted it will be copied but the params i nconfig are load correctly
# so it's just for coordonate values
sed -i "s/mail.server=.*/mail.server=fake-smtp/g" ${tomcat}/webapps/identEZ/WEB-INF/templates/admin/system/config_properties.html
sed -i "s/mail.username=.*//" ${tomcat}/webapps/identEZ/WEB-INF/templates/admin/system/config_properties.html
sed -i "s/mail.password=.*//" ${tomcat}/webapps/identEZ/WEB-INF/templates/admin/system/config_properties.html

else
echo "Launch with external SMTP"
portMail="${LUTECE_MAIL_PORT:-25}"
sed -i "s/mail.server=.*/mail.server=$LUTECE_MAIL_HOST/" ${tomcat}/webapps/identEZ/WEB-INF/conf/config.properties
sed -i "s/mail.server.port=.*/mail.server.port=$portMail/" ${tomcat}/webapps/identEZ/WEB-INF/conf/config.properties

sed -i "s/mail.server=.*/mail.server=$LUTECE_MAIL_HOST/" ${tomcat}/webapps/identEZ/WEB-INF/templates/admin/system/config_properties.html
sed -i "s/mail.server.port=.*/mail.server.port=$portMail/" ${tomcat}/webapps/identEZ/WEB-INF/templates/admin/system/config_properties.html

if [[ ! -z "$LUTECE_MAIL_USER" ]]
then
sed -i "s/mail.username=.*//" ${tomcat}/webapps/identEZ/WEB-INF/conf/config.properties
sed -i "s/mail.password=.*//" ${tomcat}/webapps/identEZ/WEB-INF/conf/config.properties
sed -i "s/mail.username=.*//" ${tomcat}/webapps/identEZ/WEB-INF/templates/admin/system/config_properties.html
sed -i "s/mail.password=.*//" ${tomcat}/webapps/identEZ/WEB-INF/templates/admin/system/config_properties.html
sed -i "s/mail.username=.*/mail.username=$LUTECE_MAIL_USER/" ${tomcat}/webapps/identEZ/WEB-INF/conf/config.properties
sed -i "s/mail.password=.*/mail.password=$LUTECE_MAIL_PWD/" ${tomcat}/webapps/identEZ/WEB-INF/conf/config.properties
sed -i "s/mail.username=.*/mail.username=$LUTECE_MAIL_USER/" ${tomcat}/webapps/identEZ/WEB-INF/templates/admin/system/config_properties.html
sed -i "s/mail.password=.*/mail.password=$LUTECE_MAIL_PWD/" ${tomcat}/webapps/identEZ/WEB-INF/templates/admin/system/config_properties.html
fi
fi


if [[ ! -z "$LUTECE_DB_HOST" && ! -z "$LUTECE_DB_USER" && ! -z "$LUTECE_DB_PWD" && ! -z "$LUTECE_DB_NAME" ]]
then
export WAIT_HOSTS=$LUTECE_DB_HOST:${LUTECE_DB_PORT:-3306}
else
export WAIT_HOSTS=db:3306
fi

export WAIT_HOSTS_TIMEOUT=500
export WAIT_SLEEP_INTERVAL=30
export WAIT_HOST_CONNECT_TIMEOUT=30
TOMCAT_START="/opt/java/openjdk/bin/java -Djava.util.logging.config.file=${tomcat}/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -classpath ${tomcat}/bin/bootstrap.jar:${tomcat}/bin/tomcat-juli.jar -Dcatalina.base=${tomcat} -Dcatalina.home=${tomcat} -Djava.io.tmpdir=${tomcat}/temp org.apache.catalina.startup.Bootstrap start"

if [[ "$LUTECE_INTERNAL_KEYCLOAK" == "true" ]]
then
echo "Enable haproxy on 8081"
haproxy -f /etc/haproxy/haproxy.cfg &
/wait && ${TOMCAT_START}
else
echo "Disable haproxy on 8081"
/wait && ${TOMCAT_START}
fi
13 changes: 13 additions & 0 deletions citelibre-identEZ/haproxy.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
defaults
mode http
timeout client 10s
timeout connect 5s
timeout server 10s
timeout http-request 10s

frontend auth
bind 0.0.0.0:8081
default_backend keycloak

backend keycloak
server server1 keycloak:8081
Loading

0 comments on commit 111ac5f

Please sign in to comment.