From edddfdc2928ae391f03ff87b53bf74464ca0ee9e Mon Sep 17 00:00:00 2001 From: Andrew Gardener Date: Thu, 21 Mar 2024 14:09:40 -0700 Subject: [PATCH] Add docker --- .dockerignore | 3 + .github/workflows/deploy.yaml | 124 ++ .gitignore | 21 +- Dockerfile | 60 + README.md | 82 +- docker-compose.yaml | 60 + docker/docker-entrypoint.sh | 7 + docker/gcha.ini | 7 + docker/image-policy.xml | 99 ++ docker/mariadb/custom.cnf | 6 + docker/omeka/.htaccess | 72 ++ docker/omeka/application/config/config.ini | 325 +++++ docker/omeka/db.ini | 19 + docker/omeka/robots.txt | 2 + docker/solr/managed-schema.xml | 513 ++++++++ docker/solr/solrconfig.xml | 1061 +++++++++++++++++ .../forms/SolrSearch_Form_Results.php | 53 +- .../forms/SolrSearch_Form_Server.php | 11 - .../SolrSearch/views/shared/results/index.php | 4 +- 19 files changed, 2444 insertions(+), 85 deletions(-) create mode 100644 .dockerignore create mode 100644 .github/workflows/deploy.yaml create mode 100644 Dockerfile create mode 100644 docker-compose.yaml create mode 100755 docker/docker-entrypoint.sh create mode 100644 docker/gcha.ini create mode 100644 docker/image-policy.xml create mode 100644 docker/mariadb/custom.cnf create mode 100644 docker/omeka/.htaccess create mode 100644 docker/omeka/application/config/config.ini create mode 100644 docker/omeka/db.ini create mode 100644 docker/omeka/robots.txt create mode 100644 docker/solr/managed-schema.xml create mode 100644 docker/solr/solrconfig.xml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..57935f8a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.DS_Store +/*.sql +/.data/* \ No newline at end of file diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 00000000..ed928348 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,124 @@ +name: Deploy Image + +# based on: https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners + +on: + push: + tags: + - 'v*' + +env: + REGISTRY_IMAGE: dhilsfu/gcha + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + platform: + - linux/386 + - linux/amd64 + # - linux/arm/v5 + - linux/arm/v7 + - linux/arm64 + # - linux/mips64le + # - linux/ppc64le + # - linux/s390x + steps: + - name: Prepare + run: | + platform=${{ matrix.platform }} + echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV + + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY_IMAGE }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Build and push by digest + id: build + uses: docker/build-push-action@v5 + with: + context: . + platforms: ${{ matrix.platform }} + labels: ${{ steps.meta.outputs.labels }} + outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true + cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache-${{ env.PLATFORM_PAIR }} + cache-to: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache-${{ env.PLATFORM_PAIR }},mode=max + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ env.PLATFORM_PAIR }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + push: + runs-on: ubuntu-latest + needs: + - build + steps: + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: /tmp/digests + pattern: digests-* + merge-multiple: true + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY_IMAGE }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} + + - name: Trigger Gitlab Deploy Job + run: | + curl -X POST \ + --fail \ + -F token=${{ secrets.GITLAB_CI_TOKEN }} \ + -F "ref=main" \ + -F "variables[APP_RELEASE_TAG]=${{github.ref_name}}" \ + https://git.lib.sfu.ca/api/v4/projects/564/trigger/pipeline diff --git a/.gitignore b/.gitignore index 7844d97e..57935f8a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,3 @@ -db.ini - -/files/fullsize/* -!/files/fullsize/index.html - -/files/original/* -!/files/original/index.html - -/files/square_thumbnails/* -!/files/square_thumbnails/index.html - -/files/theme_uploads/* -!/files/theme_uploads/index.html - -/files/thumbnails/* -!/files/thumbnails/index.html -.idea -application/logs +.DS_Store +/*.sql +/.data/* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..5b17b419 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,60 @@ +FROM php:8.2-apache +WORKDIR /var/www/html + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + libzip-dev \ + libapache2-mod-xsendfile \ + netcat-traditional \ + git-core \ + apt-utils \ + unzip \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libmcrypt-dev \ + libpng-dev \ + libjpeg-dev \ + libmemcached-dev \ + zlib1g-dev \ + imagemagick \ + libmagickwand-dev \ + curl \ + ghostscript \ + poppler-utils \ + libsodium-dev \ + libicu-dev \ + libvips-tools \ + apt-utils \ + && cp "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \ + && a2enmod rewrite headers \ + && docker-php-ext-configure gd --with-jpeg=/usr/include/ --with-freetype=/usr/include/ \ + && docker-php-ext-configure intl \ + && docker-php-ext-install -j$(nproc) iconv pdo pdo_mysql mysqli gd intl \ + && pecl install imagick mcrypt \ + && docker-php-ext-enable imagick mcrypt \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Add the Omeka PHP code +# Latest Omeka version, check: https://omeka.org/s/download/ +ENV OMEKA_VERSION 3.1.2 +RUN curl -L "https://github.com/omeka/Omeka/releases/download/v${OMEKA_VERSION}/omeka-${OMEKA_VERSION}.zip" -o /var/www/omeka-${OMEKA_VERSION}.zip \ + && unzip /var/www/omeka-${OMEKA_VERSION}.zip -d /var/www/ \ + && rm -Rf /var/www/omeka-${OMEKA_VERSION}.zip /var/www/html \ + && mv /var/www/omeka-${OMEKA_VERSION}/ /var/www/html + +# default service settings +COPY docker/docker-entrypoint.sh /docker-entrypoint.sh +COPY docker/gcha.ini /usr/local/etc/php/conf.d/gcha.ini +COPY docker/image-policy.xml /etc/ImageMagick-6/policy.xml + +# omeka settings +COPY --chown=www-data:www-data --chmod=771 docker/omeka/db.ini docker/omeka/robots.txt docker/omeka/.htaccess /var/www/html/ +COPY --chown=www-data:www-data --chmod=771 docker/omeka/application/config/config.ini /var/www/html/application/config/config.ini +COPY --chown=www-data:www-data --chmod=771 themes /var/www/html/themes/ +COPY --chown=www-data:www-data --chmod=771 plugins /var/www/html/plugins/ + +RUN chown www-data:www-data -R themes/ plugins/ \ + && chmod 771 -R themes/ plugins/ + +CMD ["/docker-entrypoint.sh"] \ No newline at end of file diff --git a/README.md b/README.md index 05f3694c..a31a2b03 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,68 @@ -# Welcome to Omeka +# Grassroots Chinese History Archive -© 2008-2016 [Roy Rosenzweig Center for History and New Media](http://chnm.gmu.edu/), 2016-present [Corporation for Digital Scholarship](http://digitalscholar.org/) +The Grassroots Chinese History Archive (GCHA) aims to facilitate research by scholars worldwide in modern Chinese history, with a focus on the social, political, and cultural history of China's 1950s, 1960s, and 1970s. -This program is free software: you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation, either version 3 of the License, or (at your option) any later -version. +## Requirements -This program is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. See the GNU General Public License for more details. +- [Docker Desktop](https://www.docker.com/products/docker-desktop/) +- A copy of the `omeka.sql` database sql file. If you are not sure what these are or where to get them, you should contact the [Digital Humanities Innovation Lab](mailto:dhil@sfu.ca) for access. This file should be placed in the root folder. +- A copy of the data files. These should be placed directly into the `.data/app/files` directory (start the application for the first time if you don't see the data directory). -You should have received a copy of the GNU General Public License along with -this program. If not, see [http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). +## Initialize the Application -Omeka includes: +First you must setup the database for the first time -* [Zend Framework](http://framework.zend.com) -* [getID3](http://getid3.sourceforge.net) -* [jQuery](http://jquery.com) -* [jQuery UI](http://jqueryui.com) -* [TinyMCE](http://tinymce.moxiecode.com) -* [Silk Icons](http://www.famfamfam.com/lab/icons/silk/) + docker compose up -d db + # wait 30 after the command has fully completed + docker exec -it gcha_db bash -c "mysql -u gcha -ppassword gcha < /omeka.sql" -Use and modifications of these libraries must comply with their respective -licenses. +Next you must start the whole application -Release notes for Omeka are available at -[http://omeka.org/codex/Release_Notes](http://omeka.org/codex/Release_Notes). + docker compose up -d --build + +GCHA will now be available at `http://localhost:8080/` + +## General Usage + +### Starting the Application + + docker compose up -d + +### Stopping the Application + + docker compose down + +### Rebuilding the Application (after upstream or js/php package changes) + + docker compose up -d --build + +### Viewing logs (each container) + + docker logs -f gcha_app + docker logs -f gcha_db + docker logs -f gcha_solr + docker logs -f gcha_mail + +### Accessing the Application + + http://localhost:8080/ + +### Accessing Solr admin console + + http://localhost:8983/ + +### Accessing the Database + +Command line: + + docker exec -it gcha_db mysql -u gcha -ppassword gcha + +Through a database management tool: +- Host:`127.0.0.1` +- Port: `13306` +- Username: `gcha` +- Password: `password` + +### Accessing Mailhog (catches emails sent by the app) + + http://localhost:8025/ diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..5f544048 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,60 @@ +version: '3.8' +services: + db: + container_name: gcha_db + image: mariadb:10.11 + ports: + - "13306:3306" + volumes: + - .data/mariadb:/var/lib/mysql + - ./docker/mariadb/custom.cnf:/etc/mysql/conf.d/custom.cnf + environment: + MARIADB_ROOT_PASSWORD: root + MARIADB_DATABASE: gcha + MARIADB_USER: gcha + MARIADB_PASSWORD: password + healthcheck: + test: mysql gcha -u gcha -ppassword -e 'SELECT 1;' || exit 1 + interval: 2s + retries: 120 + + solr: + container_name: gcha_solr + image: solr:9.5 + command: solr-precreate omeka + ports: + - "8983:8983" + volumes: + # overwrite default configset (managed-schema.xml & solrconfig.xml) + - ./docker/solr/managed-schema.xml:/opt/solr/server/solr/configsets/_default/conf/managed-schema.xml + - ./docker/solr/solrconfig.xml:/opt/solr/server/solr/configsets/_default/conf/solrconfig.xml + # persist data + - .data/solr:/var/solr + environment: + - SOLR_HEAP=500m + + app: + container_name: gcha_app + build: + context: . + ports: + - "8080:80" + volumes: + # In prod remember to customize/override: (disable development mode) + # - application/config/config.ini + # - .htaccess + # code for development + - ./themes:/var/www/html/themes + - ./plugins:/var/www/html/plugins + # persist file uploads & logs + - .data/app/files:/var/www/html/files + - .data/app/log:/var/www/html/application/logs + depends_on: + db: + condition: service_healthy + + mail: + container_name: gcha_mail + image: jcalonso/mailhog:v1.0.1 + ports: + - "8025:8025" \ No newline at end of file diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh new file mode 100755 index 00000000..10f85f2c --- /dev/null +++ b/docker/docker-entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e + +# app specific setup here +touch /var/www/html/application/logs/errors.log + +apache2-foreground \ No newline at end of file diff --git a/docker/gcha.ini b/docker/gcha.ini new file mode 100644 index 00000000..737240d2 --- /dev/null +++ b/docker/gcha.ini @@ -0,0 +1,7 @@ +[PHP] +memory_limit=256M +html_errors=On +post_max_size=256M +upload_max_filesize=256M +date.timezone=America/Vancouver +error_log = /var/www/html/application/logs/errors.log \ No newline at end of file diff --git a/docker/image-policy.xml b/docker/image-policy.xml new file mode 100644 index 00000000..3799ca8e --- /dev/null +++ b/docker/image-policy.xml @@ -0,0 +1,99 @@ + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docker/mariadb/custom.cnf b/docker/mariadb/custom.cnf new file mode 100644 index 00000000..2f93738e --- /dev/null +++ b/docker/mariadb/custom.cnf @@ -0,0 +1,6 @@ +[mysqld] +lower_case_table_names = 1 +sql_mode = "STRICT_ALL_TABLES,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION" +character-set-server = utf8 +collation-server = utf8_unicode_ci +general_log = 1 \ No newline at end of file diff --git a/docker/omeka/.htaccess b/docker/omeka/.htaccess new file mode 100644 index 00000000..58de5ca8 --- /dev/null +++ b/docker/omeka/.htaccess @@ -0,0 +1,72 @@ +# Omeka .htaccess: Apache configuration file +# This file is required for Omeka to function correctly. + +# --------------- # +# Error Reporting # +# --------------- # + +# Uncomment the SetEnv line below to turn on detailed on-screen error +# reporting. +# +# Note: This should only be enabled for development or debugging. Keep this +# line commented for production sites. +# +SetEnv APPLICATION_ENV development + +# ------------- # +# Rewrite Rules # +# ------------- # + +RewriteEngine on + +# If you know mod_rewrite is enabled, but you are still getting mod_rewrite +# errors, uncomment the line below and replace "/" with your base directory. +# +# RewriteBase / + +# Allow direct access to files (except PHP files) +RewriteCond %{REQUEST_FILENAME} -f +RewriteRule !\.(php[0-9]?|phtml|phps)$ - [C] +RewriteRule .* - [L] + +RewriteRule ^install/.*$ install/install.php [L] +RewriteRule ^admin/.*$ admin/index.php [L] +RewriteRule .* index.php + +# -------------- # +# Access Control # +# -------------- # + +# Block access to all .ini files. + + + Require all denied + + + Order Allow,Deny + Deny from all + + + +# --------# +# Caching # +# --------# + +# Uncomment the lines below in order to enable caching of some files +# (after a finished site has gone live) +# +# +# +# ExpiresActive on +# ExpiresDefault "access plus 10 day" +# +# + +# ------------ # +# PHP Settings # +# ------------ # + + + php_flag register_globals off + php_flag magic_quotes_gpc off + diff --git a/docker/omeka/application/config/config.ini b/docker/omeka/application/config/config.ini new file mode 100644 index 00000000..0b2e4b06 --- /dev/null +++ b/docker/omeka/application/config/config.ini @@ -0,0 +1,325 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Site Configuration File ; +;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +; Lower-level settings for Omeka are defined here. +; +; The default settings should be correct for most Omeka users, but some +; setups may require some changes. People who are developing for or +; debugging Omeka may also change some of these settings. + +[site] + +;;;;;;;;;;;;;;;; +; Localization ; +;;;;;;;;;;;;;;;; + +; locale.name +; The locale identifier used for translating and displaying Omeka. +; default: none +; +; The locale controls what language Omeka will be displayed in, and +; also how dates and other locale-sensitive data will be displayed. +; +; The locale identifier should be a valid ISO 639 language code, +; and optionally a valid ISO 3166-1 locale code. +; (Examples: "es" for Spanish, "en_US" for US English.) +; +; To enable translations, the identifier must also have a +; corresponding .mo file in the application/languages directory. + +locale.name = "" + +;;;;;;;;;;;;; +; Debugging ; +;;;;;;;;;;;;; + +; debug.exceptions +; Throw exceptions for bad URLs. +; default: false +; +; This should only be enabled when debugging or developing for Omeka. +;debug.exceptions = false +debug.exceptions = true + +; debug.request +; Dump data about each web request to the browser. +; default: false +; +; The request data shows what routes and variables Omeka has parsed from +; each request. +debug.request = false + +; debug.profileDb +; Enable the query profiler. +; default: false +; +; This will show metadata about the queries that were executed during +; each request. +debug.profileDb = false + +; debug.email +; Send all log messages to an email address. +; default: "" +; +; Anything that would be logged will also be emailed to this address. +; If left blank, this feature is disabled. +debug.email = "" + +; debug.emailLogPriority +; Apply a priority filter to emailed log messages. +; default: Zend_Log::ERR +; +; If an address has been set for debug.email, this setting filters the +; messages to only those of the given priority or higher. +debug.emailLogPriority = Zend_Log::ERR + +;;;;;;;;;;; +; Logging ; +;;;;;;;;;;; + +; log.errors +; Log errors and other information. +; default: false +; +; Errors, exceptions, and other messages will be logged to +; application/logs/errors.log (this file must be writable by the web +; server if logging is enabled). +; log.errors = false +log.errors = true + +; log.priority +; The minimum priority level of messages that should be logged. +; When developing/debugging, use Zend_Log::DEBUG for debug() to work. This will record everything. +; default: Zend_Log::WARN (Logs warnings and above) +log.priority = Zend_Log::WARN + +; log.sql +; Log SQL statements. +; default: false +; +; All SQL statements executed by Omeka will be included in Omeka's +; error log. +log.sql = false + +;;;;;;;;;;;; +; Sessions ; +;;;;;;;;;;;; +; +; Omeka uses Zend Framework's session handling. A full list of +; available session configuration options can be found here: +; https://framework.zend.com/manual/1.12/en/zend.session.global_session_management.html +; +; Some options that are often useful for Omeka sites are included here. + +; session.name +; Sets the name used for the Omeka session cookie. +; default: "" +; +; If left blank, Omeka will automatically select a unique session name. +session.name = "" + +; session.saveHandler +; Determines how session data will be saved. +; default: no setting (uses the database for saving session data) +; +; Sessions are now stored in the database by default. To revert to the +; older method of storing session data in the filesystem, uncomment the +; following line. +; session.saveHandler = "" + +;;;;;;;;; +; Theme ; +;;;;;;;;; + +; theme.useInternalAssets +; Whether Omeka should use locally-stored asset files. +; default: false +; +; Omeka includes some asset files from external sources, such as Google by +; default. Set this to true if the Omeka installation does not have +; web access, and Omeka will instead serve local copies of these files. +theme.useInternalAssets = false + +;;;;;;;;;;;;;;;;;;;;;; +; Background Scripts ; +;;;;;;;;;;;;;;;;;;;;;; + +; background.php.path +; Path to PHP-CLI for running background processes. +; default: "" +; +; If left blank, Omeka will try to autodetect the right path. Set this +; to override the autodetected PHP path. +background.php.path = "/usr/local/bin/php" + +; jobs.dispatcher +; How Omeka "jobs" will be executed. +; default: "Omeka_Job_Dispatcher_Adapter_Synchronous" +; +; Newer Omeka features and plugins use this setting to determine how +; long-running jobs will be run. +; +; The default setting should work for all installations, but may +; time out for longer jobs. On systems where the older PHP background +; processes worked, the BackgroundProcess adapter can be used instead +; of the Synchronous one. +jobs.dispatcher.default = "Omeka_Job_Dispatcher_Adapter_Synchronous" +jobs.dispatcher.longRunning = "Omeka_Job_Dispatcher_Adapter_BackgroundProcess" + +;;;;;;;; +; Mail ; +;;;;;;;; +; +; For more info, see Zend Framework documentation on Zend_Mail: +; http://framework.zend.com/manual/en/zend.mail.html + +; mail.transport.type +; The system Omeka will use to send email messages. +; default: "Sendmail" +; +; The default is to send mail using PHP's built-in mail() function. +; mail.transport.type = "Sendmail" + +; Uncomment some of the following lines (and comment the above line) +; to switch to SMTP for sending mail through Omeka. Your configuration +; may not require all of the options listed. +; +mail.transport.type = "Smtp" +mail.transport.host = "mail" +mail.transport.port = 1025 ; Port number, if applicable. +; mail.transport.name = "" ; Local client hostname, e.g. "localhost" +; mail.transport.auth = "login" ; For authentication, if required. +; mail.transport.username = "" +; mail.transport.password = "" +; mail.transport.ssl = "" ; For SSL support, set to "ssl" or "tls" + +; mail.force_from +; Force all outgoing emails to have the configured From address +; mail.force_from = "" + +; mail.force_from_name +; If mail.force_from is set, use the configured friendly name in From +; mail.force_from_name = "" + +;;;;;;;;;;; +; Storage ; +;;;;;;;;;;; + +; Sample S3 cloud storage configuration +; +; The accessKeyId, secretAccessKey, and bucket options are all required. +; If the expiration option is set, files will be uploaded with "private" +; access, and Omeka will generate URLs that are only valid for a limited +; time. If the expiration option is missing or left commented out, +; uploaded files will always be publicly readable. Leave the forceSSL +; option commented out unless site is served over HTTPS-only *and* the +; the web browser is issuing mixed-content warnings. +; +; storage.adapter = "Omeka_Storage_Adapter_ZendS3" +; storage.adapterOptions.accessKeyId = +; storage.adapterOptions.secretAccessKey = +; storage.adapterOptions.bucket = +; storage.adapterOptions.expiration = 10 ; URL expiration time (in minutes) +; storage.adapterOptions.endpoint = ; Custom S3 endpoint (optional) +; storage.adapterOptions.forceSSL = 1 ; Boolean value (optional) + +;;;;;;;;;;;; +; Security ; +;;;;;;;;;;;; + +; ssl +; Secure Socket Layer support for Omeka. +; default: none +; +; Ensure that your server is properly configured before enabling this +; setting. Choose one of the following: +; +; "logins" +; Force SSL for login forms and login form submissions. +; +; "sessions" +; Force SSL for all authenticated users to protect sessions. Includes +; login forms. +; +; "always" +; Force SSL on across the entire site. +; +; ssl = "always" + + +; sslTrustProxy +; Whether the "ssl" setting should respect X-Forwarded-Proto headers. +; default: false +; +; This only has an effect if the "ssl" setting is enabled. +; Setting to true will cause Omeka to treat requests with the X-Fowarded-Proto +; header set to "https" as secure (meaning they won't be redirected). +; +; sslTrustProxy = true + +;;;;;;;;;; +; Upload ; +;;;;;;;;;; + +; upload.maxFileSize +; Set the maximum file upload size. +; default: 10M +; +; Uncomment the following line to set the maximum file upload size. This +; configuration will not exceed the maximum beyond what is set in the +; 'post_max_size' or 'upload_max_filesize' core php.ini directives. +; +;upload.maxFileSize = "10M" + +;;;;;;;;;;;;;;;;;;;;; +; Derivative Images ; +;;;;;;;;;;;;;;;;;;;;; + +; fileDerivatives.strategy +; Controls what method Omeka uses to create derivative images. +; default: Omeka_File_Derivative_Strategy_ExternalImageMagick +; +; The built-in strategies are ExternalImageMagick (the old default), Imagick +; (requires PECL ext/imagick), and GD (generally installed by default with PHP, +; but handles fewer formats). Others can be added by plugins. +; +;fileDerivatives.strategy = "Omeka_File_Derivative_Strategy_ExternalImageMagick" + +; fileDerivatives.strategyOptions +; Specific settings for the configured derivative strategy. +; +; Subkeys to this entry specify each option. +; +; fileDerivatives.strategyOptions.page = "0" +; fileDerivatives.strategyOptions.gravity = "center" +; fileDerivatives.strategyOptions.autoOrient = true + +; fileDerivatives.typeWhitelist[] +; If set, Omeka will only attempt to create derivatives for files with the +; given MIME types. +; +; This entry can be specified multiple times, once for each type in the list. +; +;fileDerivatives.typeWhitelist[] = "image/jpeg" + +; fileDerivatives.typeBlacklist[] +; If set, Omeka will not attempt to create derivatives for files with the +; given MIME types. +; +; Both this blacklist and the whitelist can be set at the same time, but the +; whitelist will control. +; +; This entry can be specified multiple times, once for each type in the list. +; +;fileDerivatives.typeBlacklist[] = "image/jpeg" + +;;;;;;;;;;; +; Updates ; +;;;;;;;;;;; +; +; versionNotifications +; Whether Omeka should prompt admin users about updates to plugins and themes +; default: true +; +; versionNotifications = false diff --git a/docker/omeka/db.ini b/docker/omeka/db.ini new file mode 100644 index 00000000..f55fd09c --- /dev/null +++ b/docker/omeka/db.ini @@ -0,0 +1,19 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Database Configuration File ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +; Omeka requires MySQL 5 or newer. +; +; To configure your database, replace the X's with your specific +; settings. If you're unsure about your database information, ask +; your server administrator, or consult the documentation at +; . + +[database] +host = "db" +username = "gcha" +password = "password" +dbname = "gcha" +prefix = "" +charset = "utf8" +port = "3306" diff --git a/docker/omeka/robots.txt b/docker/omeka/robots.txt new file mode 100644 index 00000000..5b818e00 --- /dev/null +++ b/docker/omeka/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: /files/ diff --git a/docker/solr/managed-schema.xml b/docker/solr/managed-schema.xml new file mode 100644 index 00000000..9a07c6fc --- /dev/null +++ b/docker/solr/managed-schema.xml @@ -0,0 +1,513 @@ + + + + id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docker/solr/solrconfig.xml b/docker/solr/solrconfig.xml new file mode 100644 index 00000000..bab4f8e2 --- /dev/null +++ b/docker/solr/solrconfig.xml @@ -0,0 +1,1061 @@ + + + + + + + + + 9.9 + + + + + + + + + + + + + + ${solr.data.dir:} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${solr.lock.type:native} + + + + + + + + + + + + + + + + + + + + + ${solr.ulog.dir:} + ${solr.ulog.numVersionBuckets:65536} + + + + + ${solr.autoCommit.maxTime:15000} + false + + + + + + ${solr.autoSoftCommit.maxTime:3000} + + + + + + + + + + + + + + ${solr.max.booleanClauses:1024} + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + 20 + + + 200 + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + explicit + 10 + + + + + + + explicit + json + true + + + + + + + _text_ + + + + + + + text_general + + + + + + default + _text_ + solr.DirectSolrSpellChecker + + internal + + 0.5 + + 2 + + 1 + + 5 + + 4 + + 0.01 + + + + + + + + + + + + default + on + true + 10 + 5 + 5 + true + true + 10 + 5 + + + spellcheck + + + + + + + + + + + + 100 + + + + + + + + 70 + + 0.5 + + [-\w ,/\n\"']{20,200} + + + + + + + ]]> + ]]> + + + + + + + + + + + + + + + + + + + + + + + + ,, + ,, + ,, + ,, + ,]]> + ]]> + + + + + + 10 + .,!? + + + + + + + WORD + + + en + US + + + + + + + + + + + + [^\w-\.] + _ + + + + + + + yyyy-MM-dd['T'[HH:mm[:ss[.SSS]][z + yyyy-MM-dd['T'[HH:mm[:ss[,SSS]][z + yyyy-MM-dd HH:mm[:ss[.SSS]][z + yyyy-MM-dd HH:mm[:ss[,SSS]][z + [EEE, ]dd MMM yyyy HH:mm[:ss] z + EEEE, dd-MMM-yy HH:mm:ss z + EEE MMM ppd HH:mm:ss [z ]yyyy + + + + + java.lang.String + text_general + + *_str + 256 + + + true + + + java.lang.Boolean + booleans + + + java.util.Date + pdates + + + java.lang.Long + java.lang.Integer + plongs + + + java.lang.Number + pdoubles + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/SolrSearch/forms/SolrSearch_Form_Results.php b/plugins/SolrSearch/forms/SolrSearch_Form_Results.php index 34906a64..93242f92 100755 --- a/plugins/SolrSearch/forms/SolrSearch_Form_Results.php +++ b/plugins/SolrSearch/forms/SolrSearch_Form_Results.php @@ -20,6 +20,26 @@ public function init() parent::init(); + // Max Analyzed Chars + $this->addElement('text', 'solr_search_hl_max_analyzed_chars', array( + 'label' => __('Extent of Document Highlightable'), + 'description' => __('How much of the document can be highlighted, in characters. Occurrences past this point will not be returned in the results highlighting.'), + 'value' => get_option('solr_search_hl_max_analyzed_chars'), + 'required' => true, + 'size' => 10, + 'validators' => array( + array( + 'validator' => 'Int', + 'breakChainOnFailure' => true, + 'options' => array( + 'messages' => array( + Zend_Validate_Int::NOT_INT => __('Must be an integer.') + ) + ) + ) + ) + )); + // Enable Highlighting: $this->addElement('checkbox', 'solr_search_hl', array( 'label' => __('Enable Highlighting'), @@ -63,26 +83,6 @@ public function init() ) )); - // Max Analyzed Chars - $this->addElement('text', 'solr_search_hl_max_analyzed_chars', array( - 'label' => __('Extent of Document Highlightable'), - 'description' => __('How much of the document can be highlighted, in characters. Occurrences past this point will not be returned in the results highlighting.'), - 'value' => get_option('solr_search_hl_max_analyzed_chars'), - 'required' => true, - 'size' => 10, - 'validators' => array( - array( - 'validator' => 'Int', - 'breakChainOnFailure' => true, - 'options' => array( - 'messages' => array( - Zend_Validate_Int::NOT_INT => __('Must be an integer.') - ) - ) - ) - ) - )); - // Facet Ordering: $this->addElement('select', 'solr_search_facet_sort', array( 'label' => __('Facet Ordering'), @@ -122,19 +122,6 @@ public function init() 'label' => __('Save Settings') )); - $this->addDisplayGroup(array( - 'solr_search_hl', - 'solr_search_hl_snippets', - 'solr_search_hl_fragsize', - 'solr_search_facet_sort', - 'solr_search_facet_limit', - 'solr_search_display_private_items' - ), 'fields'); - - $this->addDisplayGroup(array( - 'submit' - ), 'submit_button'); - } diff --git a/plugins/SolrSearch/forms/SolrSearch_Form_Server.php b/plugins/SolrSearch/forms/SolrSearch_Form_Server.php index a610d803..54ddb575 100755 --- a/plugins/SolrSearch/forms/SolrSearch_Form_Server.php +++ b/plugins/SolrSearch/forms/SolrSearch_Form_Server.php @@ -70,17 +70,6 @@ public function init() $this->addElement('submit', 'submit', array( 'label' => __('Save Settings') )); - - $this->addDisplayGroup(array( - 'solr_search_host', - 'solr_search_port', - 'solr_search_core' - ), 'fields'); - - $this->addDisplayGroup(array( - 'submit' - ), 'submit_button'); - } diff --git a/plugins/SolrSearch/views/shared/results/index.php b/plugins/SolrSearch/views/shared/results/index.php index 775310d4..24d0c35c 100755 --- a/plugins/SolrSearch/views/shared/results/index.php +++ b/plugins/SolrSearch/views/shared/results/index.php @@ -134,7 +134,9 @@
    highlighting->{$doc->id} as $field): ?> -
  • '); ?>
  • + +
  • '); ?>
  • +