Skip to content

Commit

Permalink
OpenOlat dockerized
Browse files Browse the repository at this point in the history
  • Loading branch information
tilmanmoser committed Jan 30, 2023
1 parent 3afc0dc commit d79fec9
Show file tree
Hide file tree
Showing 49 changed files with 2,796 additions and 3 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# OpenOLAT dockerized

Dockerized OpenOLAT instance with postgresql, athena-pdf and custom theme & certifications

## Configuration
**.env**
```
# .env
OLAT_PORT=8088
OLAT_VERSION=1717
DB_HOST=db
DB_PORT=5432
DB_NAME=openolat
DB_USER=openolat
DB_PASS=openolat
```

**tomcat/openolat.local.properties**
*Refer to `tomcat/openolat.properties` for all options*
```
# tomcat/openolat.local.properties
db.source=jndi
db.jndi=java:comp/env/jdbc/openolatDS
db.vendor=postgresql
installation.dir=/opt/openolat
log.dir=/opt/openolat/logs
server.contextpath=/openolat
server.domainname=localhost
server.port=8088
server.port.ssl=0
smtp.host=disabled
tomcat.id=1
userdata.dir=/opt/openolat/olatdata
```

## Build
1. Download & extract OpenOlat `./getOlat.sh`
2. `docker compose pull && docker compose build`

## Run
1. `docker compose up -d`
2. Open http://localhost:8088
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ services:
image: tomcat:9-jdk11
restart: always
environment:
- CATALINA_OPTS=-Ddb.name=${DB_NAME} -Ddb.user=${DB_USER} -Ddb.pass=${DB_PASS} -Duser.timezone=Europe/Berlin -Dspring.profiles.active=myprofile -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=.
- CATALINA_OPTS=-Ddb.host=${DB_HOST} -Ddb.port=${DB_PORT} -Ddb.name=${DB_NAME} -Ddb.user=${DB_USER} -Ddb.pass=${DB_PASS} -Duser.timezone=Europe/Berlin -Dspring.profiles.active=myprofile -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=.
volumes:
- ./openolat/openolat_${OLAT_VERSION}:/opt/openolat/webapp
- ./themes/impavit:/opt/openolat/webapp/static/themes/impavit
- ./tomcat/server.xml:/usr/local/tomcat/conf/server.xml
- ./tomcat/context.xml:/usr/local/tomcat/conf/Catalina/localhost/ROOT.xml
- ./tomcat/olat.local.properties:/usr/local/tomcat/lib/olat.local.properties
Expand All @@ -30,7 +31,6 @@ services:
ports:
- 127.0.0.1:${OLAT_PORT}:8088


networks:
openolat:
driver: bridge
23 changes: 23 additions & 0 deletions themes/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ARG DART_VERSION=1.57.1
ARG OLAT_VERSION=17.1.7

FROM --platform=linux/amd64 debian:buster-slim as build
ARG DART_VERSION
ADD https://github.com/sass/dart-sass/releases/download/${DART_VERSION}/dart-sass-${DART_VERSION}-linux-x64.tar.gz /opt/
RUN tar -C /opt/ -xzvf /opt/dart-sass-${DART_VERSION}-linux-x64.tar.gz

FROM --platform=linux/amd64 debian:buster-slim as source
ARG OLAT_VERSION
ADD https://github.com/OpenOLAT/OpenOLAT/archive/refs/tags/OpenOLAT_${OLAT_VERSION}.tar.gz /opt/
RUN tar -C /opt/ -xzvf /opt/OpenOLAT_${OLAT_VERSION}.tar.gz
RUN mv /opt/OpenOLAT-OpenOLAT_${OLAT_VERSION} /opt/openolat

FROM --platform=linux/amd64 debian:buster-slim as runner
COPY --from=build /opt/dart-sass /opt/dart-sass
ENV PATH="$PATH:/opt/dart-sass"
COPY --from=source /opt/openolat /opt/openolat

WORKDIR /opt/openolat/src/main/webapp/static/themes

CMD ["./compiletheme.sh", "-f", "impavit"]

10 changes: 10 additions & 0 deletions themes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Theme Compilation

