diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 000000000000..b5c9db146c5b --- /dev/null +++ b/docker/README.md @@ -0,0 +1,38 @@ +# Sakai Docker Deployment Examples + +A collection of tools and examples to demonstrate developing, building and deploying Sakai using Docker Swarm. + +### Features +Features of the files you will find here: + +* Development stack examples +* Docker image building examples +* Docker Swarm deployment examples + +# Quick install Docker (Linux, new server/workstation) +Docker provides an installation script for most Linux distributions, With Ubuntu and RHEL/CentOS being the most used. +This script is located at https://get.docker.com/ and has the following instructions at the top of the file: + + This script is meant for quick & easy install via: + $ curl -fsSL https://get.docker.com -o get-docker.sh + $ sh get-docker.sh + +This will install and prepare everything needed to build images and run them in standalone mode. +Additionally, docker has a built-in container orchestration platform called "Docker Swarm". Swarm needs to be enabled to use any of the deployment example scripts in `deploy/`, this can be enabled by simply running: + + $ docker swarm init + +# Development +In the `dev/` folder you will find an example staged Swarm stack that included everything needed to build and test sakai in development. + +GOTO [Development README](dev/) + +# Building +In the `build/` folder you will find examples for building a docker image for Sakai. Before deployment, you need to build the docker image you will deploy, examples are provided for building from source or a binary release. + +GOTO [Building README](build/) + +# Deployment +Deploying Sakai in Docker Swarm is easy, even with a full stack of supporting services. + +GOTO [Deployment README](deploy/) diff --git a/docker/build/Dockerfile.binary b/docker/build/Dockerfile.binary new file mode 100644 index 000000000000..18075d5c2f90 --- /dev/null +++ b/docker/build/Dockerfile.binary @@ -0,0 +1,29 @@ +FROM tomcat:9.0.20-jre8 + +ARG release=19.1 + +COPY lib/server.xml /usr/local/tomcat/conf/server.xml +COPY lib/context.xml /usr/local/tomcat/conf/context.xml +COPY lib/entrypoint.sh /entrypoint.sh + +RUN mkdir /sakaibin && cd /sakaibin && wget http://source.sakaiproject.org/release/${release}/artifacts/sakai-bin-${release}.tar.gz && tar -zxvf sakai-bin-${release}.tar.gz && rm -fr /usr/local/tomcat/components && rm -fr /usr/local/tomcat/sakai-lib && rm -fr /usr/local/tomcat/webapps && cp -R /sakaibin/components /usr/local/tomcat/components/ && cp -R /sakaibin/lib /usr/local/tomcat/sakai-lib/ && cp -R /sakaibin/webapps /usr/local/tomcat/webapps/ && cd / && rm -fr /sakaibin && mkdir -p /usr/local/sakai/properties && sed -i '/^common.loader\=/ s/$/,"\$\{catalina.base\}\/sakai-lib\/*.jar"/' /usr/local/tomcat/conf/catalina.properties && curl -L -o /usr/local/tomcat/lib/mysql-connector-java-5.1.47.jar https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar && mkdir -p /usr/local/tomcat/sakai && chmod +x /entrypoint.sh + +ENV CATALINA_OPTS_MEMORY -Xms2000m -Xmx2000m +ENV CATALINA_OPTS \ +-server \ +-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseConcMarkSweepGC -XX:+UseParNewGC \ +-XX:+CMSParallelRemarkEnabled -XX:+UseCompressedOops -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=80 -XX:TargetSurvivorRatio=90 \ +-Djava.awt.headless=true \ +-Dsun.net.inetaddr.ttl=0 \ +-Dsakai.component.shutdownonerror=true \ +-Duser.language=en -Duser.country=US \ +-Dsakai.home=/usr/local/sakai/properties -Dsakai.security=/usr/local/tomcat/sakai \ +-Duser.timezone=US/Eastern \ +-Dsun.net.client.defaultConnectTimeout=300000 \ +-Dsun.net.client.defaultReadTimeout=1800000 \ +-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false \ +-Dsun.lang.ClassLoader.allowArraySyntax=true \ +-Dhttp.agent=Sakai \ +-Djava.util.Arrays.useLegacyMergeSort=true + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker/build/Dockerfile.source b/docker/build/Dockerfile.source new file mode 100644 index 000000000000..f82bd13830fa --- /dev/null +++ b/docker/build/Dockerfile.source @@ -0,0 +1,49 @@ +FROM maven:3.6.1-jdk-8 as build + +ARG release=master + +COPY lib/settings.xml /usr/share/maven/conf/settings.xml +RUN mkdir /deploy +WORKDIR /deploy +RUN git clone https://github.com/sakaiproject/sakai.git +WORKDIR /deploy/sakai +RUN git checkout ${release} && mvn clean install sakai:deploy -Dmaven.test.skip=true + + +FROM tomcat:9.0.20-jre8 + +COPY lib/server.xml /usr/local/tomcat/conf/server.xml +COPY lib/context.xml /usr/local/tomcat/conf/context.xml +COPY --from=build /deploy/components /usr/local/tomcat/components/ +COPY --from=build /deploy/lib /usr/local/tomcat/sakai-lib/ +COPY --from=build /deploy/webapps /usr/local/tomcat/webapps/ + +RUN mkdir -p /usr/local/sakai/properties + +ENV CATALINA_OPTS_MEMORY -Xms2000m -Xmx2000m +ENV CATALINA_OPTS \ +-server \ +-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseConcMarkSweepGC -XX:+UseParNewGC \ +-XX:+CMSParallelRemarkEnabled -XX:+UseCompressedOops -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=80 -XX:TargetSurvivorRatio=90 \ +-Djava.awt.headless=true \ +-Dsun.net.inetaddr.ttl=0 \ +-Dsakai.component.shutdownonerror=true \ +-Duser.language=en -Duser.country=US \ +-Dsakai.home=/usr/local/sakai/properties -Dsakai.security=/usr/local/tomcat/sakai \ +-Duser.timezone=US/Eastern \ +-Dsun.net.client.defaultConnectTimeout=300000 \ +-Dsun.net.client.defaultReadTimeout=1800000 \ +-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false \ +-Dsun.lang.ClassLoader.allowArraySyntax=true \ +-Dhttp.agent=Sakai \ +-Djava.util.Arrays.useLegacyMergeSort=true + +RUN sed -i '/^common.loader\=/ s/$/,"\$\{catalina.base\}\/sakai-lib\/*.jar"/' /usr/local/tomcat/conf/catalina.properties + +RUN curl -L -o /usr/local/tomcat/lib/mysql-connector-java-5.1.47.jar https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar + +RUN mkdir -p /usr/local/tomcat/sakai +COPY lib/entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] + diff --git a/docker/build/README.md b/docker/build/README.md new file mode 100644 index 000000000000..0635685bd155 --- /dev/null +++ b/docker/build/README.md @@ -0,0 +1,54 @@ +# Sakai Docker Deployment Examples + +A collection of tools and examples to demonstrate building and deploying Sakai using Docker and/or Docker Swarm. + +### Features +Features of the files you will find here: + +* Multiple build types: + * From source + * From binary release. + * Automated via DockerHub + +#### Table of Contents +- [Quick install Docker (Linux, new server/workstation)](#quick-install-docker--linux--new-server-workstation-) +- [Building the Image](#building-the-image) + * [From a binary release](#from-a-binary-release) + * [From source (github tag/branch)](#from-source--github-tag-branch-) + + +# Quick install Docker (Linux, new server/workstation) +Docker provides an installation script for most Linux distributions, With Ubuntu and RHEL/CentOS being the most used. +This script is located at https://get.docker.com/ and has the following instructions at the top of the file: + + This script is meant for quick & easy install via: + $ curl -fsSL https://get.docker.com -o get-docker.sh + $ sh get-docker.sh + +# Building the Image +There are two variants of this docker build, depending on your preference to build from source code or from a binary release. As well there is an example automated build to be used with docker hub. + +## From a binary release +To build from a binary release use these steps: + 1. From this folder + 1. Execute `docker build --build-arg release=19.1 -t sakai -f ./Dockerfile.binary .` substituting "19.1" for the release you wish to build + 1. Upon completion you can execute `docker image ls sakai` to verify it's creation + * $ docker image ls sakai + REPOSITORY TAG IMAGE ID CREATED SIZE + sakai latest 369fde564591 5 seconds ago 2.55GB + +## From source (github tag/branch) +The source build uses a multi-stage build, building an intermediate image with JDK and Maven in which to build Sakai, then building a Tomcat image using only the binary artifacts from the build container. This creates a smaller Sakai image that does not include Maven and all the build time libraries, source, etc. + +To build from source use these steps: + 1. From this folder + 1. Execute `docker build --build-arg release=master -t sakai -f ./Dockerfile.source .` substituting "master" for the branch/tag you wish to build + 1. Upon completion you can execute `docker image ls sakai` to verify it's creation + * $ docker image ls sakai + REPOSITORY TAG IMAGE ID CREATED SIZE + sakai latest 78b32fe87fda 8 seconds ago 2.55GB + +## Automated from DockerHub +The Dockerfiles here are configured to work with the build hook in the hooks folder. + +See https://docs.docker.com/docker-hub/builds/ for detailed information on setting up automated builds diff --git a/docker/build/hooks/build b/docker/build/hooks/build new file mode 100644 index 000000000000..596e36510659 --- /dev/null +++ b/docker/build/hooks/build @@ -0,0 +1,3 @@ +#!/bin/bash +RELEASE=$(echo $DOCKER_TAG | sed s/release-//g) +docker build --build-arg release=$RELEASE -f $DOCKERFILE_PATH -t $IMAGE_NAME . diff --git a/docker/build/lib/context.xml b/docker/build/lib/context.xml new file mode 100644 index 000000000000..62dd582d4f0b --- /dev/null +++ b/docker/build/lib/context.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/docker/build/lib/entrypoint.sh b/docker/build/lib/entrypoint.sh new file mode 100644 index 000000000000..4e44e7476be3 --- /dev/null +++ b/docker/build/lib/entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Append any secret properties from /run/secrets/security.properties +cat /run/secrets/security.properties >> /usr/local/tomcat/sakai/security.properties + +# Start tomcat +catalina.sh run diff --git a/docker/build/lib/server.xml b/docker/build/lib/server.xml new file mode 100644 index 000000000000..6c6038528113 --- /dev/null +++ b/docker/build/lib/server.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/docker/build/lib/settings.xml b/docker/build/lib/settings.xml new file mode 100644 index 000000000000..e17806723b00 --- /dev/null +++ b/docker/build/lib/settings.xml @@ -0,0 +1,21 @@ + + + + tomcat + + true + + + tomcat + /deploy + /deploy + /deploy + plain + false + + + + diff --git a/docker/deploy/README.md b/docker/deploy/README.md new file mode 100644 index 000000000000..08bdc5ec3f55 --- /dev/null +++ b/docker/deploy/README.md @@ -0,0 +1,112 @@ +# Sakai Docker Deployment Examples + +A collection of tools and examples to demonstrate building and deploying Sakai using Docker and/or Docker Swarm. + +### Features +Features of the files you will find here: + +* Example Swarm stacks + * Sakai + Mysql + * Sakai + Mysql + Elasticsearch + Cerebro + Mailcatcher + +#### Table of Contents +- [Quick install Docker (Linux, new server/workstation)](#quick-install-docker--linux--new-server-workstation-) +- [Running Sakai](#running-sakai) + * [Swarm enabled Docker](#swarm-enabled-docker) + + [Sakai+Mysql](#sakai-mysql) + + [Sakai+Mysql+Elasticsearch+Mailcatcher](#sakai-mysql-elasticsearch-mailcatcher) + + [Monitoring Examples](#monitoring-examples) + + [Management Examples](#management-examples) + * [Standalone Docker](#standalone-docker) + + [Monitoring Examples](#monitoring-examples-1) + + [Management Examples](#management-examples-1) + + +# Quick install Docker (Linux, new server/workstation) +Docker provides an installation script for most Linux distributions, With Ubuntu and RHEL/CentOS being the most used. +This script is located at https://get.docker.com/ and has the following instructions at the top of the file: + + This script is meant for quick & easy install via: + $ curl -fsSL https://get.docker.com -o get-docker.sh + $ sh get-docker.sh + +This will install and prepare everything needed to build images and run them in standalone mode. +Additionally, docker has a built-in container orchestration platform called "Docker Swarm". Swarm needs to be enabled to use any of these deployment example scripts, this can be enabled by simply running: + + $ docker swarm init + +# Running Sakai +You will need to provide at a minimum a `sakai.properties` configuration containing a minimal database configuration. In the examples here, a MySQL configuration is provided. + +## Swarm enabled Docker +These are basic examples, that do not include mounting storage volumes to persist data. + +### Sakai+Mysql +To start the example Sakai and Mysql stack follow these steps: + 1. From this folder. + 1. Execute `docker stack deploy -c sakai_docker.yml sakai` + * This creates a stack named `sakai` using the compose file `sakai_docker.yml` + * Services in the stack are named \_\ (e.g. sakai_mysql and sakai_sakai) + * The configuration file `conf/sakai.properties` is mounted inside the container in /usr/local/sakai/properties + * Sakai will be located at `http://:8080/portal` + +### Sakai+Mysql+Elasticsearch+Cerebro+Mailcatcher +To start the example Sakai, Mysql, Elasticsearch, Cerebro, and Mailcatcher stack follow these steps: + 1. From this folder. + 1. Execute `docker stack deploy -c sakai_es_docker.yml sakai` + * This creates a stack named `sakai` using the compose file `sakai_es_docker.yml` + * Services in the stack are named \_\ (e.g. sakai_mysql and sakai_sakai) + * The configuration file `conf/sakai.properties` is mounted inside the container in /usr/local/sakai/properties + * The secrets file `secrets/security.properties` is deployed using Docker Secrets and placed in /usr/local/tomcat/sakai/ + * Sakai will be located at `http://:8080/portal` + * Mailcatcher will be located at `http://:8081/` + * Cerebro (Elasticsearch Management) will be located at `http://:8082/` + * Use ES Node address: `http://elasticsearch:9200/` + + +### Monitoring Examples +Now that the stack has started you can monitor with the Swarm commands: + 1. List running stacks with `docker stack ls` + 1. List services running in the sakai stack with `docker stack services sakai` + 1. List containers running in the sakai service with `docker service ps sakai_sakai` + 1. View (tail) the logs from the Sakai container with `docker service logs -f sakai_sakai` + +### Management Examples +You can manage using Swarm commands: + 1. Restart the sakai service with `docker service update --force sakai_sakai` + 1. Stop and remove the stack with `docker stack rm sakai` + +## Standalone Docker +In this example you will start a standalone MySQL container and a linked standalone sakai container. + 1. From this folder. + 1. Start a MySQL 5.5 container with: + * docker run -d \ + --name mysql \ + -e MYSQL_ROOT_PASSWORD=examplerootpassword \ + -e MYSQL_DATABASE=sakai -e MYSQL_USER=sakai \ + -e MYSQL_PASSWORD=examplepassword \ + mysql:5.5 \ + --character-set-server=utf8 \ + --collation-server=utf8_general_ci + 1. Monitor MySQL startup with `docker logs -f mysql` and hit Ctrl-C once MySQL has finished starting. + 1. Start a Sakai Container with the MySQL container linked to it: + * docker run -d \ + --name sakai \ + -p 8080:8080 \ + -v $(pwd)/config/sakai.properties:/usr/local/sakai/properties/sakai.properties \ + --link mysql:mysql \ + sakai + 1. Monitor Sakai startup with `docker logs -f sakai` and hit Ctrl-C once Sakai has finished starting. + 1. Sakai should be available on port 8080 of the Dockerhost. + +### Monitoring Examples +You may need to monitor the containers + 1. View logs of the sakai container with `docker logs -f sakai` + 1. Inspect the sakai container configuration with `docker inspect sakai` + +### Management Examples +You may need to manage the containers + 1. Stop the running sakai container with `docker kill sakai` + 2. Remove the sakai container with `docker rm sakai` + + diff --git a/docker/deploy/config/demopage.tgz b/docker/deploy/config/demopage.tgz new file mode 100644 index 000000000000..2f1fc690733a Binary files /dev/null and b/docker/deploy/config/demopage.tgz differ diff --git a/docker/deploy/config/elasticsearch.yml b/docker/deploy/config/elasticsearch.yml new file mode 100644 index 000000000000..18cc2fe12588 --- /dev/null +++ b/docker/deploy/config/elasticsearch.yml @@ -0,0 +1,14 @@ +# cluster name +cluster.name: sakai_cluster + +# Prevent memory swapping +bootstrap.memory_lock: true + +# Connect to sakai nodes using DNS discovery +discovery.zen.ping.unicast.hosts: tasks.sakai:9300 + +# Require 2 master Names +discovery.zen.minimum_master_nodes: 2 + +# This is a master node +node.master: true diff --git a/docker/deploy/config/es_entry.sh b/docker/deploy/config/es_entry.sh new file mode 100644 index 000000000000..a5e9d426beaa --- /dev/null +++ b/docker/deploy/config/es_entry.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Find the correct interface for elasticsearch using the subnet defined in the compose file +ES_INT=$(ip addr | grep 10.99.99 | cut -d " " -f 11) + +# Log the interface found +echo "Using interface $ES_INT for elasticsearch" + +# Create the updated Sakai configuration +sed s/#interface#/\_$ES_INT:ipv4\_/g /usr/local/sakai/es.properties > /usr/local/sakai/properties/sakai.properties + +rm -fr /usr/local/tomcat/webapps/ROOT +mkdir /usr/local/tomcat/webapps/ROOT +cd /usr/local/tomcat/webapps/ROOT +tar zxvf /demopage.tgz + +# Execute the real entrypoint script +/entrypoint.sh diff --git a/docker/deploy/config/sakai.es.properties b/docker/deploy/config/sakai.es.properties new file mode 100644 index 000000000000..927d10fcebe4 --- /dev/null +++ b/docker/deploy/config/sakai.es.properties @@ -0,0 +1,36 @@ +# Configuration for the example database +#### +vendor@org.sakaiproject.db.api.SqlService=mysql +driverClassName@javax.sql.BaseDataSource=com.mysql.jdbc.Driver +hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect +url@javax.sql.BaseDataSource=jdbc:mysql://mysql:3306/sakai?useUnicode=true&characterEncoding=UTF-8 +validationQuery@javax.sql.BaseDataSource=select 1 from DUAL +defaultTransactionIsolationString@javax.sql.BaseDataSource=TRANSACTION_READ_COMMITTED + + +# Configuration for Mailcatcher +#### +smtp@org.sakaiproject.email.api.EmailService=tasks.mailcatcher +smtpPort@org.sakaiproject.email.api.EmailService=1025 + +# Configuration for search, connecting to the external service as a member node +# using a placeholder for the network.host to be populated at runtime by +# the entrypoint script. +#### +search.enable=true +search.indexbuild=true +searchServer@org.sakaiproject.search.api.SearchService=true +excludeUserSites@org.sakaiproject.search.api.SearchService=false +onlyIndexSearchToolSites@org.sakaiproject.search.api.SearchIndexBuilder=false +elasticsearch.index.number_of_shards=1 +elasticsearch.index.number_of_replicas=0 +elasticsearch.discovery.zen.ping.multicast.enabled=false +elasticsearch.discovery.zen.minimum_master_nodes=2 +elasticsearch.cluster.name: sakai_cluster +elasticsearch.node.master: true +elasticsearch.network.host: #interface# +elasticsearch.transport.tcp.port=9300 +elasticsearch.discovery.zen.ping.unicast.hosts=tasks.elasticsearch:9300 +search.indexNamespace=sakai_search_index + + diff --git a/docker/deploy/config/sakai.properties b/docker/deploy/config/sakai.properties new file mode 100644 index 000000000000..0d349a806a8a --- /dev/null +++ b/docker/deploy/config/sakai.properties @@ -0,0 +1,13 @@ +#Example configuration provided to the swarm service via the configs module of docker. + +## MySQL settings +vendor@org.sakaiproject.db.api.SqlService=mysql +driverClassName@javax.sql.BaseDataSource=com.mysql.jdbc.Driver +hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect +url@javax.sql.BaseDataSource=jdbc:mysql://mysql:3306/sakai?useUnicode=true&characterEncoding=UTF-8 +validationQuery@javax.sql.BaseDataSource=select 1 from DUAL +defaultTransactionIsolationString@javax.sql.BaseDataSource=TRANSACTION_READ_COMMITTED + +## Rubrics +rubrics.integration.token-secret=12345678900909091234 + diff --git a/docker/deploy/sakai_docker.yml b/docker/deploy/sakai_docker.yml new file mode 100644 index 000000000000..7f26a7a8b868 --- /dev/null +++ b/docker/deploy/sakai_docker.yml @@ -0,0 +1,28 @@ +version: '3.6' +services: + sakai: + image: sakai + ports: + - "8080:8080" + configs: + - source: sakai_config + target: /usr/local/sakai/properties/sakai.properties + secrets: + - security.properties + + mysql: + image: mysql:5.5 + command: --character-set-server=utf8 --collation-server=utf8_general_ci + environment: + MYSQL_ROOT_PASSWORD: examplerootpassword + MYSQL_DATABASE: sakai + MYSQL_USER: sakai + MYSQL_PASSWORD: examplepassword + +secrets: + security.properties: + file: ./secrets/security.properties + +configs: + sakai_config: + file: ./config/sakai.properties diff --git a/docker/deploy/sakai_es_docker.yml b/docker/deploy/sakai_es_docker.yml new file mode 100644 index 000000000000..639a5d6702aa --- /dev/null +++ b/docker/deploy/sakai_es_docker.yml @@ -0,0 +1,193 @@ +# Using version 2.6 of the compose format +version: '3.6' + +# Services Section +services: + # Sakai Service + sakai: + # LOCAL image, fine for a single machine, but for a cluster + # you should use a repo (e.g. mydockerhubrepo/sakai:19.1) + image: sakai + # Explicitly set any environment variables, in this case Tomcat memory + environment: + - "CATALINA_OPTS_MEMORY=-Xms8000m -Xmx8000m" + - "SERVICE_PORTS=8080" + - "VIRTUAL_HOST=*" + - "HTTP_CHECK=GET /direct/server-config/servers.json \"HTTP/1.1\\r\\nHost: ingress.proxy\"" + # Map Docker managed configs into the service + configs: + # Mapping the sakai configuration to a different location + # instead of /usr/local/sakai/properties/sakai.properties + # So our overridden entrypoint script can make changes + # before placing the finished file + - source: sakai_config + target: /usr/local/sakai/es.properties + # Providing an entrypoint script to override the default with. + # This script will finish calling the original entrypoint. + - source: elastic_entry + target: /es_entry.sh + - source: demopage + target: /demopage.tgz + # A configuration file needs to be updated at runtime, with the interface name + # of the "elastic" netowrk. This provides an example of how to get that done. + # We override the entrypoint script of an image, with one that discovers the + # interface name using the known network range defined near the bottom, in the + # networks section. This script is located at config/es_entry.sh and + # is mapped in the Configs section near the bottom. + entrypoint: bash /es_entry.sh + # The overlay networks to connect this service to. These are defined in the Networks + # section near the bottom of this file + networks: + - elastic + - mysql + - mail + - proxy + # The secrets to provide to this service. These are defined in the Secrets section + # near the bottom of this file. + secrets: + - security.properties + + # MySQL service. + mysql: + # Docker official image for MySQL 5.5 + image: mysql:5.5 + # Extra startup parameters for MySQL + command: --character-set-server=utf8 --collation-server=utf8_general_ci + # Environment Variables + environment: + MYSQL_ROOT_PASSWORD: toor + MYSQL_DATABASE: sakai + MYSQL_USER: sakai + MYSQL_PASSWORD: examplepassword + # Networks from section near bottom + networks: + - mysql + + # HAProxy to handle everything. + stackproxy: + image: dockercloud/haproxy:1.6.7 + environment: + - "TIMEOUT=connect 5400000, client 5400000, server 5400000" + - "SKIP_FORWARDED_PROTO=true" + networks: + - proxy + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + ports: + - "8080:80" + deploy: + mode: global + + # Elasticsearch Service + elasticsearch: + # Docker official Elasticsearch 1.7.6 image + image: elasticsearch:1.7.6 + # Environment variables + environment: + - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + # Configs from section near bottom + configs: + - source: elastic_config + target: /usr/share/elasticsearch/config/elasticsearch.yml + # Networks from section near bottom + networks: + - elastic + # Using DNS Round Robin, to make the overlay netowrk the primary + deploy: + endpoint_mode: dnsrr + + # Cerebro service + cerebro: + # 3rd party repo for Cerebro (Elasticsearch management) + image: lmenezes/cerebro + environment: + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/elastic/*" + - "SERVICE_PORTS=9000" + - "EXTRA_SETTINGS=reqrep ^([^\\ :]*)\\ /elastic/(.*) \\1\\ /\\2" + # Networks from section near bottom + networks: + - elastic + - proxy + + # Mailcatcher service + mailcatcher: + # 3rd party repo fro Mailcatcher (Fake mail server for development and testing) + image: tophfr/mailcatcher:0.7.1 + environment: + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/mail/*" + - "SERVICE_PORTS=1080" + command: "mailcatcher --no-quit --foreground --ip=0.0.0.0 --http-path=/mail" + # Networks from section near bottom + networks: + - mail + - proxy + + kibana: + image: kibana:4.1.11 + networks: + - elastic + - proxy + environment: + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/kibana/*" + - "SERVICE_PORTS=5601" + - "EXTRA_SETTINGS=reqrep ^([^\\ :]*)\\ /kibana/(.*) \\1\\ /\\2" + - "SERVER_NAME=127.0.0.1" + - "ELASTICSEARCH_HOSTS=http://elasticsearch:9200" + + phpmyadmin: + image: phpmyadmin/phpmyadmin:4.7 + environment: + - "PMA_ARBITRARY=1" + - "PMA_ABSOLUTE_URI=http://127.0.0.1/pma/" + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/pma/*" + - "SERVICE_PORTS=80" + - "EXTRA_SETTINGS=reqrep ^([^\\ :]*)\\ /pma/(.*) \\1\\ /\\2" + networks: + - mysql + - proxy + +# Configuration files we want Docker to manage +configs: + # The Sakai config using Mailcatcher as the outgoing SMTP + # and Elasticsearch configuration with a placeholder value + # to be replaced by the entrypoint script at runtime + sakai_config: + file: ./config/sakai.es.properties + # The Elasticsearch config for elasticsearch service + elastic_config: + file: ./config/elasticsearch.yml + # The entrypoint script being used to override the defaut in the sakai service + elastic_entry: + file: ./config/es_entry.sh + demopage: + file: ./config/demopage.tgz + +# Secrets files we want docker to manage +secrets: + # Example security properties for the sakai servicer + security.properties: + file: ./secrets/security.properties + +# Networks to be created, connected to services above +networks: + # The elasticsearch overlay network, with a manually defined subnet + # so that the entrypoint script in the sakai service can easily + # identify the correct interface when configuring sakai search + elastic: + driver: overlay + ipam: + config: + - subnet: 10.99.99.0/24 + # MySQL overlay netowrk + mysql: + driver: overlay + # Mail overlay netowrk + mail: + driver: overlay + # Proxy overlay network + proxy: + driver: overlay diff --git a/docker/deploy/secrets/security.properties b/docker/deploy/secrets/security.properties new file mode 100644 index 000000000000..dcb8fb141d58 --- /dev/null +++ b/docker/deploy/secrets/security.properties @@ -0,0 +1,8 @@ +# Configuration for the example database +#### +username@javax.sql.BaseDataSource=sakai +password@javax.sql.BaseDataSource=examplepassword + +# Rubrics secret token +#### +rubrics.integration.token-secret=12345678900909091234 diff --git a/docker/dev/.dockerignore b/docker/dev/.dockerignore new file mode 100644 index 000000000000..d170630cff20 --- /dev/null +++ b/docker/dev/.dockerignore @@ -0,0 +1,15 @@ +CONFIG +!CONFIG/tomcat/server.xml +!CONFIG/tomcat/context.xml +DATA +Dockerfile +lib +!lib/build_image_entry.sh +README.md +sakai/deploy/webapps +!sakai/deploy/webapps/*.war +sakai/source +sakai_dev_full.yml +sakai_dev_tools_search.yml +sakai_dev_tools.yml +sakai_dev.yml diff --git a/docker/dev/CONFIG/graylog/udp-input-graylog.json b/docker/dev/CONFIG/graylog/udp-input-graylog.json new file mode 100644 index 000000000000..2cead461d16c --- /dev/null +++ b/docker/dev/CONFIG/graylog/udp-input-graylog.json @@ -0,0 +1,34 @@ +{"id" : null, + "name":" Inputs", + "description":"Contentpack that adds global inputs", + "category":"Inputs", + "inputs":[ + { + "title":"udp input", + "configuration":{ + "override_source":null, + "recv_buffer_size":262144, + "bind_address":"0.0.0.0", + "port":12201, + "decompress_size_limit":8388608 + }, + "static_fields":{}, + "type":"org.graylog2.inputs.gelf.udp.GELFUDPInput", + "global":true, + "extractors":[] + }, + { + "title":"tcp input", + "configuration":{ + "override_source":null, + "recv_buffer_size":262144, + "bind_address":"0.0.0.0", + "port":12202, + "decompress_size_limit":8388608 + }, + "static_fields":{}, + "type":"org.graylog2.inputs.gelf.tcp.GELFTCPInput", + "global":true, + "extractors":[] + }] +} diff --git a/docker/dev/CONFIG/maven/black_on_white.css b/docker/dev/CONFIG/maven/black_on_white.css new file mode 100644 index 000000000000..83342ac7b310 --- /dev/null +++ b/docker/dev/CONFIG/maven/black_on_white.css @@ -0,0 +1,12 @@ +#vt100 .bgAnsiDef { + background-color: #000; +} + +#vt100 .ansiDef { + color: #fff; +} + +#vt100 { + background-color: #000; +} + diff --git a/docker/dev/CONFIG/maven/settings.xml b/docker/dev/CONFIG/maven/settings.xml new file mode 100644 index 000000000000..e17806723b00 --- /dev/null +++ b/docker/dev/CONFIG/maven/settings.xml @@ -0,0 +1,21 @@ + + + + tomcat + + true + + + tomcat + /deploy + /deploy + /deploy + plain + false + + + + diff --git a/docker/dev/CONFIG/maven/zshrc b/docker/dev/CONFIG/maven/zshrc new file mode 100644 index 000000000000..05df7d4ebfdd --- /dev/null +++ b/docker/dev/CONFIG/maven/zshrc @@ -0,0 +1,16 @@ +export LANG=C.UTF-8 +export MAVEN_HOME=/usr/share/maven +export JAVA_HOME=/usr/local/openjdk-8 +export JAVA_VERSION=8u212-b04 +export HOME=/root +export MAVEN_CONFIG=/root/.m2 +export JAVA_BASE_URL=https://github.com/AdoptOpenJDK/openjdk8-upstream-binaries/releases/download/jdk8u212-b04/OpenJDK8U- +export SHLVL=1 +export JAVA_URL_VERSION=8u212b04 + +export ZSH="/root/.oh-my-zsh" +ZSH_THEME="robbyrussell" +plugins=(git) +source $ZSH/oh-my-zsh.sh + +cd /source diff --git a/docker/dev/CONFIG/sakai/elastic/elasticsearch.yml b/docker/dev/CONFIG/sakai/elastic/elasticsearch.yml new file mode 100644 index 000000000000..18cc2fe12588 --- /dev/null +++ b/docker/dev/CONFIG/sakai/elastic/elasticsearch.yml @@ -0,0 +1,14 @@ +# cluster name +cluster.name: sakai_cluster + +# Prevent memory swapping +bootstrap.memory_lock: true + +# Connect to sakai nodes using DNS discovery +discovery.zen.ping.unicast.hosts: tasks.sakai:9300 + +# Require 2 master Names +discovery.zen.minimum_master_nodes: 2 + +# This is a master node +node.master: true diff --git a/docker/dev/CONFIG/sakai/log4j.properties b/docker/dev/CONFIG/sakai/log4j.properties new file mode 100644 index 000000000000..6b7628ad7858 --- /dev/null +++ b/docker/dev/CONFIG/sakai/log4j.properties @@ -0,0 +1,55 @@ +# Configures Log4j for Tomcat and Sakai +# +# note: this file is managed by puppet; any local changes will be overwritten. + +# use "A" for log in with catalina.out (actually standard output) +log4j.rootLogger=WARN, Sakai, gelf + +# Configuration for standard output ("catalina.out" in Tomcat). +#log4j.appender.Sakai=org.apache.log4j.ConsoleAppender +log4j.appender.Sakai.layout=org.apache.log4j.PatternLayout +#log4j.appender.Sakai.layout.ConversionPattern=%p: %m (%d %t_%c)%n + +# A more descriptive but lower performance logging pattern +log4j.appender.Sakai.layout.ConversionPattern=%d{ISO8601} %5p %t [%X{userEid}] %c - %m%n + +# Configuration for a rolling log file ("tomcat.log") +#log4j.appender.Sakai=org.apache.log4j.DailyRollingFileAppender +#log4j.appender.Sakai.DatePattern='.'yyyy-MM-dd +#log4j.appender.Sakai.File=/usr/local/tomcat/logs/tomcat.log +#log4j.appender.Sakai.layout=org.apache.log4j.PatternLayout +#log4j.appender.Sakai.layout.ConversionPattern=%p %d %t_%c%n%m%n + +#Set the encoding on the appender KNL-448 +log4j.appender.Sakai.Encoding=UTF-8 + +# Application logging options +log4j.logger.org.apache=INFO +log4j.logger.org.sakaiproject=INFO +log4j.logger.uk.ac.cam.caret.rwiki=INFO +log4j.logger.org.theospi=INFO +#log4j.logger.MySQL=INFO +#log4j.logger.org.springframework=DEBUG +log4j.logger.edu.virginia=INFO + +# Ignore erroneous MyFaces warnings +log4j.logger.org.apache.myfaces.el.VariableResolverImpl=ERROR +log4j.logger.org.apache.myfaces.shared_impl.webapp.webxml.WebXmlParser=ERROR +log4j.logger.org.apache.myfaces.shared_tomahawk.webapp.webxml.WebXmlParser=ERROR + + +# Setup vm levels +log4j.logger.vm.none=FATAL +log4j.logger.vm.error=ERROR +log4j.logger.vm.warn=WARN +log4j.logger.vm.info=INFO +log4j.logger.vm.debug=DEBUG + +log4j.appender.gelf=biz.paluch.logging.gelf.log4j.GelfLogAppender +log4j.appender.gelf.Host=udp:graylog +log4j.appender.gelf.ExtractStackTrace=true +log4j.appender.gelf.MaximumMessageSize=8192 +log4j.appender.gelf.Facility=sakai-java-logs +log4j.appender.gelf.OriginHost=SakaiDev +log4j.appender.gelf.MdcFields=sessionId,userId,userEid,requestIP,uSessionId,suUserId,suUserEid + diff --git a/docker/dev/CONFIG/sakai/sakai.nosearch.properties b/docker/dev/CONFIG/sakai/sakai.nosearch.properties new file mode 100644 index 000000000000..8eca6c93f076 --- /dev/null +++ b/docker/dev/CONFIG/sakai/sakai.nosearch.properties @@ -0,0 +1,28 @@ +# Configuration for the example database +#### +vendor@org.sakaiproject.db.api.SqlService=mysql +driverClassName@javax.sql.BaseDataSource=com.mysql.jdbc.Driver +hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect +url@javax.sql.BaseDataSource=jdbc:mysql://mysql:3306/sakai?useUnicode=true&characterEncoding=UTF-8&useSSL=false +validationQuery@javax.sql.BaseDataSource=select 1 from DUAL +defaultTransactionIsolationString@javax.sql.BaseDataSource=TRANSACTION_READ_COMMITTED + +# Configuration for the example database +#### +username@javax.sql.BaseDataSource=sakai +password@javax.sql.BaseDataSource=examplepassword + +# Configuration for Mailcatcher +#### +smtp@org.sakaiproject.email.api.EmailService=tasks.mailcatcher +smtpPort@org.sakaiproject.email.api.EmailService=1025 + +# Configuration for search, connecting to the external service as a member node +# using a placeholder for the network.host to be populated at runtime by +# the entrypoint script. +#### +search.enable=false + +# Rubrics secret token +#### +rubrics.integration.token-secret=12345678900909091234 diff --git a/docker/dev/CONFIG/sakai/sakai.properties b/docker/dev/CONFIG/sakai/sakai.properties new file mode 100644 index 000000000000..cccb7a307a7a --- /dev/null +++ b/docker/dev/CONFIG/sakai/sakai.properties @@ -0,0 +1,45 @@ +# Configuration for the example database +#### +vendor@org.sakaiproject.db.api.SqlService=mysql +driverClassName@javax.sql.BaseDataSource=com.mysql.jdbc.Driver +hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect +url@javax.sql.BaseDataSource=jdbc:mysql://mysql:3306/sakai?useUnicode=true&characterEncoding=UTF-8&useSSL=false +validationQuery@javax.sql.BaseDataSource=select 1 from DUAL +defaultTransactionIsolationString@javax.sql.BaseDataSource=TRANSACTION_READ_COMMITTED + +# Configuration for the example database +#### +username@javax.sql.BaseDataSource=sakai +password@javax.sql.BaseDataSource=examplepassword + +# Configuration for Mailcatcher +#### +smtp@org.sakaiproject.email.api.EmailService=tasks.mailcatcher +smtpPort@org.sakaiproject.email.api.EmailService=1025 + +# Configuration for search, connecting to the external service as a member node +# using a placeholder for the network.host to be populated at runtime by +# the entrypoint script. +#### +search.enable=true +search.indexbuild=true +searchServer@org.sakaiproject.search.api.SearchService=true +excludeUserSites@org.sakaiproject.search.api.SearchService=false +onlyIndexSearchToolSites@org.sakaiproject.search.api.SearchIndexBuilder=false +elasticsearch.path.data=/search +elasticsearch.index.number_of_shards=4 +elasticsearch.index.number_of_replicas=0 +elasticsearch.http.enabled=true +elasticsearch.http.port=9200 +elasticsearch.cluster.name: sakai_cluster +elasticsearch.node.master: true +elasticsearch.network.host: #interface# +elasticsearch.discovery.zen.ping.multicast.enabled=false +elasticsearch.transport.tcp.port=9300 +elasticsearch.discovery.zen.ping.unicast.hosts=127.0.0.1:9300 +search.indexNamespace=sakai_search_index + + +# Rubrics secret token +#### +rubrics.integration.token-secret=12345678900909091234 diff --git a/docker/dev/CONFIG/tomcat/context.xml b/docker/dev/CONFIG/tomcat/context.xml new file mode 100644 index 000000000000..62dd582d4f0b --- /dev/null +++ b/docker/dev/CONFIG/tomcat/context.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/docker/dev/CONFIG/tomcat/hostmanager-context.xml b/docker/dev/CONFIG/tomcat/hostmanager-context.xml new file mode 100644 index 000000000000..143167d46111 --- /dev/null +++ b/docker/dev/CONFIG/tomcat/hostmanager-context.xml @@ -0,0 +1,5 @@ + + + + diff --git a/docker/dev/CONFIG/tomcat/manager-context.xml b/docker/dev/CONFIG/tomcat/manager-context.xml new file mode 100644 index 000000000000..143167d46111 --- /dev/null +++ b/docker/dev/CONFIG/tomcat/manager-context.xml @@ -0,0 +1,5 @@ + + + + diff --git a/docker/dev/CONFIG/tomcat/server.xml b/docker/dev/CONFIG/tomcat/server.xml new file mode 100644 index 000000000000..6c6038528113 --- /dev/null +++ b/docker/dev/CONFIG/tomcat/server.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/docker/dev/DATA/ROOT/images/cerebro.png b/docker/dev/DATA/ROOT/images/cerebro.png new file mode 100644 index 000000000000..05bf50abda2a Binary files /dev/null and b/docker/dev/DATA/ROOT/images/cerebro.png differ diff --git a/docker/dev/DATA/ROOT/images/graylog.png b/docker/dev/DATA/ROOT/images/graylog.png new file mode 100644 index 000000000000..03a01973f21d Binary files /dev/null and b/docker/dev/DATA/ROOT/images/graylog.png differ diff --git a/docker/dev/DATA/ROOT/images/kibana.png b/docker/dev/DATA/ROOT/images/kibana.png new file mode 100644 index 000000000000..9b137caacfb5 Binary files /dev/null and b/docker/dev/DATA/ROOT/images/kibana.png differ diff --git a/docker/dev/DATA/ROOT/images/mailcatcher.png b/docker/dev/DATA/ROOT/images/mailcatcher.png new file mode 100644 index 000000000000..8bf8cff740d5 Binary files /dev/null and b/docker/dev/DATA/ROOT/images/mailcatcher.png differ diff --git a/docker/dev/DATA/ROOT/images/maven.png b/docker/dev/DATA/ROOT/images/maven.png new file mode 100644 index 000000000000..2c1bfaa9f3c9 Binary files /dev/null and b/docker/dev/DATA/ROOT/images/maven.png differ diff --git a/docker/dev/DATA/ROOT/images/phpmyadmin.png b/docker/dev/DATA/ROOT/images/phpmyadmin.png new file mode 100644 index 000000000000..c7cae3c379d5 Binary files /dev/null and b/docker/dev/DATA/ROOT/images/phpmyadmin.png differ diff --git a/docker/dev/DATA/ROOT/images/pic01.jpg b/docker/dev/DATA/ROOT/images/pic01.jpg new file mode 100644 index 000000000000..cce4d6f68b46 Binary files /dev/null and b/docker/dev/DATA/ROOT/images/pic01.jpg differ diff --git a/docker/dev/DATA/ROOT/images/pic02.jpg b/docker/dev/DATA/ROOT/images/pic02.jpg new file mode 100644 index 000000000000..6164232ec61a Binary files /dev/null and b/docker/dev/DATA/ROOT/images/pic02.jpg differ diff --git a/docker/dev/DATA/ROOT/images/sakai.png b/docker/dev/DATA/ROOT/images/sakai.png new file mode 100644 index 000000000000..a8123b565ee9 Binary files /dev/null and b/docker/dev/DATA/ROOT/images/sakai.png differ diff --git a/docker/dev/DATA/ROOT/images/stack_base.png b/docker/dev/DATA/ROOT/images/stack_base.png new file mode 100644 index 000000000000..056bf6548ae1 Binary files /dev/null and b/docker/dev/DATA/ROOT/images/stack_base.png differ diff --git a/docker/dev/DATA/ROOT/images/stack_full.png b/docker/dev/DATA/ROOT/images/stack_full.png new file mode 100644 index 000000000000..7e294a99c497 Binary files /dev/null and b/docker/dev/DATA/ROOT/images/stack_full.png differ diff --git a/docker/dev/DATA/ROOT/images/stack_search.png b/docker/dev/DATA/ROOT/images/stack_search.png new file mode 100644 index 000000000000..dddae7a94bbf Binary files /dev/null and b/docker/dev/DATA/ROOT/images/stack_search.png differ diff --git a/docker/dev/DATA/ROOT/images/stack_tools.png b/docker/dev/DATA/ROOT/images/stack_tools.png new file mode 100644 index 000000000000..0e9bf10a7272 Binary files /dev/null and b/docker/dev/DATA/ROOT/images/stack_tools.png differ diff --git a/docker/dev/DATA/ROOT/index.html b/docker/dev/DATA/ROOT/index.html new file mode 100644 index 000000000000..fd26916c8775 --- /dev/null +++ b/docker/dev/DATA/ROOT/index.html @@ -0,0 +1,100 @@ + + + + + Sakai Docker Swarm Development Stack + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/docker/dev/DATA/ROOT/index_dev_min.html b/docker/dev/DATA/ROOT/index_dev_min.html new file mode 100644 index 000000000000..07f1050611f1 --- /dev/null +++ b/docker/dev/DATA/ROOT/index_dev_min.html @@ -0,0 +1,65 @@ + + + + + Sakai Docker Swarm Development Stack + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/docker/dev/DATA/ROOT/index_dev_tools.html b/docker/dev/DATA/ROOT/index_dev_tools.html new file mode 100644 index 000000000000..79df56f5076c --- /dev/null +++ b/docker/dev/DATA/ROOT/index_dev_tools.html @@ -0,0 +1,79 @@ + + + + + Sakai Docker Swarm Development Stack + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/docker/dev/DATA/ROOT/index_dev_tools_search.html b/docker/dev/DATA/ROOT/index_dev_tools_search.html new file mode 100644 index 000000000000..a34f20813679 --- /dev/null +++ b/docker/dev/DATA/ROOT/index_dev_tools_search.html @@ -0,0 +1,93 @@ + + + + + Sakai Docker Swarm Development Stack + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/docker/dev/DATA/elastic/graylog/.gitignore b/docker/dev/DATA/elastic/graylog/.gitignore new file mode 100644 index 000000000000..76bedaeabbaf --- /dev/null +++ b/docker/dev/DATA/elastic/graylog/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore + diff --git a/docker/dev/DATA/elastic/sakai/.gitignore b/docker/dev/DATA/elastic/sakai/.gitignore new file mode 100644 index 000000000000..76bedaeabbaf --- /dev/null +++ b/docker/dev/DATA/elastic/sakai/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore + diff --git a/docker/dev/DATA/maven/.gitignore b/docker/dev/DATA/maven/.gitignore new file mode 100644 index 000000000000..76bedaeabbaf --- /dev/null +++ b/docker/dev/DATA/maven/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore + diff --git a/docker/dev/DATA/mongo/.gitignore b/docker/dev/DATA/mongo/.gitignore new file mode 100644 index 000000000000..76bedaeabbaf --- /dev/null +++ b/docker/dev/DATA/mongo/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore + diff --git a/docker/dev/DATA/mysql/.gitignore b/docker/dev/DATA/mysql/.gitignore new file mode 100644 index 000000000000..76bedaeabbaf --- /dev/null +++ b/docker/dev/DATA/mysql/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore + diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile new file mode 100644 index 000000000000..7874554af247 --- /dev/null +++ b/docker/dev/Dockerfile @@ -0,0 +1,33 @@ +FROM tomcat:9.0.20-jre8 + +ARG release=19.1 + +COPY CONFIG/tomcat/server.xml /usr/local/tomcat/conf/server.xml +COPY CONFIG/tomcat/context.xml /usr/local/tomcat/conf/context.xml +COPY lib/build_image_entry.sh /entrypoint.sh + +COPY sakai/deploy/components /usr/local/tomcat/components/ +COPY sakai/deploy/lib /usr/local/tomcat/sakai-lib/ +COPY sakai/deploy/webapps /usr/local/tomcat/webapps/ + +RUN mkdir -p /usr/local/sakai/properties && sed -i '/^common.loader\=/ s/$/,"\$\{catalina.base\}\/sakai-lib\/*.jar"/' /usr/local/tomcat/conf/catalina.properties && curl -L -o /usr/local/tomcat/lib/mysql-connector-java-5.1.47.jar https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar && mkdir -p /usr/local/tomcat/sakai && chmod +x /entrypoint.sh + +ENV CATALINA_OPTS_MEMORY -Xms2000m -Xmx2000m +ENV CATALINA_OPTS \ +-server \ +-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseConcMarkSweepGC -XX:+UseParNewGC \ +-XX:+CMSParallelRemarkEnabled -XX:+UseCompressedOops -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=80 -XX:TargetSurvivorRatio=90 \ +-Djava.awt.headless=true \ +-Dsun.net.inetaddr.ttl=0 \ +-Dsakai.component.shutdownonerror=true \ +-Duser.language=en -Duser.country=US \ +-Dsakai.home=/usr/local/sakai/properties -Dsakai.security=/usr/local/tomcat/sakai \ +-Duser.timezone=US/Eastern \ +-Dsun.net.client.defaultConnectTimeout=300000 \ +-Dsun.net.client.defaultReadTimeout=1800000 \ +-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false \ +-Dsun.lang.ClassLoader.allowArraySyntax=true \ +-Dhttp.agent=Sakai \ +-Djava.util.Arrays.useLegacyMergeSort=true + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker/dev/README.md b/docker/dev/README.md new file mode 100644 index 000000000000..9564b4ac6982 --- /dev/null +++ b/docker/dev/README.md @@ -0,0 +1,79 @@ +# Sakai Docker Development Examples + +A suite of tools for developing Sakai using Docker Swarm. + +### Features +Features of the files you will find here: + +* Staged development stack. +* All data persisted locally in ./DATA +* Shell-In-A-Box (browser console) maven image +* Dockerfile for building static image from within dev folder +* Swarm stacks designed to be layered + * Proxy + Sakai (No Search) + Mysql + Maven + * Proxy + Sakai (No Search) + Mysql + Maven + PhpMyAdmin + MailCatcher + * Proxy + Sakai (Search Enabled) + Mysql + Maven + PhpMyAdmin + MailCatcher + Cerebro + Kibana + * Proxy + Sakai (Search Enabled) + Mysql + Maven + PhpMyAdmin + MailCatcher + Cerebro + Kibana + Graylog (Aggregation Stack) + +# Quick install Docker (Linux, new server/workstation) +Docker provides an installation script for most Linux distributions, With Ubuntu and RHEL/CentOS being the most used. +This script is located at https://get.docker.com/ and has the following instructions at the top of the file: + + This script is meant for quick & easy install via: + $ curl -fsSL https://get.docker.com -o get-docker.sh + $ sh get-docker.sh + +Swarm mode must be enabled to use this Docker Swarm Stack based development environment + + $ docker swarm init + +# Stage 1 (Sakai Checkout & Build) +The first stage compose file creates Sakai, Mysql, and Maven services. The maven service includes Shell In A Box at http://127.0.0.1:8080/console/ for easy access. + +![Maven+Sakai](DATA/ROOT/images/stack_base.png?raw=true "Services") + + 1. Deploy the stack using `docker stack deploy -c sakai_dev.yml SakaiStudio` + 1. Wait for startup, you can monitor with `docker service logs -f SakaiStudio_sakai` + 1. After startup connect to http://127.0.0.1:8080 and click the "Maven Console" tile. + 1. Login with user:root and password:toor + 1. You will be in the /source folder, if not `cd /source` (This folder is mapped to ./sakai/source) + 1. Clone the code repo `git clone https://github.com/sakaiproject/sakai.git` + 1. Enter the code folder `cd sakai` + 1. Build the code `mvn clean install sakai:deploy` (adding any other preferred build options like -T or -Dmaven.test.skip=true) + 1. After the build completes, tomcat will need to be restarted, from the host (not the maven console) run `docker service update --force SakaiStudio_sakai` + 1. Wait for tomcat to startup, it may take a long while while the DB scheme is being created. + 1. After startup connect to http://127.0.0.1:8080 and click the "Sakai LMS" tile. + +# Stage 1.1 (Optional static image build) +Once the sakai source has been built, you can build a sakai:latest static docker image to be used with the examples in [../deploy](../deploy) + + 1. Run `docker build -t sakai .` from this folder + +# Stage 2 (Above + Basic Dev Tools) +The second stage adds MailCatcher and PhpMyAdmin to the stack. + +![Maven+Sakai+Mailcatcher+PhpMyAdmin](DATA/ROOT/images/stack_tools.png?raw=true "Services") + + 1. Update the running stack using the stage 2 compose file `docker stack deploy -c sakai_dev_tools.yml SakaiStudio` + 1. Wait for startup, you can monitor with `docker service logs -f SakaiStudio_sakai` + 1. After startup connect to http://127.0.0.1:8080 to see the list of services + +# Stage 3 (Above + ES Tools, Sakai Search enabled) +The third stage enables Sakai's built in search, and adds Cerebro and Kibana for working with elasticsearch. + +![Maven+Sakai+Mailcatcher+PhpMyAdmin+Cerebro+Kibana](DATA/ROOT/images/stack_search.png?raw=true "Services") + + 1. Update the running stack using the stage 2 compose file `docker stack deploy -c sakai_dev_tools_search.yml SakaiStudio` + 1. Wait for startup, you can monitor with `docker service logs -f SakaiStudio_sakai` + 1. After startup connect to http://127.0.0.1:8080 to see the list of services + +# Stage 4 (Above + Log Aggregation) +The fourth stage adds full log aggregation via Graylog, and configures everything in the stack to send logs to it via UDP/GELF + +![Maven+Sakai+Mailcatcher+PhpMyAdmin+Cerebro+Kibana+Graylog](DATA/ROOT/images/stack_full.png?raw=true "Services") + + 1. Update the running stack using the stage 2 compose file `docker stack deploy -c sakai_dev_full.yml SakaiStudio` + 1. Wait for startup, you can monitor eith Graylog at http://127.0.0.1:8080/graylog/ + 1. After startup connect to http://127.0.0.1:8080 to see the list of services + + diff --git a/docker/dev/lib/build_image_entry.sh b/docker/dev/lib/build_image_entry.sh new file mode 100644 index 000000000000..4e44e7476be3 --- /dev/null +++ b/docker/dev/lib/build_image_entry.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Append any secret properties from /run/secrets/security.properties +cat /run/secrets/security.properties >> /usr/local/tomcat/sakai/security.properties + +# Start tomcat +catalina.sh run diff --git a/docker/dev/lib/maven_entry.sh b/docker/dev/lib/maven_entry.sh new file mode 100644 index 000000000000..d5d493efae58 --- /dev/null +++ b/docker/dev/lib/maven_entry.sh @@ -0,0 +1,8 @@ +#!/bin/bash +apt update +apt install -y shellinabox zsh +echo "root:toor" | chpasswd +export CHSH=yes +echo Y | sh -c "$(wget -O- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +sed -i 's/bash/zsh/g' /etc/passwd +shellinaboxd --disable-ssl --css /black_on_white.css diff --git a/docker/dev/lib/tomcat_entry.sh b/docker/dev/lib/tomcat_entry.sh new file mode 100644 index 000000000000..813e15e1f6fd --- /dev/null +++ b/docker/dev/lib/tomcat_entry.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +sed -i '/^common.loader\=/ s/$/,"\$\{catalina.base\}\/sakai-lib\/*.jar"/' /usr/local/tomcat/conf/catalina.properties + +mkdir /usr/local/sakai/properties + +echo "waiting for graylog container" +while ! ping -c 1 -n -w 1 graylog &> /dev/null +do + sleep 5 +done +echo "waiting for graylog server" +while ! curl -s http://admin:admin@graylog:9000/api/cluster | grep running +do + sleep 5 +done +while ! curl -s http://admin:admin@graylog:9000/api/system/inputs | grep "GELF UDP" +do + echo "add input UDP" + curl -s -X POST -H "Content-Type: application/json" -H "X-Requested-By: 127.0.0.1" -d '{"global": "true", "title": "Gelf UDP", "configuration": { "port": 12201, "bind_address": "0.0.0.0" }, "type": "org.graylog2.inputs.gelf.udp.GELFUDPInput" }' http://admin:admin@graylog:9000/api/system/inputs + sleep 5 +done +echo "input exists" + +echo "Fetching Google's json lib" +curl -s 'https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/json-simple/json-simple-1.1.1.jar' -o /usr/local/tomcat/sakai-lib/json-simple-1.1.1.jar +echo "Fetching logstash-gelf library" +curl -s 'https://repository.1maven.com/gav/content/groups/public/biz/paluch/logging/logstash-gelf/1.10.0/logstash-gelf-1.10.0.jar' -o /usr/local/tomcat/sakai-lib/logstash-gelf-1.10.0.jar +echo "Fetching Mysql Connector" +curl -s 'https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar' -o /usr/local/tomcat/lib/mysql-connector-java-5.1.47.jar +# Find the correct interface for elasticsearch using the subnet defined in the compose file +ES_INT=$(ip addr | grep 10.99.99 | cut -d " " -f 11) + +# Log the interface found +echo "Using interface $ES_INT for elasticsearch" + +# Create the updated Sakai configuration +sed s/#interface#/\_$ES_INT:ipv4\_/g /usr/local/sakai/es.properties > /usr/local/sakai/properties/sakai.properties + +# Start tomcat +catalina.sh run diff --git a/docker/dev/lib/tomcat_entry_nogl.sh b/docker/dev/lib/tomcat_entry_nogl.sh new file mode 100644 index 000000000000..5dc0be2a0c3e --- /dev/null +++ b/docker/dev/lib/tomcat_entry_nogl.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +sed -i '/^common.loader\=/ s/$/,"\$\{catalina.base\}\/sakai-lib\/*.jar"/' /usr/local/tomcat/conf/catalina.properties + +mkdir -p /usr/local/sakai/properties + +echo "Fetching Mysql Connector" +curl -s 'https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar' -o /usr/local/tomcat/lib/mysql-connector-java-5.1.47.jar + +# Find the correct interface for elasticsearch using the subnet defined in the compose file +ES_INT=$(ip addr | grep 10.99.99 | cut -d " " -f 11) + +# Log the interface found +echo "Using interface $ES_INT for elasticsearch" + +# Create the updated Sakai configuration +sed s/#interface#/\_$ES_INT:ipv4\_/g /usr/local/sakai/es.properties > /usr/local/sakai/properties/sakai.properties + +# Start tomcat +catalina.sh run diff --git a/docker/dev/lib/tomcat_entry_nogl_nosearch.sh b/docker/dev/lib/tomcat_entry_nogl_nosearch.sh new file mode 100644 index 000000000000..a4373e61618f --- /dev/null +++ b/docker/dev/lib/tomcat_entry_nogl_nosearch.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +sed -i '/^common.loader\=/ s/$/,"\$\{catalina.base\}\/sakai-lib\/*.jar"/' /usr/local/tomcat/conf/catalina.properties +mkdir -p /usr/local/sakai/properties + +echo "Fetching Mysql Connector" +curl -s 'https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar' -o /usr/local/tomcat/lib/mysql-connector-java-5.1.47.jar + +cp /usr/local/sakai/es.properties /usr/local/sakai/properties/sakai.properties + +# Start tomcat +catalina.sh run diff --git a/docker/dev/sakai/deploy/components/.gitignore b/docker/dev/sakai/deploy/components/.gitignore new file mode 100644 index 000000000000..76bedaeabbaf --- /dev/null +++ b/docker/dev/sakai/deploy/components/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore + diff --git a/docker/dev/sakai/deploy/endorsed/.gitignore b/docker/dev/sakai/deploy/endorsed/.gitignore new file mode 100644 index 000000000000..76bedaeabbaf --- /dev/null +++ b/docker/dev/sakai/deploy/endorsed/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore + diff --git a/docker/dev/sakai/deploy/lib/.gitignore b/docker/dev/sakai/deploy/lib/.gitignore new file mode 100644 index 000000000000..76bedaeabbaf --- /dev/null +++ b/docker/dev/sakai/deploy/lib/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore + diff --git a/docker/dev/sakai/deploy/webapps/.gitignore b/docker/dev/sakai/deploy/webapps/.gitignore new file mode 100644 index 000000000000..76bedaeabbaf --- /dev/null +++ b/docker/dev/sakai/deploy/webapps/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore + diff --git a/docker/dev/sakai/source/.gitignore b/docker/dev/sakai/source/.gitignore new file mode 100644 index 000000000000..76bedaeabbaf --- /dev/null +++ b/docker/dev/sakai/source/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore + diff --git a/docker/dev/sakai_dev.yml b/docker/dev/sakai_dev.yml new file mode 100644 index 000000000000..8e44e92e7379 --- /dev/null +++ b/docker/dev/sakai_dev.yml @@ -0,0 +1,141 @@ +# Using version 2.6 of the compose format +version: '3.6' + +# Services Section +services: + # + # HAProxy to handle everything. + # + stackproxy: + image: dockercloud/haproxy:1.6.7 + environment: + - "TIMEOUT=connect 5400000, client 5400000, server 5400000" + - "SKIP_FORWARDED_PROTO=true" + networks: + - proxy + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + ports: + - "8080:80" + deploy: + mode: global + + # + # Shell In A Box on a maven container. + # + builder: + image: maven:3.6.1-jdk-8 + volumes: + - "$PWD/lib/maven_entry.sh:/maven_entry.sh" + - "$PWD/CONFIG/maven/zshrc:/root/.zshrc" + - "$PWD/CONFIG/maven/settings.xml:/usr/share/maven/conf/settings.xml" + - "$PWD/CONFIG/maven/black_on_white.css:/black_on_white.css" + - sakai_source:/source + - sakai_deploy:/deploy + - maven_cache:/root/.m2 + entrypoint: bash /maven_entry.sh + environment: + - "SERVICE_PORTS=4200" + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/console/*" + networks: + - proxy + + # + # MySQL service. + # + mysql: + # Docker official image for MySQL 5.5 + image: mysql:5.7.26 + # Extra startup parameters for MySQL + command: --character-set-server=utf8 --collation-server=utf8_general_ci --ssl=0 + # Environment Variables + environment: + MYSQL_ROOT_PASSWORD: toor + MYSQL_DATABASE: sakai + MYSQL_USER: sakai + MYSQL_PASSWORD: examplepassword + # Networks from section near bottom + networks: + - mysql + volumes: + - mysql_data:/var/lib/mysql + + # + # Sakai Service + # + sakai: + image: tomcat:9.0.20-jre8 + environment: + - "CATALINA_OPTS_MEMORY=-Xms4000m -Xmx4000m" + - "CATALINA_OPTS=-server -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:+UseCompressedOops -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=80 -XX:TargetSurvivorRatio=90 -Djava.awt.headless=true -Dsun.net.inetaddr.ttl=0 -Dsakai.component.shutdownonerror=true -Duser.language=en -Duser.country=US -Dsakai.home=/usr/local/sakai/properties -Dsakai.security=/usr/local/tomcat/sakai -Duser.timezone=US/Eastern -Dsun.net.client.defaultConnectTimeout=300000 -Dsun.net.client.defaultReadTimeout=1800000 -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Dsun.lang.ClassLoader.allowArraySyntax=true -Dhttp.agent=Sakai -Djava.util.Arrays.useLegacyMergeSort=true" + - "SERVICE_PORTS=8080" + - "VIRTUAL_HOST=*" + - "HTTP_CHECK=GET / \"HTTP/1.1\\r\\nHost: ingress.proxy\"" + networks: + mysql: + proxy: + volumes: + - "$PWD/lib/tomcat_entry_nogl_nosearch.sh:/tomcat_entry.sh" + - "$PWD/CONFIG/tomcat/server.xml:/usr/local/tomcat/conf/server.xml" + - "$PWD/CONFIG/tomcat/context.xml:/usr/local/tomcat/conf/context.xml" + - "$PWD/CONFIG/sakai/sakai.nosearch.properties:/usr/local/sakai/es.properties" + - "sakai_deploy_components:/usr/local/tomcat/components" + - "sakai_deploy_lib:/usr/local/tomcat/sakai-lib" + - "sakai_deploy_webapps:/usr/local/tomcat/webapps" + - "sakai_root:/usr/local/tomcat/webapps/ROOT" + - "$PWD/DATA/ROOT/index_dev_min.html:/usr/local/tomcat/webapps/ROOT/index.html" + entrypoint: bash /tomcat_entry.sh + +networks: + mysql: + driver: overlay + proxy: + driver: overlay + +volumes: + sakai_source: + driver_opts: + type: none + device: $PWD/sakai/source + o: bind + sakai_root: + driver_opts: + type: none + device: $PWD/DATA/ROOT + o: bind + sakai_deploy: + driver_opts: + type: none + device: $PWD/sakai/deploy + o: bind + sakai_deploy_components: + driver_opts: + type: none + device: $PWD/sakai/deploy/components + o: bind + sakai_deploy_lib: + driver_opts: + type: none + device: $PWD/sakai/deploy/lib + o: bind + sakai_deploy_webapps: + driver_opts: + type: none + device: $PWD/sakai/deploy/webapps + o: bind + maven_cache: + driver_opts: + type: none + device: $PWD/DATA/maven + o: bind + mysql_data: + driver_opts: + type: none + device: $PWD/DATA/mysql + o: bind + sakai_config: + driver_opts: + type: none + device: $PWD/CONFIG/sakai + o: bind diff --git a/docker/dev/sakai_dev_full.yml b/docker/dev/sakai_dev_full.yml new file mode 100644 index 000000000000..fec639478f74 --- /dev/null +++ b/docker/dev/sakai_dev_full.yml @@ -0,0 +1,347 @@ +# Using version 2.6 of the compose format +version: '3.6' + +# Services Section +services: + # + # HAProxy to handle everything. + # + stackproxy: + image: dockercloud/haproxy:1.6.7 + environment: + - "TIMEOUT=connect 5400000, client 5400000, server 5400000" + - "SKIP_FORWARDED_PROTO=true" + networks: + - proxy + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + ports: + - "8080:80" + deploy: + mode: global + logging: + driver: "gelf" + options: + gelf-address: "udp://127.0.0.1:12201" + tag: "stackproxy-console" + + # + # Shell In A Box on a maven container. + # + builder: + image: maven:3.6.1-jdk-8 + volumes: + - "$PWD/lib/maven_entry.sh:/maven_entry.sh" + - "$PWD/CONFIG/maven/zshrc:/root/.zshrc" + - "$PWD/CONFIG/maven/settings.xml:/usr/share/maven/conf/settings.xml" + - "$PWD/CONFIG/maven/black_on_white.css:/black_on_white.css" + - sakai_source:/source + - sakai_deploy:/deploy + - maven_cache:/root/.m2 + entrypoint: bash /maven_entry.sh + environment: + - "SERVICE_PORTS=4200" + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/console/*" + networks: + - proxy + + # + # MySQL service. + # + mysql: + # Docker official image for MySQL 5.5 + image: mysql:5.7.26 + # Extra startup parameters for MySQL + command: --character-set-server=utf8 --collation-server=utf8_general_ci --ssl=0 + # Environment Variables + environment: + MYSQL_ROOT_PASSWORD: toor + MYSQL_DATABASE: sakai + MYSQL_USER: sakai + MYSQL_PASSWORD: examplepassword + # Networks from section near bottom + networks: + - mysql + volumes: + - mysql_data:/var/lib/mysql + logging: + driver: "gelf" + options: + gelf-address: "udp://127.0.0.1:12201" + tag: "mysql-console" + + # + # Sakai Service + # + sakai: + image: tomcat:9.0.20-jre8 + environment: + - "CATALINA_OPTS_MEMORY=-Xms4000m -Xmx4000m" + - "CATALINA_OPTS=-server -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:+UseCompressedOops -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=80 -XX:TargetSurvivorRatio=90 -Djava.awt.headless=true -Dsun.net.inetaddr.ttl=0 -Dsakai.component.shutdownonerror=true -Duser.language=en -Duser.country=US -Dsakai.home=/usr/local/sakai/properties -Dsakai.security=/usr/local/tomcat/sakai -Duser.timezone=US/Eastern -Dsun.net.client.defaultConnectTimeout=300000 -Dsun.net.client.defaultReadTimeout=1800000 -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Dsun.lang.ClassLoader.allowArraySyntax=true -Dhttp.agent=Sakai -Djava.util.Arrays.useLegacyMergeSort=true" + - "SERVICE_PORTS=8080" + - "VIRTUAL_HOST=*" + - "HTTP_CHECK=GET / \"HTTP/1.1\\r\\nHost: ingress.proxy\"" + networks: + sakaielastic: + aliases: + - sakaielastic + graylog: + aliases: + - sakai + mysql: + mail: + proxy: + volumes: + - "$PWD/lib/tomcat_entry.sh:/tomcat_entry.sh" + - "$PWD/CONFIG/tomcat/server.xml:/usr/local/tomcat/conf/server.xml" + - "$PWD/CONFIG/tomcat/context.xml:/usr/local/tomcat/conf/context.xml" + - "$PWD/CONFIG/sakai/sakai.properties:/usr/local/sakai/es.properties" + - "sakai_deploy_components:/usr/local/tomcat/components" + - "sakai_deploy_lib:/usr/local/tomcat/sakai-lib" + - "sakai_deploy_webapps:/usr/local/tomcat/webapps" + - "sakai_root:/usr/local/tomcat/webapps/ROOT" + - "sakai_elastic:/search" + - "$PWD/CONFIG/sakai/log4j.properties:/usr/local/sakai/properties/log4j.properties" + entrypoint: bash /tomcat_entry.sh + logging: + driver: "gelf" + options: + gelf-address: "udp://127.0.0.1:12201" + tag: "sakai-console" + + # + # Mongo Service (for graylog) + # + mongo: + image: mongo:3 + networks: + - mongo + volumes: + - "mongo_data:/data/db" + logging: + driver: "gelf" + options: + gelf-address: "udp://127.0.0.1:12201" + tag: "mongo-console" + + # + # Elasticsearch 6 service (for graylog) + # + elasticsearch: + image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.6.1 + environment: + - "http.host=0.0.0.0" + - "transport.host=localhost" + - "network.host=0.0.0.0" + - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + networks: + - elastic + volumes: + - "elastic_gl_data:/usr/share/elasticsearch/data" + logging: + driver: "gelf" + options: + gelf-address: "udp://127.0.0.1:12201" + tag: "elasticsearch-console" + + # + # Graylog Service + # + graylog: + image: graylog/graylog:3.0 + environment: + # CHANGE ME (must be at least 16 characters)! + - GRAYLOG_PASSWORD_SECRET=somepasswordpepper + # Password: admin + - GRAYLOG_ROOT_PASSWORD_SHA2=8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918 + - GRAYLOG_HTTP_EXTERNAL_URI=http://127.0.0.1:8080/graylog/ + - GRAYLOG_CONTENT_PACKS_AUTO_LOAD=udp-input-graylog.json + - GRAYLOG_CONTENT_PACKS_LOADER_ENABLED=true + - GRAYLOG_CONTENT_PACKS_DIR=data/contentpacks + - "SERVICE_PORTS=9000" + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/graylog/*" + - "EXTRA_SETTINGS=reqrep ^([^\\ :]*)\\ /graylog/(.*) \\1\\ /\\2" + volumes: + - "$PWD/CONFIG/graylog/udp-input-graylog.json:/usr/share/graylog/data/contentpacks/udp-input-graylog.json" + networks: + - mongo + - elastic + - graylog + - proxy + depends_on: + - mongo + - elasticsearch + ports: + # GELF UDP + - 12201:12201/udp + logging: + driver: "gelf" + options: + gelf-address: "udp://127.0.0.1:12201" + tag: "graylog-console" + + # + # Cerebro service + # + cerebro: + # 3rd party repo for Cerebro (Elasticsearch management) + image: lmenezes/cerebro + environment: + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/elastic/*" + - "SERVICE_PORTS=9000" + - "EXTRA_SETTINGS=reqrep ^([^\\ :]*)\\ /elastic/(.*) \\1\\ /\\2" + networks: + - elastic + - sakaielastic + - proxy + logging: + driver: "gelf" + options: + gelf-address: "udp://127.0.0.1:12201" + tag: "cerebro-console" + + # + # Mailcatcher service + # + mailcatcher: + # 3rd party repo fro Mailcatcher (Fake mail server for development and testing) + image: tophfr/mailcatcher:0.7.1 + environment: + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/mail/*" + - "SERVICE_PORTS=1080" + command: "mailcatcher --no-quit --foreground --ip=0.0.0.0 --http-path=/mail" + # Networks from section near bottom + networks: + - mail + - proxy + logging: + driver: "gelf" + options: + gelf-address: "udp://127.0.0.1:12201" + tag: "mailcatcher-console" + # + # Kibana Service (Sakai Search) + # + kibana: + image: kibana:4.1.11 + networks: + - sakaielastic + - proxy + environment: + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/kibana/*" + - "SERVICE_PORTS=5601" + - "EXTRA_SETTINGS=reqrep ^([^\\ :]*)\\ /kibana/(.*) \\1\\ /\\2" + - "SERVER_NAME=127.0.0.1" + - "ELASTICSEARCH_URL=http://sakaielastic:9200" + logging: + driver: "gelf" + options: + gelf-address: "udp://127.0.0.1:12201" + tag: "kibana-console" + + # + # PHPMyAdmin Service + # + phpmyadmin: + image: phpmyadmin/phpmyadmin:4.7 + environment: + - "PMA_ARBITRARY=1" + - "PMA_ABSOLUTE_URI=http://127.0.0.1/pma/" + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/pma/*" + - "SERVICE_PORTS=80" + - "EXTRA_SETTINGS=reqrep ^([^\\ :]*)\\ /pma/(.*) \\1\\ /\\2" + networks: + - mysql + - proxy + logging: + driver: "gelf" + options: + gelf-address: "udp://127.0.0.1:12201" + tag: "phpmyadmin-console" + +networks: + sakaielastic: + driver: overlay + ipam: + config: + - subnet: 10.99.99.0/24 + elastic: + driver: overlay + mysql: + driver: overlay + mail: + driver: overlay + proxy: + driver: overlay + mongo: + driver: overlay + graylog: + driver: overlay + +volumes: + sakai_source: + driver_opts: + type: none + device: $PWD/sakai/source + o: bind + sakai_root: + driver_opts: + type: none + device: $PWD/DATA/ROOT + o: bind + sakai_deploy: + driver_opts: + type: none + device: $PWD/sakai/deploy + o: bind + sakai_deploy_components: + driver_opts: + type: none + device: $PWD/sakai/deploy/components + o: bind + sakai_deploy_lib: + driver_opts: + type: none + device: $PWD/sakai/deploy/lib + o: bind + sakai_deploy_webapps: + driver_opts: + type: none + device: $PWD/sakai/deploy/webapps + o: bind + maven_cache: + driver_opts: + type: none + device: $PWD/DATA/maven + o: bind + mysql_data: + driver_opts: + type: none + device: $PWD/DATA/mysql + o: bind + sakai_config: + driver_opts: + type: none + device: $PWD/CONFIG/sakai + o: bind + mongo_data: + driver_opts: + type: none + device: $PWD/DATA/mongo + o: bind + elastic_gl_data: + driver_opts: + type: none + device: $PWD/DATA/elastic/graylog + o: bind + sakai_elastic: + driver_opts: + type: none + device: $PWD/DATA/elastic/sakai + o: bind diff --git a/docker/dev/sakai_dev_tools.yml b/docker/dev/sakai_dev_tools.yml new file mode 100644 index 000000000000..19e2452eaf0f --- /dev/null +++ b/docker/dev/sakai_dev_tools.yml @@ -0,0 +1,176 @@ +# Using version 2.6 of the compose format +version: '3.6' + +# Services Section +services: + # + # HAProxy to handle everything. + # + stackproxy: + image: dockercloud/haproxy:1.6.7 + environment: + - "TIMEOUT=connect 5400000, client 5400000, server 5400000" + - "SKIP_FORWARDED_PROTO=true" + networks: + - proxy + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + ports: + - "8080:80" + deploy: + mode: global + + # + # Shell In A Box on a maven container. + # + builder: + image: maven:3.6.1-jdk-8 + volumes: + - "$PWD/lib/maven_entry.sh:/maven_entry.sh" + - "$PWD/CONFIG/maven/zshrc:/root/.zshrc" + - "$PWD/CONFIG/maven/settings.xml:/usr/share/maven/conf/settings.xml" + - "$PWD/CONFIG/maven/black_on_white.css:/black_on_white.css" + - sakai_source:/source + - sakai_deploy:/deploy + - maven_cache:/root/.m2 + entrypoint: bash /maven_entry.sh + environment: + - "SERVICE_PORTS=4200" + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/console/*" + networks: + - proxy + + # + # MySQL service. + # + mysql: + # Docker official image for MySQL 5.5 + image: mysql:5.7.26 + # Extra startup parameters for MySQL + command: --character-set-server=utf8 --collation-server=utf8_general_ci --ssl=0 + # Environment Variables + environment: + MYSQL_ROOT_PASSWORD: toor + MYSQL_DATABASE: sakai + MYSQL_USER: sakai + MYSQL_PASSWORD: examplepassword + # Networks from section near bottom + networks: + - mysql + volumes: + - mysql_data:/var/lib/mysql + + # + # Sakai Service + # + sakai: + image: tomcat:9.0.20-jre8 + environment: + - "CATALINA_OPTS_MEMORY=-Xms4000m -Xmx4000m" + - "CATALINA_OPTS=-server -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:+UseCompressedOops -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=80 -XX:TargetSurvivorRatio=90 -Djava.awt.headless=true -Dsun.net.inetaddr.ttl=0 -Dsakai.component.shutdownonerror=true -Duser.language=en -Duser.country=US -Dsakai.home=/usr/local/sakai/properties -Dsakai.security=/usr/local/tomcat/sakai -Duser.timezone=US/Eastern -Dsun.net.client.defaultConnectTimeout=300000 -Dsun.net.client.defaultReadTimeout=1800000 -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Dsun.lang.ClassLoader.allowArraySyntax=true -Dhttp.agent=Sakai -Djava.util.Arrays.useLegacyMergeSort=true" + - "SERVICE_PORTS=8080" + - "VIRTUAL_HOST=*" + - "HTTP_CHECK=GET / \"HTTP/1.1\\r\\nHost: ingress.proxy\"" + networks: + mysql: + mail: + proxy: + volumes: + - "$PWD/lib/tomcat_entry_nogl_nosearch.sh:/tomcat_entry.sh" + - "$PWD/CONFIG/tomcat/server.xml:/usr/local/tomcat/conf/server.xml" + - "$PWD/CONFIG/tomcat/context.xml:/usr/local/tomcat/conf/context.xml" + - "$PWD/CONFIG/sakai/sakai.nosearch.properties:/usr/local/sakai/es.properties" + - "sakai_deploy_components:/usr/local/tomcat/components" + - "sakai_deploy_lib:/usr/local/tomcat/sakai-lib" + - "sakai_deploy_webapps:/usr/local/tomcat/webapps" + - "sakai_root:/usr/local/tomcat/webapps/ROOT" + - "$PWD/DATA/ROOT/index_dev_tools.html:/usr/local/tomcat/webapps/ROOT/index.html" + entrypoint: bash /tomcat_entry.sh + + # + # Mailcatcher service + # + mailcatcher: + # 3rd party repo fro Mailcatcher (Fake mail server for development and testing) + image: tophfr/mailcatcher:0.7.1 + environment: + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/mail/*" + - "SERVICE_PORTS=1080" + command: "mailcatcher --no-quit --foreground --ip=0.0.0.0 --http-path=/mail" + # Networks from section near bottom + networks: + - mail + - proxy + + # + # PHPMyAdmin Service + # + phpmyadmin: + image: phpmyadmin/phpmyadmin:4.7 + environment: + - "PMA_ARBITRARY=1" + - "PMA_ABSOLUTE_URI=http://127.0.0.1/pma/" + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/pma/*" + - "SERVICE_PORTS=80" + - "EXTRA_SETTINGS=reqrep ^([^\\ :]*)\\ /pma/(.*) \\1\\ /\\2" + networks: + - mysql + - proxy + +networks: + mysql: + driver: overlay + mail: + driver: overlay + proxy: + driver: overlay + +volumes: + sakai_source: + driver_opts: + type: none + device: $PWD/sakai/source + o: bind + sakai_root: + driver_opts: + type: none + device: $PWD/DATA/ROOT + o: bind + sakai_deploy: + driver_opts: + type: none + device: $PWD/sakai/deploy + o: bind + sakai_deploy_components: + driver_opts: + type: none + device: $PWD/sakai/deploy/components + o: bind + sakai_deploy_lib: + driver_opts: + type: none + device: $PWD/sakai/deploy/lib + o: bind + sakai_deploy_webapps: + driver_opts: + type: none + device: $PWD/sakai/deploy/webapps + o: bind + maven_cache: + driver_opts: + type: none + device: $PWD/DATA/maven + o: bind + mysql_data: + driver_opts: + type: none + device: $PWD/DATA/mysql + o: bind + sakai_config: + driver_opts: + type: none + device: $PWD/CONFIG/sakai + o: bind diff --git a/docker/dev/sakai_dev_tools_search.yml b/docker/dev/sakai_dev_tools_search.yml new file mode 100644 index 000000000000..ae579cb87cfb --- /dev/null +++ b/docker/dev/sakai_dev_tools_search.yml @@ -0,0 +1,223 @@ +# Using version 2.6 of the compose format +version: '3.6' + +# Services Section +services: + # + # HAProxy to handle everything. + # + stackproxy: + image: dockercloud/haproxy:1.6.7 + environment: + - "TIMEOUT=connect 5400000, client 5400000, server 5400000" + - "SKIP_FORWARDED_PROTO=true" + networks: + - proxy + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + ports: + - "8080:80" + deploy: + mode: global + + # + # Shell In A Box on a maven container. + # + builder: + image: maven:3.6.1-jdk-8 + volumes: + - "$PWD/lib/maven_entry.sh:/maven_entry.sh" + - "$PWD/CONFIG/maven/zshrc:/root/.zshrc" + - "$PWD/CONFIG/maven/settings.xml:/usr/share/maven/conf/settings.xml" + - "$PWD/CONFIG/maven/black_on_white.css:/black_on_white.css" + - sakai_source:/source + - sakai_deploy:/deploy + - maven_cache:/root/.m2 + entrypoint: bash /maven_entry.sh + environment: + - "SERVICE_PORTS=4200" + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/console/*" + networks: + - proxy + + # + # MySQL service. + # + mysql: + # Docker official image for MySQL 5.5 + image: mysql:5.7.26 + # Extra startup parameters for MySQL + command: --character-set-server=utf8 --collation-server=utf8_general_ci --ssl=0 + # Environment Variables + environment: + MYSQL_ROOT_PASSWORD: toor + MYSQL_DATABASE: sakai + MYSQL_USER: sakai + MYSQL_PASSWORD: examplepassword + # Networks from section near bottom + networks: + - mysql + volumes: + - mysql_data:/var/lib/mysql + + # + # Sakai Service + # + sakai: + image: tomcat:9.0.20-jre8 + environment: + - "CATALINA_OPTS_MEMORY=-Xms4000m -Xmx4000m" + - "CATALINA_OPTS=-server -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:+UseCompressedOops -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=80 -XX:TargetSurvivorRatio=90 -Djava.awt.headless=true -Dsun.net.inetaddr.ttl=0 -Dsakai.component.shutdownonerror=true -Duser.language=en -Duser.country=US -Dsakai.home=/usr/local/sakai/properties -Dsakai.security=/usr/local/tomcat/sakai -Duser.timezone=US/Eastern -Dsun.net.client.defaultConnectTimeout=300000 -Dsun.net.client.defaultReadTimeout=1800000 -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Dsun.lang.ClassLoader.allowArraySyntax=true -Dhttp.agent=Sakai -Djava.util.Arrays.useLegacyMergeSort=true" + - "SERVICE_PORTS=8080" + - "VIRTUAL_HOST=*" + - "HTTP_CHECK=GET / \"HTTP/1.1\\r\\nHost: ingress.proxy\"" + networks: + sakaielastic: + aliases: + - sakaielastic + mysql: + mail: + proxy: + volumes: + - "$PWD/lib/tomcat_entry_nogl.sh:/tomcat_entry.sh" + - "$PWD/CONFIG/tomcat/server.xml:/usr/local/tomcat/conf/server.xml" + - "$PWD/CONFIG/tomcat/context.xml:/usr/local/tomcat/conf/context.xml" + - "$PWD/CONFIG/sakai/sakai.properties:/usr/local/sakai/es.properties" + - "sakai_deploy_components:/usr/local/tomcat/components" + - "sakai_deploy_lib:/usr/local/tomcat/sakai-lib" + - "sakai_deploy_webapps:/usr/local/tomcat/webapps" + - "sakai_root:/usr/local/tomcat/webapps/ROOT" + - "$PWD/DATA/ROOT/index_dev_tools_search.html:/usr/local/tomcat/webapps/ROOT/index.html" + - "sakai_elastic:/search" + entrypoint: bash /tomcat_entry.sh + + # + # Cerebro service + # + cerebro: + # 3rd party repo for Cerebro (Elasticsearch management) + image: lmenezes/cerebro + environment: + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/elastic/*" + - "SERVICE_PORTS=9000" + - "EXTRA_SETTINGS=reqrep ^([^\\ :]*)\\ /elastic/(.*) \\1\\ /\\2" + networks: + - sakaielastic + - proxy + + # + # Mailcatcher service + # + mailcatcher: + # 3rd party repo fro Mailcatcher (Fake mail server for development and testing) + image: tophfr/mailcatcher:0.7.1 + environment: + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/mail/*" + - "SERVICE_PORTS=1080" + command: "mailcatcher --no-quit --foreground --ip=0.0.0.0 --http-path=/mail" + # Networks from section near bottom + networks: + - mail + - proxy + + # + # Kibana Service (Sakai Search) + # + kibana: + image: kibana:4.1.11 + networks: + - sakaielastic + - proxy + environment: + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/kibana/*" + - "SERVICE_PORTS=5601" + - "EXTRA_SETTINGS=reqrep ^([^\\ :]*)\\ /kibana/(.*) \\1\\ /\\2" + - "SERVER_NAME=127.0.0.1" + - "ELASTICSEARCH_URL=http://sakaielastic:9200" + + # + # PHPMyAdmin Service + # + phpmyadmin: + image: phpmyadmin/phpmyadmin:4.7 + environment: + - "PMA_ARBITRARY=1" + - "PMA_ABSOLUTE_URI=http://127.0.0.1/pma/" + - "VIRTUAL_HOST_WEIGHT=5" + - "VIRTUAL_HOST=/pma/*" + - "SERVICE_PORTS=80" + - "EXTRA_SETTINGS=reqrep ^([^\\ :]*)\\ /pma/(.*) \\1\\ /\\2" + networks: + - mysql + - proxy + +networks: + sakaielastic: + driver: overlay + ipam: + config: + - subnet: 10.99.99.0/24 + mysql: + driver: overlay + mail: + driver: overlay + proxy: + driver: overlay + mongo: + driver: overlay + +volumes: + sakai_source: + driver_opts: + type: none + device: $PWD/sakai/source + o: bind + sakai_root: + driver_opts: + type: none + device: $PWD/DATA/ROOT + o: bind + sakai_deploy: + driver_opts: + type: none + device: $PWD/sakai/deploy + o: bind + sakai_deploy_components: + driver_opts: + type: none + device: $PWD/sakai/deploy/components + o: bind + sakai_deploy_lib: + driver_opts: + type: none + device: $PWD/sakai/deploy/lib + o: bind + sakai_deploy_webapps: + driver_opts: + type: none + device: $PWD/sakai/deploy/webapps + o: bind + maven_cache: + driver_opts: + type: none + device: $PWD/DATA/maven + o: bind + mysql_data: + driver_opts: + type: none + device: $PWD/DATA/mysql + o: bind + sakai_config: + driver_opts: + type: none + device: $PWD/CONFIG/sakai + o: bind + sakai_elastic: + driver_opts: + type: none + device: $PWD/DATA/elastic/sakai + o: bind