Skip to content

Commit

Permalink
Merge pull request #2 from citelibre/ft_keycloak_mariadb
Browse files Browse the repository at this point in the history
Merge Ft keycloak mariadb
  • Loading branch information
citelibre authored Apr 26, 2024
2 parents 1cc849f + 6835d2a commit a7db6d5
Show file tree
Hide file tree
Showing 139 changed files with 940 additions and 8,455 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,10 @@ jobs:
run: time curl -v https://dev.lutece.paris.fr/maven_repository/fr/paris/lutece/lutece-core/7.0.10/lutece-core-7.0.10-webapp.zip -o test.zip

- name: build war ihm
run: cd citelibre-rendezvous && mvn -e lutece:site-assembly -Pdev

- name: retrieve war name
run: echo "WAR_NAME=$(cd citelibre-rendezvous/target; ls *.war|sed -e 's/\.war//g')" >> $GITHUB_ENV
run: cd citelibre-rendezvous

- name: build rendezvous
run: docker build citelibre-rendezvous --build-arg site=$WAR_NAME -t citelibre/rendezvous:ihm-$VERSION
run: docker build citelibre-rendezvous -t citelibre/rendezvous:ihm-$VERSION

- name: build rendezvous
run: docker save -o citelibre-rendezvous.tar citelibre/rendezvous:ihm-$VERSION
Expand Down Expand Up @@ -93,6 +90,12 @@ jobs:

- name: build keycloak
run: docker build keycloak -t citelibre/rendezvous:keycloak-$VERSION

- name: build kibana
run: docker build kibana -t citelibre/rendezvous:kibana-$VERSION

- name: build elasticsearch
run: docker build elasticsearch -t citelibre/rendezvous:elasticsearch-$VERSION

- name: push images on docker hub
run: |
Expand All @@ -102,6 +105,8 @@ jobs:
docker push citelibre/rendezvous:fake-smtp-$VERSION
docker push citelibre/rendezvous:keycloak-$VERSION
docker push citelibre/rendezvous:ihm-$VERSION
docker push citelibre/rendezvous:kibana-$VERSION
docker push citelibre/rendezvous:elasticsearch-$VERSION
- name: update docker compose
run: |
Expand All @@ -111,6 +116,8 @@ jobs:
sed -i -e "s/:db.*$/:db-$VERSION/g" docker-compose.yml
sed -i -e "s/:ihm.*$/:ihm-$VERSION/g" docker-compose.yml
sed -i -e "s/:keycloak.*$/:keycloak-$VERSION/g" docker-compose.yml
sed -i -e "s/:kibana.*$/:kibana-$VERSION/g" docker-compose.yml
sed -i -e "s/:elasticsearch.*$/:elasticsearch-$VERSION/g" docker-compose.yml
cat docker-compose.yml
- name: Commit and push docker compose
Expand Down
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
VERSION=1.0.9

REPO=citelibre/rendezvous
REPO-TEST=test-rendezvous

build: ## Build the containers
docker build citelibre-rendezvous -t $(REPO):ihm
docker build citelibre-rendezvous -t $(REPO):ihm-$(VERSION)
Expand All @@ -12,6 +14,28 @@ build: ## Build the containers
docker build solr -t $(REPO):solr-$(VERSION)
docker build mysql -t $(REPO):db
docker build mysql -t $(REPO):db-$(VERSION)
docker build keycloak -t $(REPO):keycloak
docker build keycloak -t $(REPO):keycloak-$(VERSION)
docker build kibana -t $(REPO):kibana
docker build kibana -t $(REPO):kibana-$(VERSION)
docker build elasticsearch -t $(REPO):elasticsearch
docker build elasticsearch -t $(REPO):elasticsearch-$(VERSION)

test: ## Build the containers
docker build -t $(REPO-TEST)/ihm citelibre-rendezvous
docker build -t $(REPO-TEST)/fake-smtp fake-smtp
docker build -t $(REPO-TEST)/matomo matomo
docker build -t $(REPO-TEST)/solr solr
docker build -t $(REPO-TEST)/db mysql
docker build -t $(REPO-TEST)/keycloak keycloak
docker build -t $(REPO-TEST)/kibana kibana
docker build -t $(REPO-TEST)/elasticsearch elasticsearch
@echo REPO=$(REPO-TEST) > .env.test
docker-compose --env-file .env.test -f ./docker-compose-test.yml up -d

test-down:
docker-compose --env-file .env.test -f ./docker-compose-test.yml down
rm .env.test

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

Expand All @@ -22,6 +46,9 @@ publish-latest: ## Publish the `latest` tagged container
docker push $(REPO):ihm
docker push $(REPO):matomo
docker push $(REPO):fake-smtp
docker push $(REPO):keycloak
docker push $(REPO):kibana
docker push $(REPO):elasticsearch

publish-version: ## Publish the `{version}` tagged container t
@echo 'publish $(VERSION) to $(REPO)'
Expand All @@ -30,6 +57,9 @@ publish-version: ## Publish the `{version}` tagged container t
docker push $(REPO):ihm-$(VERSION)
docker push $(REPO):matomo-$(VERSION)
docker push $(REPO):fake-smtp-$(VERSION)
docker push $(REPO):keycloak-$(VERSION)
docker push $(REPO):kibana-$(VERSION)
docker push $(REPO):elasticsearch-$(VERSION)

