-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d7522e
commit edddfdc
Showing
19 changed files
with
2,444 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
/*.sql | ||
/.data/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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:[email protected]) 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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# app specific setup here | ||
touch /var/www/html/application/logs/errors.log | ||
|
||
apache2-foreground |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.