Skip to content

Commit

Permalink
Merge e02cfc8 into 183a373
Browse files Browse the repository at this point in the history
  • Loading branch information
glenrobson committed Oct 18, 2021
2 parents 183a373 + e02cfc8 commit 4f417b1
Show file tree
Hide file tree
Showing 11 changed files with 173 additions and 35 deletions.
1 change: 1 addition & 0 deletions .dockerignore
4 changes: 0 additions & 4 deletions .ebextensions/packages.config

This file was deleted.

3 changes: 0 additions & 3 deletions .ebextensions/pip.config

This file was deleted.

3 changes: 0 additions & 3 deletions .ebextensions/wsgi.config

This file was deleted.

41 changes: 41 additions & 0 deletions .github/deployment/task-definition.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"status": "ACTIVE",
"family": "PreziValidatorTask",
"placementConstraints": [],
"requiresAttributes": [
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.21"
},
{
"name": "com.amazonaws.ecs.capability.task-iam-role"
}
],
"compatibilities": [
"EXTERNAL",
"EC2"
],
"volumes": [],
"requiresCompatibilities": [
"EC2"
],
"containerDefinitions": [
{
"memoryReservation": 128,
"environment": [],
"name": "PreziValidatorContainer",
"mountPoints": [],
"image": "docker.io/glenrobson/iiif-presentation-validator",
"cpu": 0,
"portMappings": [
{
"protocol": "tcp",
"containerPort": 8080,
"hostPort": 0
}
],
"essential": true,
"volumesFrom": []
}
],
"revision": 1
}
57 changes: 57 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Deploy to AWS

on:
push:
branches: [ master, ecs_deploy ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: docker login
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
run: |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login --username ${{ secrets.DOCKER_USER }} --password-stdin
- name: Build the Docker image
env: IMAGE_TAG: ${{ github.sha }}
run: docker build . --file Dockerfile --tag glenrobson/iiif-presentation-validator:$IMAGE_TAG --tag glenrobson/iiif-presentation-validator:latest

- name: Docker Push
run: docker push glenrobson/iiif-presentation-validator:$IMAGE_TAG && docker push glenrobson/iiif-presentation-validator:latest

- name: Docker logout
run: docker logout

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: .github/deployment/task-definition.json
container-name: PreziValidatorContainer
image: docker.io/glenrobson/iiif-presentation-validator:${{ github.sha }}

- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: PreziValidatorService
cluster: DockerHost
wait-for-service-stability: true
59 changes: 59 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This is a basic workflow to help you get started with Actions

name: Run-tests

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.6', '3.7', '3.9' ]
name: Python ${{ matrix.python-version }} sample
steps:
- uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('dev-requirements.txt') }}

- name: Install
run: python setup.py install

- name: Test
run: python setup.py test

- name: install coveralls
run: pip install coveralls


- name: Generate coverage
run: coverage run --include=iiif-presentation-validator.py setup.py test

- name: Upload coverage data to coveralls.io
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}
COVERALLS_PARALLEL: true

Coveralls:
needs: build
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Coveralls Finished
run: |
pip3 install --upgrade coveralls
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ARG version=3.9
FROM python:${version}-slim


WORKDIR /app
ADD . /app

RUN pip install --trusted-host pypi.python.org -r requirements.txt

EXPOSE 8080
CMD ["/usr/local/bin/python", "/app/iiif-presentation-validator.py", "--hostname", "0.0.0.0"]
11 changes: 1 addition & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,6 @@
<div class="header-container">
<header class="wrapper clearfix">
<a class="title" title="IIIF : International Image Interoperability Framework" href="//iiif.io/">Home</a>
<nav>
<ul>
<li><a href="//iiif.io/about/" class="">About</a></li>
<li><a href="//iiif.io/technical-details/" class="">Technical Details</a></li>
<li><a href="//iiif.io/apps-demos/" class="">Apps &amp; Demos</a></li>
<li><a href="//iiif.io/community/" class="">Community</a></li>
<li><a href="//iiif.io/news/" class="">News</a></li>
</ul>
</nav>
</header>
</div>

Expand Down Expand Up @@ -100,7 +91,7 @@ <h3>Validation Results:</h3>
</p>
<ul>
<li><a href="https://github.com/IIIF/presentation-validator">Download</a> the code from github and run it locally.</li>
<li>Use it online with JSON based output, by an HTTP GET to this endpoint:<br/>http://iiif.io/api/presentation/validator/service/validate?version=2.1&amp;url=<i>manifest-url-here</i></li>
<li>Use it online with JSON based output, by an HTTP GET to this endpoint:<br/>https://presentation-validator.iiif.io/validate?version=2.1&amp;url=<i>manifest-url-here</i></li>
</ul>
</div>
</section>
Expand Down
3 changes: 3 additions & 0 deletions runDocker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

docker build -t validator . && docker run -it --rm -p 8080:8080 --name validator validator:latest

0 comments on commit 4f417b1

Please sign in to comment.