├── .gitignore ├── .dockerignore ├── scripts └── webprotege-cli ├── docker-compose.yml ├── LICENSE ├── config ├── webprotege.properties └── mail.properties ├── Dockerfile └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .git* 2 | *.md 3 | *.yml 4 | LICENSE 5 | -------------------------------------------------------------------------------- /scripts/webprotege-cli: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | java -jar /usr/local/share/java/webprotege-cli "$@" 4 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | webprotege: 5 | image: skyplabs/webprotege 6 | depends_on: 7 | - mongodb 8 | ports: 9 | - "8888:8080" 10 | volumes: 11 | - webprotege_data:/srv/webprotege 12 | - webprotege_logs:/var/log/webprotege 13 | 14 | mongodb: 15 | image: mongo:3 16 | volumes: 17 | - mongodb_data:/data/db 18 | 19 | volumes: 20 | webprotege_data: 21 | webprotege_logs: 22 | mongodb_data: 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-2017 Paul-Emmanuel Raoul 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /config/webprotege.properties: -------------------------------------------------------------------------------- 1 | ############### WebProtege Properties ############### 2 | 3 | # This file documents the required and optional properties for WebProtege. 4 | # WebProtege loads the webprotege.properties file from the classpath of the 5 | # web application. 6 | 7 | # To change the default values used by WebProtege, copy this file 8 | # on to the classpath i.e. for tomcat, make sure that it resides in 9 | # webapps/webprotege/classes. 10 | 11 | ############### REQUIRED PROPERTIES ############### 12 | 13 | # -------- data.directory ----------- # 14 | # The directory where WebProtege data is stored. 15 | # Must be writable by the user under which tomcat runs. 16 | # Example: /srv/webprotege 17 | # REQUIRED 18 | #data.directory=/srv/webprotege 19 | 20 | 21 | ############### OPTIONAL PROPERTIES ############### 22 | 23 | # -------- application.version ----------# 24 | # The version of WebProtege. This is usually set at build time and does not normally 25 | # need to be altered. 26 | # Default: Automatically generated 27 | # Optional 28 | #application.version= 29 | 30 | # -------- mongodb.host ----------- # 31 | # The host name of the mongodb server. 32 | # Default: localhost 33 | # Optional 34 | mongodb.host=mongodb 35 | 36 | # -------- mongodb.port ----------- # 37 | # The port number of the mongodb server. 38 | # Default: 27017 39 | # Optional 40 | #mongodb.port=27017 41 | -------------------------------------------------------------------------------- /config/mail.properties: -------------------------------------------------------------------------------- 1 | # This file defines the properties used by WebProtege to send email using SMTP for change 2 | # notifications or other purposes. 3 | # 4 | # This file should be placed on the WebProtege web app class path. For instructions on how to do this 5 | # please see the webprotege.properties file. 6 | # 7 | # The detailed documentation for configuring email is available here: 8 | # http://protegewiki.stanford.edu/wiki/WebProtegeAdminGuide#Configuring_email 9 | 10 | ############### OPTIONAL PROPERTIES ############### 11 | 12 | # Any property defined by the Java mailer in the SMTP package can be used in this file. 13 | 14 | # The Java SMTP properties are defined here: 15 | # https://javamail.java.net/nonav/docs/api/com/sun/mail/smtp/package-summary.html 16 | 17 | # For example, to configure the SMTP host use: 18 | #mail.smtp.host= 19 | #mail.smtp.auth= 20 | #mail.smtp.port= 21 | 22 | # In addition to the Java SMTP properties, there are two WebProtege specific properties 23 | # that can be used: mail.smtp.wp.password and mail.smtp.from.wp.personalName 24 | 25 | # If using authentication to send email, use the following property to set the SMTP password: 26 | #mail.smtp.wp.password=mySmtpPassword 27 | 28 | # To configure the "From" name from which the email will be sent, use the following property 29 | # (the default is the value of the application.name property set via webprotege.properties, 30 | # and whose default value is WebProtege): 31 | #mail.smtp.from.wp.personalName=myFromName 32 | 33 | # For example, if you are using a SMTP server with authentication, you are likely to set the following 34 | # properties: 35 | #mail.smtp.host=smtp.example.org 36 | #mail.smtp.auth=true 37 | #mail.smtp.user=mySmtpUser 38 | #mail.smtp.wp.password=mySmtpPassword 39 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM tomcat:8-alpine 2 | 3 | LABEL net.skyplabs.maintainer.name="Paul-Emmanuel Raoul" 4 | LABEL net.skyplabs.maintainer.email="skyper@skyplabs.net" 5 | LABEL version="2.0.0" 6 | 7 | ARG WEBPROTEGE_VERSION="3.0.0" 8 | ARG WEBPROTEGE_DATA_DIR=/srv/webprotege 9 | ARG WEBPROTEGE_LOG_DIR=/var/log/webprotege 10 | ARG WEBPROTEGE_DOWNLOAD_BASE_URL=https://github.com/protegeproject/webprotege/releases/download/v${WEBPROTEGE_VERSION} 11 | 12 | ENV webprotege.application.version=${WEBPROTEGE_VERSION} 13 | ENV webprotege.data.directory=${WEBPROTEGE_DATA_DIR} 14 | ENV JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8" 15 | 16 | WORKDIR ${CATALINA_HOME}/webapps 17 | 18 | RUN rm -rf ./* &&\ 19 | mkdir -p ${CATALINA_HOME}/webapps/ROOT &&\ 20 | mkdir -p ${WEBPROTEGE_DATA_DIR} &&\ 21 | mkdir -p ${WEBPROTEGE_LOG_DIR} &&\ 22 | mkdir -p /usr/local/share/java &&\ 23 | adduser -S -D -s /sbin/nologin -H -h /dev/null -g webprotege webprotege &&\ 24 | chown webprotege: ${WEBPROTEGE_DATA_DIR} &&\ 25 | chown webprotege: ${WEBPROTEGE_LOG_DIR} &&\ 26 | wget -q -O webprotege.war \ 27 | ${WEBPROTEGE_DOWNLOAD_BASE_URL}/webprotege-${WEBPROTEGE_VERSION}.war &&\ 28 | wget -q -O /usr/local/share/java/webprotege-cli \ 29 | ${WEBPROTEGE_DOWNLOAD_BASE_URL}/webprotege-${WEBPROTEGE_VERSION}-cli.jar &&\ 30 | unzip -q webprotege.war -d ROOT &&\ 31 | rm -f webprotege.war 32 | 33 | COPY config/webprotege.properties /etc/webprotege/webprotege.properties 34 | COPY config/mail.properties /etc/webprotege/mail.properties 35 | COPY scripts/webprotege-cli /usr/local/bin/webprotege-cli 36 | 37 | EXPOSE 8080 38 | VOLUME ${WEBPROTEGE_DATA_DIR} 39 | VOLUME ${WEBPROTEGE_LOG_DIR} 40 | 41 | USER webprotege 42 | 43 | CMD ["catalina.sh", "run"] 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WebProtégé 2 | 3 | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/168f293b92f64cf1a7a56cee6f914e3c)](https://www.codacy.com/app/skyper/webprotege-dockerfile?utm_source=github.com&utm_medium=referral&utm_content=SkypLabs/webprotege-dockerfile&utm_campaign=Badge_Grade) 4 | 5 | This image allows you to deploy [WebProtégé][webprotege] as a [microservice][microservice]. 6 | 7 | WebProtégé is a free, open-source ontology editor and framework for building intelligent systems. 8 | 9 | ## How to 10 | 11 | ### Create your container 12 | 13 | To start a new instance: 14 | 15 | docker run --name webprotege -d \ 16 | -v webprotege_data:/srv/webprotege \ 17 | -v webprotege_logs:/var/log/webprotege \ 18 | --link mongodb -p 8888:8080 \ 19 | skyplabs/webprotege 20 | 21 | The web application will be accessible from the host system on port `8888`. All the persistent data will be stored in two volumes managed by Docker and called respectively `webprotege_data` and `webprotege_logs`. `mongodb` must be the name of a [MongoDB][mongodb] docker container listening on port `27017`. 22 | 23 | To start a MongoDB instance using Docker (must be started before WebProtégé): 24 | 25 | docker run --name mongodb -d -v mongodb_data:/data/db mongo:3 26 | 27 | All the persistent data will be stored in a volume managed by Docker and called `mongodb_data`. 28 | 29 | To start the two containers using only one command, you can use [Docker Compose][docker-compose]: 30 | 31 | docker-compose up -d 32 | 33 | ### Create an admin account 34 | 35 | To bootstrap your new container with an admin account, you need to use the [WebProtégé Command Line Tool][webprotege-cli]. This Docker image embeds natively this tool. 36 | 37 | Once your new container up and running: 38 | 39 | docker exec -it webprotege-cli create-admin-account 40 | 41 | ### Finalise your installation 42 | 43 | After having signed in your new WebProtégé instance, you need to specify the host name and a couple of other parameters on the [settings page][webprotege-settings]. 44 | 45 | ## Customise the configuration 46 | 47 | You can customise the configuration of WebProtégé by injecting the [`webprotege.properties`][webprotege-properties] and/or [`mail.properties`][mail-properties] files into the container using the volume command. The files must be placed in `/etc/webprotege`. 48 | 49 | For example: 50 | 51 | export WP_CONFIG_DIR=/etc/webprotege 52 | docker run --name webprotege -d \ 53 | -v webprotege_data:/data/webprotege \ 54 | -v webprotege_logs:/var/log/webprotege \ 55 | -v $(pwd)/config/webprotege.properties:${WP_CONFIG_DIR}/webprotege.properties:ro \ 56 | -v $(pwd)/config/mail.properties:${WP_CONFIG_DIR}/mail.properties:ro \ 57 | --link mongodb -p 8888:8080 \ 58 | skyplabs/webprotege 59 | 60 | Note that `application.version` and `data.directory` are defined in `Dockerfile` as environment variables and will overwrite the values contained in `webprotege.properties`. However, you can change them at build-time via the arguments `WEBPROTEGE_VERSION` and `WEBPROTEGE_DATA_DIR`. 61 | 62 | For example: 63 | 64 | docker build -t webprotege --build-arg WEBPROTEGE_DATA_DIR=/data/webprotege . 65 | 66 | ## License 67 | 68 | [MIT][license] 69 | 70 | [docker-compose]: https://www.docker.com/products/docker-compose 71 | [license]: http://opensource.org/licenses/MIT 72 | [mail-properties]: config/mail.properties 73 | [microservice]: https://en.wikipedia.org/wiki/Microservices 74 | [mongodb]: https://www.mongodb.com/ 75 | [webprotege]: https://protegewiki.stanford.edu/wiki/WebProtege 76 | [webprotege-cli]: https://github.com/protegeproject/webprotege/wiki/WebProt%C3%A9g%C3%A9-3.0.0-Installation#bootstrap-webprot%C3%A9g%C3%A9-with-an-admin-account 77 | [webprotege-properties]: config/webprotege.properties 78 | [webprotege-settings]: https://github.com/protegeproject/webprotege/wiki/WebProt%C3%A9g%C3%A9-3.0.0-Installation#edit-the-webprot%C3%A9g%C3%A9-settings 79 | --------------------------------------------------------------------------------