## Local
1. Install SASS (https://sass-lang.com)
2. Clone OpenOLAT Repository (`git clone https://github.com/OpenOLAT/OpenOLAT.git`)
3. Create new theme in src/main/webapp/static/themes as described in README.md in that folder (or copy impavit folder)
4. Run ./compiletheme.sh <foldername>

## Dockerized
1. `docker compose up --build`
7 changes: 7 additions & 0 deletions themes/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: '3'

services:
theme:
build: .
volumes:
- ./impavit:/opt/openolat/src/main/webapp/static/themes/impavit
21 changes: 21 additions & 0 deletions themes/impavit/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ARG DART_VERSION=1.57.1
ARG OLAT_VERSION=17.1.7

FROM debian:buster-slim as build
ARG DART_VERSION
ARG OLAT_VERSION
ADD https://github.com/sass/dart-sass/releases/download/${DART_VERSION}/dart-sass-${DART_VERSION}-linux-x64.tar.gz /opt/
RUN tar -C /opt/ -xzvf /opt/dart-sass-${DART_VERSION}-linux-x64.tar.gz

FROM debian:buster-slim as source
ADD https://github.com/OpenOLAT/OpenOLAT/archive/refs/tags/OpenOLAT_${OLAT_VERSION}.tar.gz /opt/
RUN tar -C /opt/ -xzvf /opt/OpenOLAT_${OLAT_VERSION}.tar.gz

FROM debian:buster-slim as runner
COPY --from=build /opt/dart-sass /opt/dart-sass
COPY --from=source /opt/OpenOLAT-OpenOLAT_${OLAT_VERSION} /opt/openolat
WORKDIR /opt/openolat/src/main/webapp/static/themes
COPY ./themes/* .

CMD ["./compiletheme.sh"]

80 changes: 80 additions & 0 deletions themes/impavit/_fonts.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
@charset "UTF-8";

@font-face {
font-family: 'OpenSans';
src: url('fonts/OpenSans/OpenSans-Light.ttf') format('truetype');
font-weight: 300;
font-style: normal;
}
@font-face {
font-family: 'OpenSans';
src: url('fonts/OpenSans/OpenSans-LightItalic.ttf') format('truetype');
font-weight: 300;
font-style: italic;
}

@font-face {
font-family: 'OpenSans';
src: url('fonts/OpenSans/OpenSans-Regular.ttf') format('truetype');
font-weight: 400;
font-style: normal;
}
@font-face {
font-family: 'OpenSans';
src: url('fonts/OpenSans/OpenSans-Italic.ttf') format('truetype');
font-weight: 400;
font-style: italic;
}

@font-face {
font-family: 'OpenSans';
src: url('fonts/OpenSans/OpenSans-Medium.ttf') format('truetype');
font-weight: 500;
font-style: normal;
}
@font-face {
font-family: 'OpenSans';
src: url('fonts/OpenSans/OpenSans-MediumItalic.ttf') format('truetype');
font-weight: 500;
font-style: italic;
}

@font-face {
font-family: 'OpenSans';
src: url('fonts/OpenSans/OpenSans-SemiBold.ttf') format('truetype');
font-weight: 600;
font-style: normal;
}

@font-face {
font-family: 'OpenSans';
src: url('fonts/OpenSans/OpenSans-SemiBoldItalic.ttf') format('truetype');
font-weight: 600;
font-style: italic;
}

@font-face {
font-family: 'OpenSans';
src: url('fonts/OpenSans/OpenSans-Bold.ttf') format('truetype');
font-weight: 700;
font-style: normal;
}
@font-face {
font-family: 'OpenSans';
src: url('fonts/OpenSans/OpenSans-BoldItalic.ttf') format('truetype');
font-weight: 700;
font-style: italic;
}

@font-face {
font-family: 'OpenSans';
src: url('fonts/OpenSans/OpenSans-ExtraBold.ttf') format('truetype');
font-weight: 800;
font-style: normal;
}
@font-face {
font-family: 'OpenSans';
src: url('fonts/OpenSans/OpenSans-ExtraBoldItalic.ttf') format('truetype');
font-weight: 800;
font-style: italic;
}
51 changes: 51 additions & 0 deletions themes/impavit/_impavit_config.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* IMPAVIT colors */
$i-brand-cerulean: #12a9de;
$i-brand-grey: rgb(166, 166, 166);
$i-brand-black: #333;
$i-brand-yellow: #DEAE28;
$i-brand-red: #DE5128;
$i-brand-green: #07DEA2;
$i-brand-pink: #DE2851;

/* General Colors */
$brand-primary: $i-brand-cerulean;
$brand-success: $i-brand-green;
$brand-info: $i-brand-grey;
$brand-warning: $i-brand-yellow;
$brand-danger: $i-brand-red;

$text-color: $i-brand-black;
$link-color: $i-brand-cerulean;
$link-hover-color: darken($link-color, 10%);
$o-content-link-color: $link-color;
$o-content-link-hover-color: $link-hover-color;
$o-content-link-decoration: underline;

$headings-color: $i-brand-cerulean;
$o-content-header-base-color: $headings-color;
$o-content-fieldset-legend-color: $headings-color;
$o-dialog-header-color: $headings-color;
$jumbotron-heading-color: $headings-color;
$o-login-header-color: $headings-color;
$o-coursesite-meta-title-color: $headings-color;

$o-bookmark-color: $i-brand-cerulean;
$o-button-dirty-color: $text-color;
$o-button-dirty-bg: $i-brand-yellow;

/* Login screen */
$o-login-form-align : left;
$o-login-form-bg-img : "images/login-bg.jpg";
$o-login-form-bg-gradient-steps : rgba(255, 255, 255, 0) 0.2%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.5) 100%;

$o-login-btn-register-color : $text-color;
$o-login-btn-register-bg : $i-brand-yellow;
$o-login-btn-register-border : $i-brand-yellow;

/* Course site start button */
$o-coursesite-start-bg : $i-brand-cerulean;
$o-coursesite-book-bg : $i-brand-cerulean;
$o-coursesite-details-bg : $i-brand-grey;

/* Font family */
$font-family-base : "OpenSans", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
3 changes: 3 additions & 0 deletions themes/impavit/_impavit_content.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/*
Add your custom content styles here to override styles from light/modules/*.
*/
3 changes: 3 additions & 0 deletions themes/impavit/_impavit_email.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/*
Add your custom content styles here to override styles from light/modules/*.
*/
Loading

0 comments on commit d79fec9

Please sign in to comment.