Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
54 changes: 43 additions & 11 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ variables:
DOCKER_TAG: $CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
DOCKER_IMAGE_NAME: $CI_REGISTRY_IMAGE:$DOCKER_TAG
DOCKER_PULL_SECRET: docker-registry-secret
MONGO_URL: $MONGO_URL

cache:
paths:
Expand All @@ -22,9 +21,9 @@ build:
image: maven:3.8.3-openjdk-17
stage: build
variables:
MONGO_URL: $MONGO_URL
MONGO_URL: $DEV_MONGO_URL
script:
- mvn $MAVEN_CLI_OPTS clean package -Pdocker
- mvn $MAVEN_CLI_OPTS clean package
artifacts:
paths:
- target/json-schema-store-0.0.2.jar
Expand All @@ -34,8 +33,6 @@ build_docker_image:
services:
- docker:dind
stage: publish
variables:
MONGO_URL: $MONGO_URL
script:
- echo "$CI_DEPLOY_PASSWORD" | docker login $CI_REGISTRY -u $CI_DEPLOY_USER --password-stdin
- echo $DOCKER_IMAGE_NAME
Expand All @@ -49,16 +46,51 @@ build_docker_image:
# script:
# - mvn $MAVEN_CLI_OPTS test
#
deploy:
deploy_dev:
variables:
NAMESPACE: biosamples-dev
HOST: wwwint.ebi.ac.uk
MONGO_URL: $DEV_MONGO_URL
VALIDATOR_URL: https://wwwdev.ebi.ac.uk/ait/biovalidator/validate
environment:
name: dev
url: https://wwwint.ebi.ac.uk/biosamples/schema-store
extends: .kube_deploy_script

deploy_test:
variables:
NAMESPACE: biosamples-test
HOST: wwwdev.ebi.ac.uk
MONGO_URL: $TEST_MONGO_URL
VALIDATOR_URL: https://wwwdev.ebi.ac.uk/ait/biovalidator/validate
environment:
name: test
url: https://wwwdev.ebi.ac.uk/biosamples/schema-store
when: manual
extends: .kube_deploy_script

deploy_prod:
variables:
NAMESPACE: biosamples-prod
HOST: www.ebi.ac.uk
MONGO_URL: $PROD_MONGO_URL
VALIDATOR_URL: https://wwwdev.ebi.ac.uk/ait/biovalidator/validate
environment:
name: prod
url: https://www.ebi.ac.uk/biosamples/schema-store
when: manual
extends: .kube_deploy_script

.kube_deploy_script:
stage: deploy
image: dtzar/helm-kubectl:3.11.0
image: dtzar/helm-kubectl
script:
- kubectl create namespace $KUBECTL_NAMESPACE || true
- kubectl config set-context --current --namespace=${KUBECTL_NAMESPACE}
- 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
- envsubst < k8s/deployment.yaml > kubernetes.yaml
- kubectl apply -f kubernetes.yaml
- kubectl apply -f k8s/service.yaml
- kubectl rollout restart deployments json-schema-store
when: manual

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ FROM openjdk:17-jdk-slim
EXPOSE 27017
ARG JAR_FILE=target/json-schema-store-0.0.2.jar
COPY ${JAR_FILE} json-schema-store.jar
ENTRYPOINT ["java","-jar","/json-schema-store.jar", "--spring.profiles.active=docker"]
ENTRYPOINT ["java","-jar","/json-schema-store.jar"]
44 changes: 0 additions & 44 deletions k8s/.gitlab-ci.old.yml

This file was deleted.

33 changes: 12 additions & 21 deletions k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,28 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: schema-store
name: schema-store
app: json-schema-store
name: json-schema-store
spec:
replicas: 2
replicas: 1
selector:
matchLabels:
app: schema-store
app: json-schema-store
template:
metadata:
labels:
app: schema-store
app: json-schema-store
spec:
imagePullSecrets:
- name: $DOCKER_PULL_SECRET
containers:
- name: schema-store
- name: json-schema-store
image: $DOCKER_IMAGE_NAME
imagePullPolicy: Always
ports:
- containerPort: 8080

---
apiVersion: v1
kind: Service
metadata:
name: biovalidator-service
spec:
type: NodePort
selector:
app: schema-store
ports:
- protocol: TCP
port: 8080
targetPort: 8080
- containerPort: 8085
env:
- name: MONGO_URL
value: ${MONGO_URL}
- name: BIO_VALIDATOR_URL
value: ${VALIDATOR_URL}
22 changes: 0 additions & 22 deletions k8s/ingress_template.yaml

This file was deleted.

8 changes: 4 additions & 4 deletions k8s/service.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: schema-store
name: json-schema-store
spec:
type: NodePort
selector:
app: schema-store
app: json-schema-store
ports:
- protocol: TCP
port: 8080
targetPort: 8080
port: 8085
targetPort: 8085
23 changes: 0 additions & 23 deletions src/main/resources/application-dev.yml

This file was deleted.

18 changes: 0 additions & 18 deletions src/main/resources/application-docker.yml

This file was deleted.

24 changes: 0 additions & 24 deletions src/main/resources/application-prod.yml

This file was deleted.

22 changes: 14 additions & 8 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
# MongoDB conf
spring:
profiles:
active: dev
mvc:
pathmatch:
matching-strategy: ant_path_matcher
data:
mongodb:
uri: ${MONGO_URL}
rest:
basePath: /api/v2
server:
port: 8085
servlet:
context-path: /biosamples/schema-store
# spring actuator
management:
endpoints:
web:
exposure:
include: "*"

# Elixir Validator
schemastore:
validator:
url: ${BIO_VALIDATOR_URL}


logging:
level:
org:
Expand All @@ -28,9 +40,3 @@ logging:
ebi:
biosamples:
jsonschemastore: INFO


# Elixir Validator
schemastore:
validator:
url: http://localhost:3020/validate