Skip to content

Commit

Permalink
Update CAS build process
Browse files Browse the repository at this point in the history
  • Loading branch information
hmiguim committed Sep 8, 2023
1 parent a85d721 commit 09848a7
Show file tree
Hide file tree
Showing 21 changed files with 336 additions and 385 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@

Docker deployment of the [DBPTK User Interface](https://github.com/keeps/dbptk-ui) as a Web application.

### Deploy
## Deploy

We suggest you use docker on Linux. Docker on Windows will require you to edit the docker-compose.yaml and transform all config path to Windows path style.

This deployment comes with CAS configured. For more information consult the [README](deploys/development/README.md).

Pre-requisites:

1. Install [docker](https://docs.docker.com/install/)
2. Install [docker compose](https://docs.docker.com/compose/install/)
3. Download and unzip this [project](https://github.com/keeps/dbptk-enterprise/archive/master.zip)
4. For more information about CAS configuration see [README](deploys/development/README.md)
4. For more information about CAS configuration see [README](deploys/development/README.md#cas)
5. Open a terminal within `deploys/development` folder
6. Run `docker-compose up`
7. Application should be available at [http://localhost:8080](http://localhost:8080)

### To add more databases to DBPTK Enterprise via REST API

1. Update dbvtk-viewer.properties file and set *manage.upload.basePath* property with a path to the SIARD folder (reload the docker-compose to apply the changes)
2. Replace the `<siardFilename>` with the name of the SIARD then run: ``curl -X POST "http://localhost:8080/api/v1/database" -H "accept: text/plain" -H "Content-Type: application/json" -d "<siardFilename>"``

Expand All @@ -41,7 +44,6 @@ Run `docker-compose up -d` at deploys/development folder.

Run `docker-compose down` at deploys/development folder.


## More information

Configuration options are detailed in the [DBPTK UI Wiki](https://github.com/keeps/dbptk-ui/wiki).
Expand Down
6 changes: 3 additions & 3 deletions deploys/development/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# CAS

### Configure available users
## Configure available users

On `cas/` directory there are two files:

* users.txt - one user per line with the following syntax: `<username>::<password>`
* attribute-repository.json - a JSON file with a set of attributes per user

#### Pratical example
## Practical example

Let's add a new user to CAS that belongs to the administrators with username "test". To do so we need to edit the `users.txt` file and add the following line:

Expand Down Expand Up @@ -38,4 +38,4 @@ $ docker-compose up -d

# if not hit CTRL+C and start the service again
$ docker-compose up
```
```
39 changes: 13 additions & 26 deletions deploys/development/cas/cas.properties
Original file line number Diff line number Diff line change
@@ -1,38 +1,25 @@
#### DO NOT CHANGE ANY PROPERTY, UNLESS YOU KNOW WHAT YOU ARE DOING ####

server.servlet.context-path=/cas

server.port=8443

cas.server.tomcat.http.port=8080
cas.server.tomcat.http.protocol=org.apache.coyote.http11.Http11NioProtocol
cas.server.tomcat.http.enabled=true
cas.server.tomcat.http.attributes.attribute-name=attributeValue

#logging.level.org.apereo.cas=DEBUG
cas.server.name=http://localhost:8080
cas.server.prefix=http://localhost:8080/cas

server.ssl.keyStore=file:/etc/cas/thekeystore
server.ssl.keyStorePassword=changeit
server.ssl.keyPassword=changeit

server.max-http-header-size=2097152
#server.useForwardHeaders=true

cas.server.name=http://localhost:8080
cas.server.prefix=http://localhost:8080/cas
cas.service-registry.json.location=file:///etc/cas/services

cas.authn.accept.users=
cas.authn.file.separator=::
cas.authn.file.filename=file:///etc/cas/config/users.txt
cas.authn.file.name=

cas.authn.attribute-repository.json[0].location=file:/etc/cas/attribute-repository.json
cas.authn.attribute-repository.json[0].location=file:///etc/cas/attribute-repository.json
cas.authn.attribute-repository.json[0].order=0
cas.authn.attribute-repository.json[0].id=MyJson

cas.service-registry.json.location=file:/etc/cas/config/services
cas.authn.file.password-encoder.encoding-algorithm=
cas.authn.file.password-encoder.type=NONE
cas.authn.file.separator=::
cas.authn.file.filename=file:///etc/cas/users.txt

cas.server.tomcat.http[0].port=8080
cas.server.tomcat.http[0].protocol=org.apache.coyote.http11.Http11NioProtocol
cas.server.tomcat.http[0].enabled=true

cas.logout.followServiceRedirects=true
cas.logout.redirectParameter=service
cas.logout.confirmLogout=true
cas.slo.disabled=false
cas.logout.follow-service-redirects=true
13 changes: 8 additions & 5 deletions deploys/development/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: "3.2"
services:
dbptke:
image: keeps/dbvtk:latest
container_name: dbptk-enterprise
networks:
- zoonet
ports:
Expand All @@ -23,15 +24,17 @@ services:
- solr
entrypoint: java -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar /app.war
solr:
image: solr:8.4
image: solr:8
container_name: solr
networks:
- zoonet
ports:
- 8983:8983
command: -c # Use cloud mode
cas:
image: cas:latest
build:
image: docker.io/library/cas:latest
container_name: cas
build:
context: ./image/cas
networks:
- zoonet
Expand All @@ -40,8 +43,8 @@ services:
volumes:
- ./thekeystore:/etc/cas/thekeystore
- ./cas/attribute-repository.json:/etc/cas/attribute-repository.json
- ./cas/users.txt:/etc/cas/config/users.txt
- ./cas/services:/etc/cas/config/services
- ./cas/users.txt:/etc/cas/users.txt
- ./cas/services:/etc/cas/services
- ./cas/cas.properties:/etc/cas/config/cas.properties

networks:
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

36 changes: 21 additions & 15 deletions deploys/development/image/cas/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
FROM adoptopenjdk/openjdk11:alpine-slim AS overlay
ARG BASE_IMAGE="eclipse-temurin:11-jdk"
ARG EXT_BUILD_COMMANDS=""
ARG EXT_BUILD_OPTIONS=""

FROM eclipse-temurin:11-jdk-alpine AS overlay

RUN apk add --no-cache git \
&& mkdir -p /tmp/cas-overlay \
&& git clone -b 6.5 --single-branch https://github.com/apereo/cas-overlay-template.git /tmp/cas-overlay
&& mkdir -p /tmp/cas-overlay \
&& git clone -b 6.6 --single-branch https://github.com/apereo/cas-overlay-template.git /tmp/cas-overlay

RUN mkdir -p cas-overlay
RUN cp -r /tmp/cas-overlay/src cas-overlay/src/
RUN cp -r /tmp/cas-overlay/gradle/ cas-overlay/gradle/

RUN cp -r /tmp/cas-overlay/src/ /cas-overlay/src/ \
&& cp -r /tmp/cas-overlay/gradle/ /cas-overlay/gradle/ \
&& cp -r /tmp/cas-overlay/gradlew /tmp/cas-overlay/settings.gradle /tmp/cas-overlay/build.gradle /tmp/cas-overlay/gradle.properties /cas-overlay/
RUN cp -r /tmp/cas-overlay/gradlew /cas-overlay/
RUN cp -r /tmp/cas-overlay/settings.gradle /cas-overlay/
RUN cp -r /tmp/cas-overlay/build.gradle /cas-overlay/
RUN cp -r /tmp/cas-overlay/gradle.properties /cas-overlay/
RUN cp -r /tmp/cas-overlay/lombok.config /cas-overlay/

RUN rm -rf /tmp/cas-overlay

Expand All @@ -19,29 +27,27 @@ RUN mkdir -p ~/.gradle \
&& chmod 750 ./gradlew \
&& ./gradlew --version;

COPY ./build/build.gradle /cas-overlay/
COPY ./build.gradle /cas-overlay/

RUN cd cas-overlay \
&& ./gradlew clean build --parallel --no-daemon \
&& ./gradlew createKeystore

&& ./gradlew clean build $EXT_BUILD_COMMANDS --parallel --no-daemon $EXT_BUILD_OPTIONS;

FROM adoptopenjdk/openjdk11:alpine-jre AS cas
FROM $BASE_IMAGE AS cas

LABEL "Organization"="Apereo"
LABEL "Description"="Apereo CAS"

RUN cd / \
&& mkdir -p /etc/cas/config \
&& mkdir -p /etc/cas/services \
&& mkdir -p /etc/cas/saml \
&& mkdir -p cas-overlay;

COPY --from=overlay cas-overlay/build/libs/cas.war cas-overlay/
COPY --from=overlay etc/cas/thekeystore /etc/cas/thekeystore
COPY ./etc/cas/ /etc/cas/

EXPOSE 8080 8443

ENV PATH $PATH:$JAVA_HOME/bin:.

WORKDIR /cas-overlay
ENTRYPOINT ["java", "-server", "-noverify", "-Xmx2048M", "-jar", "cas.war"]
WORKDIR cas-overlay
ENTRYPOINT ["java", "-server", "-noverify", "-Xmx2048M", "-jar", "cas.war"]
Loading

0 comments on commit 09848a7

Please sign in to comment.