-
Notifications
You must be signed in to change notification settings - Fork 36
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
Showing
11 changed files
with
173 additions
and
35 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 @@ | ||
.gitignore |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,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 | ||
} |
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,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 |
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,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 }} |
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,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"] |
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
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 @@ | ||
#!/bin/bash | ||
|
||
docker build -t validator . && docker run -it --rm -p 8080:8080 --name validator validator:latest |