-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* uses acdh-oeaw/arche-diss-cache * has response cache * has tests * is deployed in a standardized way
- Loading branch information
Showing
14 changed files
with
706 additions
and
245 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 |
---|---|---|
@@ -1,40 +1,48 @@ | ||
name: deploy on rancher | ||
name: test and deploy | ||
on: | ||
workflow_dispatch: ~ | ||
workflow_dispatch: | ||
inputs: | ||
deploy: | ||
type: boolean | ||
description: Deploy if not a release | ||
default: false | ||
push: ~ | ||
release: | ||
types: [published] | ||
env: | ||
RANCHER_API_BASE: https://rancher.acdh-dev.oeaw.ac.at/v3 | ||
RANCHER_PROJECT: Dissemination services | ||
RANCHER_NAMESPACE: arche-iiifmanifest | ||
jobs: | ||
deploy: | ||
testAndDeploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
#- name: test | ||
# run: | | ||
# composer update | ||
# vendor/bin/phpunit tests | ||
- uses: acdh-oeaw/arche_cicd_start_action@main | ||
with: | ||
phpExtensions: json,yaml,pdo,pdo_sqlite | ||
prepareRepoConfig: true | ||
- name: build docker image | ||
run: | | ||
git reset --hard HEAD | ||
rm -fR vendor | ||
docker build --rm -t "acdhch/$RANCHER_NAMESPACE:latest" --build-arg VARIANT=production --label "buildUrl=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" . | ||
#- name: test image | ||
# run: | | ||
# docker run -d --name "$RANCHER_NAMESPACE" -p 8080:80 "acdhch/$RANCHER_NAMESPACE:latest" | ||
# sleep 1 | ||
# some test command | ||
- name: authorize against docker hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: push to docker hub | ||
run: docker push "acdhch/$RANCHER_NAMESPACE:latest" | ||
- name: redeploy on rancher | ||
mkdir build/docroot && cp -R `ls -1 | grep -v ^build` build/docroot/ && cp build/config/arche.yaml build/docroot/config.yaml | ||
docker build --rm -t "acdhch/$RANCHER_NAMESPACE:latest" --build-arg VARIANT=production --label "buildUrl=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" build | ||
- name: test image | ||
run: | | ||
BASE_URL=`curl -s -H "Authorization: Bearer ${{ secrets.RANCHERTOKEN }}" "$RANCHER_API_BASE/projects" | jq -r ".data[] | select(.name == \"$RANCHER_PROJECT\") | .links.workloads"` | ||
curl -i -X POST -H "Authorization: Bearer ${{ secrets.RANCHERTOKEN }}" "$BASE_URL/deployment:$RANCHER_NAMESPACE:$RANCHER_NAMESPACE?action=redeploy" | ||
docker run -d --name "$RANCHER_NAMESPACE" -p 8080:80 "acdhch/$RANCHER_NAMESPACE:latest" | ||
sleep 1 | ||
for mode in image images manifest ; do | ||
# collection | ||
curl -f -i "http:127.0.0.1/?mode=$mode&id=https://arche.acdh.oeaw.ac.at/api/585903" | ||
curl -f -i "http:127.0.0.1/?mode=$mode&id=https://arche.acdh.oeaw.ac.at/api/585903" | ||
# resource | ||
curl -f -i "http:127.0.0.1/?mode=$mode&id=https://arche.acdh.oeaw.ac.at/api/600233" | ||
curl -f -i "http:127.0.0.1/?mode=$mode&id=https://arche.acdh.oeaw.ac.at/api/600233" | ||
done | ||
- uses: acdh-oeaw/arche_cicd_finish_action@main | ||
with: | ||
pushAndRedeploy: ${{ github.event_name == 'release' && github.event.action == 'published' || inputs.deploy }} | ||
dockerhubLogin: ${{ secrets.DOCKER_USERNAME }} | ||
dockehubPassword: ${{ secrets.DOCKER_PASSWORD }} | ||
imageName: $RANCHER_NAMESPACE | ||
rancherProject: $RANCHER_PROJECT | ||
rancherNamespace: $RANCHER_NAMESPACE | ||
rancherToken: ${{ secrets.RANCHERTOKEN }} | ||
coverallsToken: ${{ secrets.coverallsToken }} |
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,2 +1,6 @@ | ||
/composer.lock | ||
/vendor | ||
/nbproject | ||
/.phpunit.cache | ||
/build/docroot | ||
|
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
FROM php:8.3-apache | ||
MAINTAINER Mateusz Żółtak <mzoltak@oeaw.ac.at> | ||
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ | ||
RUN chmod +x /usr/local/bin/install-php-extensions &&\ | ||
install-php-extensions yaml pdo_pgsql @composer &&\ | ||
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" | ||
COPY * /var/www/html/ | ||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh | ||
RUN cd /var/www/html &&\ | ||
composer update -o --no-dev &&\ | ||
chown -R www-data:www-data /var/www/html | ||
EXPOSE 80 | ||
ENTRYPOINT 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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
dissCacheService: | ||
db: sqlite:/var/www/html/db.sqlite | ||
log: | ||
file: /var/www/html/log | ||
level: debug | ||
ttl: | ||
resource: 3600 # 1 hour | ||
response: 31536000 # 1 year | ||
repoDb: | ||
- archeProd.yaml | ||
- archeCur.yaml | ||
allowedNmsp: | ||
- https://id.acdh.oeaw.ac.at/ | ||
- https://arche.acdh.oeaw.ac.at/api/ | ||
- https://arche-curation.acdh-dev.oeaw.ac.at/api/ | ||
- https://arche-dev.acdh-dev.oeaw.ac.at.at/api/ | ||
- https://hdl.handle.net/ | ||
metadataMode: setInIndex.php | ||
parentProperty: https://vocabs.acdh.oeaw.ac.at/schema#hasNextItem | ||
resourceProperties: | ||
- https://vocabs.acdh.oeaw.ac.at/schema#hasIdentifier | ||
- https://vocabs.acdh.oeaw.ac.at/schema#hasTitle | ||
- https://vocabs.acdh.oeaw.ac.at/schema#hasNextItem | ||
- https://vocabs.acdh.oeaw.ac.at/schema#isPartOf | ||
- https://vocabs.acdh.oeaw.ac.at/schema#hasFormat | ||
- https://vocabs.acdh.oeaw.ac.at/schema#hasPixelWidth | ||
- https://vocabs.acdh.oeaw.ac.at/schema#hasPixelHeight | ||
relativesProperties: | ||
- https://vocabs.acdh.oeaw.ac.at/schema#hasIdentifier | ||
- https://vocabs.acdh.oeaw.ac.at/schema#hasTitle | ||
- https://vocabs.acdh.oeaw.ac.at/schema#hasNextItem | ||
- https://vocabs.acdh.oeaw.ac.at/schema#isPartOf | ||
- https://vocabs.acdh.oeaw.ac.at/schema#hasFormat | ||
- https://vocabs.acdh.oeaw.ac.at/schema#hasPixelWidth | ||
- https://vocabs.acdh.oeaw.ac.at/schema#hasPixelHeight | ||
iiifManifest: | ||
defaultMode: image | ||
baseUrl: https://arche-iiifmanifest.acdh.oeaw.ac.at/ | ||
profile: http://iiif.io/api/image/2/level2.json | ||
iiifServiceBase: https://loris.acdh.oeaw.ac.at/ | ||
fetchDimensions: false | ||
schema: | ||
id: https://vocabs.acdh.oeaw.ac.at/schema#hasIdentifier | ||
label: https://vocabs.acdh.oeaw.ac.at/schema#hasTitle | ||
next: https://vocabs.acdh.oeaw.ac.at/schema#hasNextItem | ||
parent: https://vocabs.acdh.oeaw.ac.at/schema#isPartOf | ||
mime: https://vocabs.acdh.oeaw.ac.at/schema#hasFormat | ||
imagePxWidth: https://vocabs.acdh.oeaw.ac.at/schema#hasPixelWidth | ||
imagePxHeight: https://vocabs.acdh.oeaw.ac.at/schema#hasPixelHeight | ||
classes: | ||
collection: https://vocabs.acdh.oeaw.ac.at/schema#Collection | ||
topCollection: https://vocabs.acdh.oeaw.ac.at/schema#TopCollection | ||
namespaces: | ||
id: https://id.acdh.oeaw.ac.at/ |
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 | ||
echo "$PGPASS" > /var/www/.pgpass &&\ | ||
chmod 600 /var/www/.pgpass &&\ | ||
chown www-data:www-data /var/www/.pgpass | ||
|
||
docker-php-entrypoint 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
Oops, something went wrong.