Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CK-83 Production deployment setup #78

Merged
merged 61 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
cdd3689
Feature request - Addition of GH issue template
M-casado Jun 22, 2023
82ea826
Merge pull request #71 from elixir-europe/dev
theisuru Nov 6, 2023
5c57e8c
Merge pull request #67 from M-casado/feature_request_template
theisuru Nov 6, 2023
70d938e
mcb - Add Biovalidator logo
M-casado Feb 16, 2024
c8fc541
mcb - Add Biovalidator logo
M-casado Feb 16, 2024
d793526
mcb - Fix width
M-casado Feb 16, 2024
9e1af1b
Merge pull request #72 from M-casado/mcb-new_logo
theisuru Feb 27, 2024
137a436
readme
theisuru Feb 27, 2024
e7bae99
Merge branch 'main' of github.com:elixir-europe/biovalidator
theisuru Feb 27, 2024
d8fd805
feat: increase input json payload size from 100k to 1m
theisuru May 29, 2024
86e778d
k8s deployment initial config
snathanvj Jul 2, 2024
77266c5
test image publishing
snathanvj Jul 3, 2024
c064ac4
k8s deployment
snathanvj Jul 5, 2024
ddfe05c
k8s deployment
snathanvj Jul 5, 2024
32ec9ab
k8s deployment fixes
snathanvj Jul 5, 2024
e616b9d
pull docker image from gitlab registry
snathanvj Jul 5, 2024
40ab08b
hardcoded port removed
snathanvj Jul 8, 2024
ab22d28
context redirect
snathanvj Jul 8, 2024
73ac724
image name fix
snathanvj Jul 8, 2024
f2bfd6e
image name fix
snathanvj Jul 9, 2024
85ae762
image name fix
snathanvj Jul 9, 2024
7103027
replace env variable
snathanvj Jul 10, 2024
568cc47
ingress yaml
snathanvj Jul 10, 2024
8415013
ingress yaml extension mismatch
snathanvj Jul 10, 2024
e2d6ed0
ingress yaml removed
snathanvj Jul 10, 2024
44c8244
ck_49:environment
snathanvj Jul 16, 2024
b4317cf
ck_49: dev environment
snathanvj Jul 16, 2024
5483b3d
ck_49: simplified stage
snathanvj Jul 16, 2024
108e8e3
ck_49: nodeport removed
snathanvj Jul 16, 2024
2d6c8b0
ck_49: ingress
snathanvj Jul 19, 2024
aca5ad6
ck_49: ingress gitlab yaml
snathanvj Jul 19, 2024
46cdabf
ck_49: ingress host
snathanvj Jul 19, 2024
581c32a
ck_49: ingress host fix
snathanvj Jul 19, 2024
a60ae0a
ck_49: ingress path,host fix
snathanvj Jul 19, 2024
e52641c
ck_49: ingress
snathanvj Jul 19, 2024
9d68707
ck_49: ingress changes
snathanvj Jul 22, 2024
4d86939
ck_49: ingress class name
snathanvj Jul 22, 2024
d6b6df5
ck_49: port change
snathanvj Jul 23, 2024
176ffc1
ck_49: ingress file change
snathanvj Jul 23, 2024
30ab9c7
ck_49: service.yaml
snathanvj Jul 23, 2024
661fc96
ck_49: port reverted
snathanvj Jul 23, 2024
d948228
ck_49: port 80
snathanvj Jul 23, 2024
c7c7b40
ck_49: dockerfile
snathanvj Jul 23, 2024
eadb654
ck_49: dockerfile default port
snathanvj Jul 23, 2024
30b85af
ck_49: revert all
snathanvj Jul 23, 2024
ebebefc
ck_49: ing port
snathanvj Jul 23, 2024
c23f4b6
ck_49: port 3020
snathanvj Jul 23, 2024
fd6bd13
ck_49: ingress name
snathanvj Jul 23, 2024
3e952a5
ck_49: ingress apply
snathanvj Jul 23, 2024
c2b7ba9
ck_49: prod deployment
snathanvj Jul 26, 2024
ee189e7
ck_49: template bug
snathanvj Jul 26, 2024
ccca8a8
ck_49: prod host
snathanvj Jul 26, 2024
2a73340
include ajv-errors lib ebi-ait/checklist#77 ebi-ait/checklist#67
theisuru Aug 30, 2024
ea6475c
Merge pull request #75 from elixir-europe/ck-49-k8s-deployment
snathanvj Sep 10, 2024
e58677d
validate without backslash
snathanvj Sep 10, 2024
dae3c44
rev:validate without backslash
snathanvj Sep 10, 2024
d639c34
replace window path
snathanvj Sep 10, 2024
3bff38a
Merge pull request #77 from elixir-europe/backslash_issue
snathanvj Sep 10, 2024
224f822
ck-49 dev env for viovalidator
amnonkhen Oct 15, 2024
7cca838
ait/checklist#83 gitlab ci envs
theisuru Nov 4, 2024
37879d3
change URI to /biosamples/biovalidator/*
theisuru Nov 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Feature request
description: Form to request a new feature or enhancement to ELIXIR Biovalidator
title: "[Feature request]: "
labels: ["enhancement"]
assignees:
- theisuru
body:
- type: markdown
attributes:
value: |
This form serves as a template for **feature requests** to be added to ELIXIR Biovalidator. It can be used to request, for example, a new custom keyword for asynchronous validation (similar to ``graphRestriction``).
Thank you for contributing to the improvement of ELIXIR Biovalidator!

- type: textarea
id: feature-summary
attributes:
label: Summary
description: Provide a summary of what the requested feature is.
placeholder: e.g. Addition of information to Biovalidator's logs
validations:
required: true

- type: dropdown
id: related-field
attributes:
label: Related topic
description: What are the topic(s) that your requested feature is related to? You can select multiple topics if applicable.
multiple: true
options:
- Custom keywords
- Installation
- Server usage
- Command Line Interface (CLI) usage
- Tool's documentation
- Other
validations:
required: true

- type: textarea
id: request-motivation
attributes:
label: Request motivation
description: What is the motivation of your request. In other words, what would be the benefits to Biovalidator were your feature to be added.
placeholder: e.g. The addition of the information ``...`` to the logs would greatly improve the traceability of validation requests...
validations:
required: true

- type: textarea
id: use-cases
attributes:
label: Use cases
description: List examples of the use-cases for the requested feature.
placeholder: |
e.g.
- Monitoring the server requests...
- Traceability of errors during validation...
- Generation of statistics...
- ...
validations:
required: false

- type: textarea
id: examples
attributes:
label: Examples
description: List examples of how you envision the feature to work and its output.
placeholder: |
e.g. Example 1: with an example request ``curl ...``, the logs would look like...
validations:
required: true

- type: textarea
id: additional-context
attributes:
label: Additional context
description: Use this text area to add all additional context needed to create the new feature, including related issues and PRs,images, etc.
placeholder: e.g. This feature relates to issue "X", and here is a screenshot of...
validations:
required: false
82 changes: 67 additions & 15 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,86 @@
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
DOCKER_TAG: $CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
DOCKER_IMAGE_NAME: $CI_REGISTRY_IMAGE:$DOCKER_TAG
DOCKER_PULL_SECRET: docker-registry-secret
DOCKER_AUTH_CONFIG: $DOCKER_CONFIG_JSON

stages:
- build
- deploy

build_docker_image:
build_docker_image:
image: docker:latest
services:
- docker:dind
stage: build
script:
- docker login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
- echo "$CI_DEPLOY_PASSWORD" | docker login $CI_REGISTRY -u $CI_DEPLOY_USER --password-stdin
- echo $DOCKER_IMAGE_NAME
- docker build -t $DOCKER_IMAGE_NAME .
- docker push $DOCKER_IMAGE_NAME
after_script:
- docker logout ${CI_REGISTRY}

hx-production:
stage: deploy
script:
- sed -i s#%DOCKER_IMAGE%#$CI_REGISTRY_IMAGE\:$CI_COMMIT_TAG#g k8s-deployment.yaml
- export KUBECONFIG=/home/gitlab-runner/.kube/hx-wp-webadmin-01-team-admin && kubectl apply -f k8s-deployment.yaml
deploy_dev:
variables:
NAMESPACE: biosamples-dev
HOST: wwwint.ebi.ac.uk
environment:
name: dev
url: https://wwwint.ebi.ac.uk/biosamples/biovalidator
when: manual
extends: .kube_deploy_script

deploy_test:
variables:
NAMESPACE: biosamples-dev
HOST: wwwdev.ebi.ac.uk
environment:
name: test
url: https://wwwdev.ebi.ac.uk/biosamples/biovalidator
only:
- main
- dev
when: manual
extends: .kube_deploy_script

deploy_prod:
variables:
NAMESPACE: biosamples-prod
HOST: www.ebi.ac.uk
environment:
name: prod
url: https://www.ebi.ac.uk/biosamples/biovalidator
only:
- disable
hh-production:
- main
when: manual
extends: .kube_deploy_script

# todo discuss: do we need AIT biovalidator to share with others?
# todo discuss: what are the options to make biosamples internal only: remove ingress and make service=ClusterIP?
#deploy_prod_ait:
# variables:
# NAMESPACE: ait-prod
# HOST: www.ebi.ac.uk
# environment:
# name: prod-ait
# url: https://www.ebi.ac.uk/ait/biovalidator
# when: manual
# extends: .kube_deploy_script

.kube_deploy_script:
stage: deploy
image: dtzar/helm-kubectl
script:
- sed -i s#%DOCKER_IMAGE%#$CI_REGISTRY_IMAGE\:$CI_COMMIT_TAG#g k8s-deployment.yaml
- export KUBECONFIG=/home/gitlab-runner/.kube/hh-wp-webadmin-01-team-admin && kubectl apply -f k8s-deployment.yaml
only:
- disable
- kubectl create namespace $NAMESPACE || true
- kubectl config set-context --current --namespace=${NAMESPACE}
- kubectl delete secret $DOCKER_PULL_SECRET || true
- kubectl create secret docker-registry $DOCKER_PULL_SECRET --docker-server=$CI_REGISTRY --docker-username=$CI_DEPLOY_USER --docker-password=$CI_DEPLOY_PASSWORD
- envsubst < deployment.yaml > kubernetes.yaml
- kubectl apply -f kubernetes.yaml
- envsubst < ingress_template.yaml > ingress.yaml
- cat ingress.yaml
- kubectl apply -f ingress.yaml
- kubectl rollout restart deployments biovalidator
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ELIXIR biovalidator - Extended JSON Schema validator with ontology validation
[![Build Status](https://travis-ci.org/EMBL-EBI-SUBS/json-schema-validator.svg?branch=master)](https://travis-ci.org/EMBL-EBI-SUBS/json-schema-validator) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/7fbabc981e294249a9a0967965418058)](https://www.codacy.com/app/fpenim/json-schema-validator?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=EMBL-EBI-SUBS/json-schema-validator&amp;utm_campaign=Badge_Grade)
# ELIXIR biovalidator - Extended JSON Schema validator with ontology validation
<img src="./media/20240216_Biovalidator_logo.png" alt="Biovalidator logo" width="100" height="auto"> [![Build Status](https://travis-ci.org/EMBL-EBI-SUBS/json-schema-validator.svg?branch=master)](https://travis-ci.org/EMBL-EBI-SUBS/json-schema-validator) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/7fbabc981e294249a9a0967965418058)](https://www.codacy.com/app/fpenim/json-schema-validator?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=EMBL-EBI-SUBS/json-schema-validator&amp;utm_campaign=Badge_Grade)
[![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest)

ELIXIR biovalidator is a [JSON Schema](http://json-schema.org/) validator extended from popular javascript library [AJV](https://ajv.js.org/).
Expand Down Expand Up @@ -434,15 +434,15 @@ This image can be used to run the validator without cloning this repository.

Pull docker image from [quay.io](https://quay.io/repository/ebi-ait/biovalidator)
```shell
docker pull quay.io/ebi-ait/biovalidator:2.0.0
docker pull quay.io/ebi-ait/biovalidator:2.2.2
```
Run in server mode
```shell
docker run -p 3020:3020 -d quay.io/ebi-ait/biovalidator:2.0.0
docker run -p 3020:3020 -d quay.io/ebi-ait/biovalidator:2.2.2
```
Run in onetime CLI mode
```shell
docker run quay.io/ebi-ait/biovalidator:2.0.0 --schema /path/to/schema.json --data /path/to/data.json
docker run quay.io/ebi-ait/biovalidator:2.2.2 --schema /path/to/schema.json --data /path/to/data.json
```

## Development
Expand Down
39 changes: 39 additions & 0 deletions deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: biovalidator
name: biovalidator
spec:
replicas: 2
revisionHistoryLimit: 2
selector:
matchLabels:
app: biovalidator
template:
metadata:
labels:
app: biovalidator
spec:
imagePullSecrets:
- name: $DOCKER_PULL_SECRET
containers:
- name: biovalidator
image: $DOCKER_IMAGE_NAME
imagePullPolicy: Always
ports:
- containerPort: 3020

---
apiVersion: v1
kind: Service
metadata:
name: biovalidator-service
spec:
type: NodePort
selector:
app: biovalidator
ports:
- protocol: TCP
port: 3020
targetPort: 3020
22 changes: 22 additions & 0 deletions ingress_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: biovalidator-ingress
namespace: ${NAMESPACE}
labels:
app: biovalidator-service
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
ingressClassName: nginx
rules:
- host: ${HOST}
http:
paths:
- path: /biosamples/biovalidator(/|$)(.*)
pathType: Prefix
backend:
service:
name: biovalidator-service
port:
number: 3020
38 changes: 0 additions & 38 deletions k8s-deployment.yaml

This file was deleted.

Binary file added media/20240216_Biovalidator_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 17 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "biovalidator",
"version": "2.2.1",
"version": "2.2.2",
"description": "A nodejs JSON schema validator, extended from Ajv to include ontology validation.",
"main": "src/biovalidator.js",
"bin": {
Expand All @@ -26,6 +26,7 @@
"license": "Apache-2.0",
"dependencies": {
"ajv": "8.12.0",
"ajv-errors": "^3.0.0",
"ajv-formats": "2.1.1",
"axios": "^1.3.2",
"express": "^4.17.1",
Expand Down
1 change: 1 addition & 0 deletions src/core/biovalidator-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class BioValidator {
const draft7MetaSchema = require("ajv/dist/refs/json-schema-draft-07.json")
ajvInstance.addMetaSchema(draft7MetaSchema)
addFormats(ajvInstance);
require("ajv-errors")(ajvInstance)

this._addCustomKeywordValidators(ajvInstance);
this._preCompileLocalSchemas(ajvInstance, localSchemaPath);
Expand Down
2 changes: 1 addition & 1 deletion src/core/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class BioValidatorServer {
this.router = express.Router();
this.router.use(express.static('src/views'));

this.app.use(bodyParser.json());
this.app.use(express.json({limit:'1mb'}));

this.app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
Expand Down
Loading