From 9f5811be9513f24a708bfb15e8e14a6f99cc6e02 Mon Sep 17 00:00:00 2001 From: denseflux Date: Tue, 12 Dec 2023 15:04:12 +0000 Subject: [PATCH 01/10] Create static.yml --- .github/workflows/static.yml | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/static.yml diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml new file mode 100644 index 0000000..c99e130 --- /dev/null +++ b/.github/workflows/static.yml @@ -0,0 +1,43 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Deploy static content to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Pages + uses: actions/configure-pages@v4 + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + # Upload entire repository + path: '.' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v3 From 110f97e53691c254aa809372e391e7d5ca869290 Mon Sep 17 00:00:00 2001 From: denseflux Date: Tue, 12 Dec 2023 15:04:46 +0000 Subject: [PATCH 02/10] Update static.yml --- .github/workflows/static.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index c99e130..fdc534e 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -4,7 +4,7 @@ name: Deploy static content to Pages on: # Runs on pushes targeting the default branch push: - branches: ["main"] + branches: ["static"] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -37,7 +37,7 @@ jobs: uses: actions/upload-pages-artifact@v2 with: # Upload entire repository - path: '.' + path: 'build/static/' - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v3 From a6adedd04e2c1cf1e3e551f7e03e85f749a4a700 Mon Sep 17 00:00:00 2001 From: denseflux Date: Tue, 12 Dec 2023 15:11:26 +0000 Subject: [PATCH 03/10] Update static.yml --- .github/workflows/static.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index fdc534e..7749cee 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -31,13 +31,15 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + ref: 'static' - name: Setup Pages uses: actions/configure-pages@v4 - name: Upload artifact uses: actions/upload-pages-artifact@v2 with: # Upload entire repository - path: 'build/static/' + path: 'build/static' - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v3 From 8f886d8fcb9aaa3036a4945b5c749d1835c4e594 Mon Sep 17 00:00:00 2001 From: denseflux Date: Tue, 12 Dec 2023 15:14:18 +0000 Subject: [PATCH 04/10] Update static.yml --- .github/workflows/static.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 7749cee..f88ee28 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -32,7 +32,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - ref: 'static' + ref: static - name: Setup Pages uses: actions/configure-pages@v4 - name: Upload artifact From d7671bd031a2f84be4b2602ec273f5c9696cb6cb Mon Sep 17 00:00:00 2001 From: denseflux Date: Wed, 20 Dec 2023 21:22:16 +0000 Subject: [PATCH 05/10] update .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index b4dcc5b..2aaf14d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ build docker-compose-variables.env container_database vendor +scripts +db \ No newline at end of file From 7fcbe0b0bd51326772d0d19503773a94a0d5ef3f Mon Sep 17 00:00:00 2001 From: denseflux Date: Wed, 20 Dec 2023 21:22:27 +0000 Subject: [PATCH 06/10] add static --- docker-compose.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 17e9e95..04f6d31 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,4 +37,9 @@ services: "-c", "chmod -R 777 /var/www/html/&& cd /var/www && scripts/build-and-deploy.sh -b test && apache2-foreground" ] - + static: + image: httpd + volumes: + - ./build/static:/usr/local/apache2/htdocs:rw + ports: + - "3000:80" From f7ec8d951142a9657c65a3ae4d5b5e729f130006 Mon Sep 17 00:00:00 2001 From: denseflux Date: Wed, 20 Dec 2023 21:22:44 +0000 Subject: [PATCH 07/10] add scripts --- scripts.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) mode change 100644 => 100755 scripts.sh diff --git a/scripts.sh b/scripts.sh old mode 100644 new mode 100755 index 9d8cbf6..3c14f3a --- a/scripts.sh +++ b/scripts.sh @@ -49,10 +49,18 @@ Help() echo } -while getopts 'hb' flag; do +getVersion(){ + url="https://github.com/digihum/omeka-project-scripts/archive/refs/tags/v${VERSION}.zip" + message="Downloaded specific scripts version v${VERSION}" +} + +url="https://github.com/digihum/omeka-project-scripts/releases/latest/download/latest.zip" + message="Downloaded latest scripts version" + +while getopts 'hvb' flag; do case "${flag}" in h) Help ;; - v) GetVersion ;; + v) getVersion ;; *) error "Unexpected option ${flag}" ;; esac done @@ -61,12 +69,6 @@ done CheckRequirements -url="https://github.com/digihum/omeka-project-scripts/archive/refs/tags/v0.1.zip" - message="Downloaded latest scripts version" -getVersion(){ - url="https://github.com/digihum/omeka-project-scripts/archive/refs/tags/v${VERSION}.zip" - message="Downloaded specific scripts version v${VERSION}" -} rm -r scripts wget $url -O scripts.zip From 49243ab785e55fbffd2592838bfbaa0091354e06 Mon Sep 17 00:00:00 2001 From: denseflux Date: Wed, 20 Dec 2023 21:23:26 +0000 Subject: [PATCH 08/10] add composer no dev --- docker-compose-variables.env.template | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose-variables.env.template b/docker-compose-variables.env.template index e7c78b0..70081f9 100644 --- a/docker-compose-variables.env.template +++ b/docker-compose-variables.env.template @@ -6,3 +6,4 @@ MYSQL_PREFIX=omeka_ MYSQL_HOST=db ENV=test COMPOSER_AUTH={"gitlab-token":{"actechlab.warwick.ac.uk":"TOKEN"}} +COMPOSER_NO_DEV=0 \ No newline at end of file From 5e12b771f19f2092c770c865ccf3fa764059a387 Mon Sep 17 00:00:00 2001 From: denseflux Date: Wed, 20 Dec 2023 21:23:32 +0000 Subject: [PATCH 09/10] add readme --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b248b87..9d19ca4 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,16 @@ -# Omeka Classic - Platform +# Omeka Project Mapping Womens Suffrage -This repository is a template for Omeka Classic projects forked from the version created for Omeka S by James Tripp. Here you will find files enabling you to run a local instance and files used in our CI/CD pipelines to build automatically build a remote installation. +This repository holds the project files for the map.mappingwomenssuffrage.org.uk omeka system. -## Project Details +## Run in Codespaces + +1. Create a codespace on the `main` branch +2. Upload a copy of the database as a mysqldump sql file to `/db/` +3. Copy `docker-compose-variables.env.template` to `docker-compose-variables.env`. It's recommended to leave these values but if there is a need to access any repository hosted on a private gitlab instance, a [GitLab deploy key](https://docs.gitlab.com/ee/user/project/deploy_keys/) must be generated. +4. Run scripts.sh, which will need to be made executable using `chmod +x scripts.sh` followed by `./scripts.sh`. This will download the latest version of a series of scripts under a `scripts folder`. These are automation scripts used to build the application on Codespaces. +5. Install the Docker extension in this codespace. +6. Run `docker-compose up` (or right-click on `docker-compose.yml` and select the appropriate option). -RSE: [RSE NAME] -Project contact: [CONTACT NAME] -Teams File Location: [Add link here] ## Local Development From 7d4a189e5373f2336420986af720985c78a598e3 Mon Sep 17 00:00:00 2001 From: denseflux Date: Wed, 20 Dec 2023 21:32:51 +0000 Subject: [PATCH 10/10] changes --- .gitignore | 1 + README.md | 98 +----------------------------------------------------- 2 files changed, 2 insertions(+), 97 deletions(-) diff --git a/.gitignore b/.gitignore index 2aaf14d..4a78256 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ config/packages .viminfo config/composer.lock build +!build/static docker-compose-variables.env container_database vendor diff --git a/README.md b/README.md index 9d19ca4..ceae37a 100644 --- a/README.md +++ b/README.md @@ -1,97 +1 @@ -# Omeka Project Mapping Womens Suffrage - -This repository holds the project files for the map.mappingwomenssuffrage.org.uk omeka system. - -## Run in Codespaces - -1. Create a codespace on the `main` branch -2. Upload a copy of the database as a mysqldump sql file to `/db/` -3. Copy `docker-compose-variables.env.template` to `docker-compose-variables.env`. It's recommended to leave these values but if there is a need to access any repository hosted on a private gitlab instance, a [GitLab deploy key](https://docs.gitlab.com/ee/user/project/deploy_keys/) must be generated. -4. Run scripts.sh, which will need to be made executable using `chmod +x scripts.sh` followed by `./scripts.sh`. This will download the latest version of a series of scripts under a `scripts folder`. These are automation scripts used to build the application on Codespaces. -5. Install the Docker extension in this codespace. -6. Run `docker-compose up` (or right-click on `docker-compose.yml` and select the appropriate option). - - -## Local Development - -0. We assume you have docker-compose, docker and composer installed in WSL2. There are scripts available for this [here](https://actechlab.warwick.ac.uk/digital-humanities/wsl-dev-environment). - -1. Edit the config/project-configuration.yml file to set your environment. The different environment configurations are outlined in [this document](https://livewarwickac.sharepoint.com/:x:/r/sites/TEAMDigitalHumanities/Shared%20Documents/Service%20Improvement%20Projects/Omeka%20S%20Service/Omeka%20S%20Data%20and%20Environments.xlsx?d=w799d795897b84e8087018fe14d998801&csf=1&web=1&e=MQugGc). -2. Ensure that any data you need to load into the database is in a single .sql file and is located at db/omeka.sql. The database container will import these files when built. Import errors may not be shown in the Docker output so please do make sure the data is correct. -3. Modify the composer.json file to specify the plugins, theme and Omeka version used in your project. Ensure that packages are defined, version and location of the file should be included. A common issue is for the installer-name to not match the name of the Plugin.php which means it will not be detected as a valid plugin. Where there are multiple versions of the same package, it's important that the versions are in reverse order (highest at the top). The below shows the entries for the Ldap plugin: - -```json - { - "type": "package", - "package": { - "name": "bgsu-lits/ldap", - "version": "0.4.0", - "type": "omeka-plugin", - "source": { - "url": "https://github.com/BGSU-LITS/LDAP-Plugin.git", - "type": "git", - "reference": "0.4.0" - }, - "extra": { - "installer-name": "Ldap" - } - } - - }, -``` - -4. In the composer file, ensure your dependencies are required in the require section of the JSON file as shown in the example below. The Omeka S version should also be included. - -```json - "require": { - "omeka/omeka": "3.1.1", - "bgsu-lits/ldap": "0.4.0" - } -``` - -5. There is now enough specification that you can build the docker local install. To start the local development run the build-and-deploy.sh script with the variable "test". - -```bash -chmod +x scripts/build-and-deploy.sh -scripts/build-and-deploy.sh -b test -``` - -At the moment, only the test environment is implemented. - -This script will do the following: - -* create the omeka S filesystem in /build/html -* create the environment configuration files (currently build/html/.htaccess, build/html/config/database.ini, build/html/config/local.config.php) -* starts docker compose -* imports the database dump in db/omeka.sql into the database - -**Note** Please wait until the database has imported all the data and shows that 'mysqld: ready for connects.' like the below. - -```sh -db_1 | 2022-11-30T16:19:54.491377Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory. -db_1 | 2022-11-30T16:19:54.503270Z 0 [Note] Event Scheduler: Loaded 0 events -db_1 | 2022-11-30T16:19:54.505373Z 0 [Note] mysqld: ready for connections. -db_1 | Version: '5.7.40' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL) -``` - -If you try to connect before the database is initialised then the install script starts (despite data loading into the database for our install). You will hit an error and be unable to use Omeka S. If this happens then run docker-compose down and rerun the build-and-deploy.sh script. - -### Accessing Omeka - -* You can access the omeka web interface by going to http://127.0.0.1 -* The phpmyadmin interface is accessed via http://127.0.0.1:8080. To log in use the database credentials mentioned below. - -The credentials for the test environment are below. - -### Test environment variables - -If you set the environment to "test" via the argument to the build-and-deploy.sh script then the following variables are set. - -database username: test -database password: test -database: db1 -database host: db - -## Development notes - -*Note:* Clone this repo into a directory within the WSL partition (such as /home/james) and not in Windows (/mnt/c/...). The composer install will be slow or completely file due to permissions issues if run in a mounted filesystem. +## Static branch for github pages