repo-login:
docker login
15 changes: 13 additions & 2 deletions README-dev.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
![alt text](CiteLibre_500.png "Cite Libre")
![alt text](utils/Images/CiteLibre_500.png "Cite Libre")
# CiteLibre Rendezvous & Docker Compose

## Build and launch all containers

```
make test
```

Delete all apps containers :
```
make test-down
```

## Prepare your dump


Expand Down Expand Up @@ -85,7 +96,7 @@ Log into docker hub
docker login
```

After you can launch makefile task (you need to install make utility in outils directory) :
After you can launch makefile task (you need to install make utility in utils/outils directory) :

For building local containers

Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<p align="center">
<img src="https://github.com/citelibre/RendezVous/blob/main/CiteLibre.svg?raw=true" alt="CitéLibre logo"/>
<img src="./utils/CiteLibre.svg" alt="CitéLibre logo"/>
</p>


# CitéLibre RendezVous with docker-compose
## Architecture
Architecture with embedded database and stmp server

![CiteLibre architecture diagram](CiteLibre-rendezvous-docker.svg "CiteLibre architecture")
![CiteLibre architecture diagram](./utils/CiteLibre-rendezvous-docker.svg "CiteLibre architecture")

## Environment variables

Expand Down Expand Up @@ -154,6 +154,14 @@ or for demo you can use user demo : test@paris.fr / test1234=TEST1234

In matomo by default is displayed the day after today. Remember to change with the current date of the day if you want see the actual data

## Elasticsearch & Kibana

You can access to Kibana via http://localhost:5601

User: lutece

Password: RKOmBI1sWaa*SFm1gx*H

## External database
If you want to use an external database (only support mariabd or mysql for the moment),
create a database for lutece with the following command :
Expand Down
7 changes: 0 additions & 7 deletions citelibre-rendezvous/Docker-builder

This file was deleted.

86 changes: 43 additions & 43 deletions citelibre-rendezvous/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
FROM tomcat:9.0-jdk11

RUN apt update && apt install -y haproxy

ARG site=site-citelibre-rendezvous-1.0.9

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

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

COPY webapp/WEB-INF webapps/rendezvous/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"]





ARG site=site-citelibre-rendezvous-1.0.9

# build the site and assemble the webapp
FROM lutece/builder as builder

WORKDIR /app
ADD pom.xml /app/pom.xml
ADD src /app/src

RUN mvn -e lutece:site-assembly -Pdev
RUN cd target && mv $(ls *.war) ${site}.war

# built tomcat
FROM tomcat:9.0-jdk11

RUN apt update && apt install -y haproxy

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

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

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"]
6 changes: 3 additions & 3 deletions citelibre-rendezvous/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ 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"
echo "Enable haproxy on 8080"
haproxy -f /etc/haproxy/haproxy.cfg &
/wait && ${TOMCAT_START}
/wait && ${TOMCAT_START}
else
echo "Disable haproxy on 8081"
echo "Disable haproxy on 8080"
/wait && ${TOMCAT_START}
fi
2 changes: 1 addition & 1 deletion citelibre-rendezvous/haproxy.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ frontend auth
default_backend keycloak

backend keycloak
server server1 keycloak:8081
server server1 keycloak:8080
15 changes: 13 additions & 2 deletions citelibre-rendezvous/src/conf/dev/WEB-INF/conf/db.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@

################################################################################
# Drivers


#portal.poolservice is not a mandatory property
portal.poolservice=fr.paris.lutece.util.pool.service.TomcatConnectionService
portal.ds=jdbc/CORE
portal.poolservice=fr.paris.lutece.util.pool.service.LuteceConnectionService
portal.driver=com.mysql.cj.jdbc.Driver
portal.url=jdbc:mysql://db:3306/lutece?autoReconnect=true&useUnicode=yes&characterEncoding=utf8
portal.user=root
portal.password=root
portal.initconns=2
portal.maxconns=50
portal.logintimeout=2
portal.checkvalidconnectionsql=SELECT 1
# <pool>.dialect is an optional property to specify the dialect for JPA provider.
#portal.dialect=org.hibernate.dialect.MySQLDialect
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ lutece.prod.url=http://localhost:8080/rendezvous
lutece.admin.prod.url=http://localhost:8080/rendezvous

# To force The Base URL use the following entry
#lutece.base.url=http://127.0.0.1/lutece
lutece.base.url=http://localhost:8080/rendezvous

################################################################################
# Portal Lutece HTTPS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# URL du Web Service SuggestPOI
address-autocomplete.suggestPOI.ws.url = https://teleservices.paris.fr/StoreAdr/rest/PoiLib
# Types de POI recherchés par défaut
address-autocomplete.suggestPOI.param.types.default = ADR,VOIE,EQMT
# Identifiant quelconque de l'application cliente
address-autocomplete.suggestPOI.param.clientId = C80
address-autocomplete.suggestPOI.ws.datatype = jsonp
address-autocomplete.suggestPOI.ws.apiinput = STOREADR
## Localisation de POI recherchés par défaut
address-autocomplete.suggestPOI.param.storeadrfilter.default = poiauto
# Web Service SuggestPOI URL - Choose one of the following
# French government API - France Only - Use your own if needed
address-autocomplete.suggestPOI.ws.url = https://api-adresse.data.gouv.fr/search/
Loading

0 comments on commit a7db6d5

Please sign in to comment.