Skip to content

Commit 93c5e38

Browse files
authored
Merge pull request #100 from EBISPOT/develop
2 parents 9e1eb78 + dba7932 commit 93c5e38

File tree

361 files changed

+116344
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

361 files changed

+116344
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/target/
2+
/log/
3+
/.idea/

.gitlab-ci.yml

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
image: docker:latest
2+
services:
3+
- docker:dind
4+
5+
stages:
6+
- build-frontend
7+
- build-artefact
8+
- build-container
9+
- build-frontend-release
10+
- build-artefact-release
11+
- build-container-release
12+
- deploy-sandbox
13+
- deploy-fallback
14+
- deploy-live
15+
16+
variables:
17+
DOCKER_DRIVER: overlay2
18+
DOCKER_TLS_CERTDIR: ""
19+
REGISTRY_IMAGE: ebispot/ontotools-curation-service
20+
SERVICE_NAME: ontotools-curation-service
21+
22+
build-front:
23+
image: node:10.15.3
24+
stage: build-frontend
25+
script:
26+
- npm -v
27+
- node -v
28+
- cd frontend
29+
- rm -rf node_modules
30+
- npm install
31+
- CI=false npm run build:sandbox
32+
artifacts:
33+
paths:
34+
- frontend/build/*
35+
only:
36+
- develop
37+
38+
maven-build:
39+
image: maven:3-jdk-12
40+
stage: build-artefact
41+
script:
42+
- mkdir src/main/webapp
43+
- mv frontend/build/* src/main/webapp/
44+
- ls -lah src/main/webapp
45+
- mvn clean package spring-boot:repackage -DskipTests=true
46+
dependencies:
47+
- build-front
48+
artifacts:
49+
paths:
50+
- target/*.war
51+
only:
52+
- develop
53+
54+
build-container:
55+
stage: build-container
56+
script:
57+
- echo "$DOCKER_HUB_PASSWORD" > dhpw.txt
58+
- docker login -u "${DOCKER_HUB_USER}" --password-stdin < dhpw.txt
59+
- docker build --cache-from $REGISTRY_IMAGE:latest -t $REGISTRY_IMAGE:$CI_COMMIT_SHA .
60+
- docker push $REGISTRY_IMAGE:$CI_COMMIT_SHA
61+
only:
62+
- develop
63+
64+
build-front-release:
65+
image: node:10.15.3
66+
stage: build-frontend-release
67+
script:
68+
- npm -v
69+
- node -v
70+
- cd frontend
71+
- rm -rf node_modules
72+
- npm install
73+
- CI=false npm run build:prod
74+
artifacts:
75+
paths:
76+
- frontend/build/*
77+
only:
78+
- tags
79+
80+
maven-build-release:
81+
image: maven:3-jdk-12
82+
stage: build-artefact-release
83+
script:
84+
- mkdir src/main/webapp
85+
- mv frontend/build/* src/main/webapp/
86+
- ls -lah src/main/webapp
87+
- mvn clean package spring-boot:repackage -DskipTests=true
88+
dependencies:
89+
- build-front-release
90+
artifacts:
91+
paths:
92+
- target/*.war
93+
only:
94+
- tags
95+
96+
build-release:
97+
variables:
98+
GIT_STRATEGY: none
99+
stage: build-container-release
100+
script:
101+
- echo "$DOCKER_HUB_PASSWORD" > dhpw.txt
102+
- docker login -u "${DOCKER_HUB_USER}" --password-stdin < dhpw.txt
103+
- docker pull $REGISTRY_IMAGE:$CI_COMMIT_SHA
104+
- docker tag $REGISTRY_IMAGE:$CI_COMMIT_SHA $REGISTRY_IMAGE:latest
105+
- docker tag $REGISTRY_IMAGE:$CI_COMMIT_SHA $REGISTRY_IMAGE:$CI_COMMIT_TAG
106+
- docker push $REGISTRY_IMAGE:latest
107+
- docker push $REGISTRY_IMAGE:$CI_COMMIT_TAG
108+
only:
109+
- tags
110+
111+
deploy-sandbox:
112+
image: dtzar/helm-kubectl:2.13.1
113+
stage: deploy-sandbox
114+
script:
115+
- echo "Deploy to sandbox server"
116+
- mkdir -p /root/.kube
117+
- echo ${SANBOX_KUBECONF} | base64 -d > /root/.kube/config
118+
- helm init --stable-repo-url https://charts.helm.sh/stable
119+
- helm delete --purge ontotools-curation-service || true
120+
- helm install --name ontotools-curation-service --set k8Namespace=ontotools,image.repository=$REGISTRY_IMAGE,image.tag=$CI_COMMIT_SHA,image.env.secretsName=ontotools-secrets,image.env.secretsKey=db-pwd ./k8chart/ --wait
121+
environment:
122+
name: sandbox
123+
when: manual
124+
only:
125+
- develop
126+
127+
deploy-fallback:
128+
image: dtzar/helm-kubectl:2.13.1
129+
stage: deploy-fallback
130+
script:
131+
- echo "Deploy to Production fallback server"
132+
- mkdir -p /root/.kube
133+
- echo ${PFALLBACK_KUBECONFIG} | base64 -d > /root/.kube/config
134+
- helm init --stable-repo-url https://charts.helm.sh/stable
135+
- helm delete --purge ontotools-curation-service || true
136+
- helm install --name ontotools-curation-service --set k8Namespace=ontotools,replicaCount=1,image.env.envName=prod,image.repository=$REGISTRY_IMAGE,image.tag=$CI_COMMIT_SHA,image.env.dbUser=ontotoolscurator,image.env.secretsName=ontotools-secrets,image.env.secretsKey=db-pwd ./k8chart/ --wait
137+
environment:
138+
name: prod
139+
when: manual
140+
only:
141+
- tags
142+
143+
deploy-live:
144+
image: dtzar/helm-kubectl:2.13.1
145+
stage: deploy-live
146+
script:
147+
- echo "Deploy to Production server"
148+
- mkdir -p /root/.kube
149+
- echo ${PLIVE_KUBECONFIG} | base64 -d > /root/.kube/config
150+
- helm init --stable-repo-url https://charts.helm.sh/stable
151+
- helm delete --purge ontotools-curation-service || true
152+
- helm install --name ontotools-curation-service --set k8Namespace=ontotools,replicaCount=1,image.env.envName=prod,image.repository=$REGISTRY_IMAGE,image.tag=$CI_COMMIT_SHA,image.env.dbUser=ontotoolscurator,image.env.secretsName=ontotools-secrets,image.env.secretsKey=db-pwd ./k8chart/ --wait
153+
environment:
154+
name: prod
155+
when: manual
156+
only:
157+
- tags

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Import base image
2+
FROM openjdk:15-buster
3+
4+
RUN apt-get update
5+
RUN apt-get install -y --no-install-recommends less
6+
7+
# Create log file directory and set permission
8+
RUN groupadd -r ontotools-curation-service && useradd -r --create-home -g ontotools-curation-service ontotools-curation-service
9+
RUN if [ ! -d /var/log/ontotools/ ];then mkdir /var/log/ontotools/;fi
10+
RUN chown -R ontotools-curation-service:ontotools-curation-service /var/log/ontotools
11+
12+
# Move project artifact
13+
ADD target/ontotools-curation-service-*.war /home/ontotools-curation-service/
14+
USER ontotools-curation-service
15+
16+
# Launch application server
17+
ENTRYPOINT exec $JAVA_HOME/bin/java $XMX $XMS -jar -Dspring.profiles.active=$ENVIRONMENT /home/ontotools-curation-service/ontotools-curation-service-*.war

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,28 @@
1-
# Future Curation App
1+
# Onto-tools Curation App
2+
3+
## Requirements to build and run locally
4+
5+
* Local MongoDB instance running on port `27017`
6+
* Some test credentials and data added to the DB (if authentication is turned on) - see https://github.com/EBISPOT/ontotools-curator/wiki/Test-data
7+
* Alternatively:
8+
* Add at least one `super` user in the DB in the `users` collection:
9+
```
10+
{
11+
"name": "Super user",
12+
"email": "[email protected]",
13+
"superUser": true
14+
}
15+
```
16+
* Set `ontotools-curation.auth.enabled` to `false` in the `dev` profile in `application.yml`
17+
18+
### Build package
19+
20+
* Run `mvn clean install -Dspring.profiles.active=dev`
21+
* Alternatively, introduce in a new profile in `application.yml` and use it as active when building
22+
* At least one active profile has to be specified when building the package
23+
24+
### Build docker container
25+
* Run the `build.sh` script under `scripts`
26+
27+
### Run locally
28+
* `java -jar -Dspring.profiles.active=dev target/ontotools-curation-service-*.jar`

frontend/.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
REACT_APP_AAPURL="https://api.aai.ebi.ac.uk"
2+
REACT_APP_APIURL="http://localhost:8080/ontotools/curation/api"
3+
PUBLIC_URL=""
4+

frontend/.env.prod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
REACT_APP_AAPURL="https://api.aai.ebi.ac.uk"
2+
REACT_APP_APIURL="/curator"
3+
PUBLIC_URL="/curator"
4+

frontend/.env.sandbox

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
REACT_APP_AAPURL="https://api.aai.ebi.ac.uk"
2+
REACT_APP_APIURL="/curator"
3+
PUBLIC_URL="/curator"
4+

frontend/.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*

frontend/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Getting Started with Create React App
2+
3+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4+
5+
## Available Scripts
6+
7+
In the project directory, you can run:
8+
9+
### `yarn start`
10+
11+
Runs the app in the development mode.\
12+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13+
14+
The page will reload if you make edits.\
15+
You will also see any lint errors in the console.
16+
17+
### `yarn test`
18+
19+
Launches the test runner in the interactive watch mode.\
20+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21+
22+
### `yarn build`
23+
24+
Builds the app for production to the `build` folder.\
25+
It correctly bundles React in production mode and optimizes the build for the best performance.
26+
27+
The build is minified and the filenames include the hashes.\
28+
Your app is ready to be deployed!
29+
30+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31+
32+
### `yarn eject`
33+
34+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
35+
36+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37+
38+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
39+
40+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
41+
42+
## Learn More
43+
44+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45+
46+
To learn React, check out the [React documentation](https://reactjs.org/).

0 commit comments

Comments
 (0)