Skip to content

Commit d4ff2b1

Browse files
kinowmr-c
authored andcommitted
Update Docker files and other settings required to start the application with Docker/compose
1 parent 832af26 commit d4ff2b1

File tree

8 files changed

+39
-31
lines changed

8 files changed

+39
-31
lines changed

.github/workflows/ci-build.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ jobs:
1818
ref: ${{ github.event.pull_request.head.ref }}
1919
repository: ${{ github.event.pull_request.head.repo.full_name }}
2020

21-
- name: MongoDB in GitHub Actions
22-
uses: supercharge/mongodb-github-action@1.3.0
23-
2421
- name: Restore dependency cache
2522
uses: actions/cache@v2.1.4
2623
with:

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ Java annotation based.
7878
Templates for the view use [Thymeleaf](http://www.thymeleaf.org/),
7979
which allows them to be displayed in browsers as static prototypes.
8080

81-
MongoDB is used to store information about `Workflow` and `QueuedWorkflow`
82-
objects using [Spring Data JPA](https://docs.spring.io/spring-data/mongodb/docs/current/reference/html/).
81+
PostgreSQL is used to store information about `Workflow` and `QueuedWorkflow`
82+
objects using [Spring Data JPA](https://docs.spring.io/spring-data/jpa/docs/current/reference/html/).
8383

8484
The application also uses a triple store to keep the RDF representing
8585
workflows (gathered from [cwltool](https://github.com/common-workflow-language/cwltool)'s

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ADD pom.xml LICENSE.md NOTICE.md README.md /usr/src/app/
4545

4646
# add src/ (which often change)
4747
ADD src /usr/src/app/src
48-
# Skip tests while building as that requires a local mongodb
48+
# Skip tests while building as that requires a local postgres
4949
RUN mvn clean package -DskipTests && cp target/cwlviewer-*.jar /usr/lib/cwlviewer.jar && rm -rf target
5050

5151
# NOTE: ~/.m2/repository is a VOLUME and so will be deleted anyway

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,16 @@ If you have modified the source code, then you may want to build the docker imag
5959
6060
docker build -t commonworkflowlanguage/cwlviewer .
6161
62-
## Running Spring Boot locally for development, with MongoDB and Jena Fuseki in Docker
62+
## Running Spring Boot locally for development, with PostgreSQL and Jena Fuseki in Docker
6363
6464
Create `docker-compose.override.yml`:
6565

6666
```
6767
version: '3.2'
6868
services:
69-
mongo:
69+
postgres:
7070
ports:
71-
- "27017:27017"
71+
- "5432:5432"
7272
sparql:
7373
ports:
7474
- "3030:3030"
@@ -94,21 +94,21 @@ To completely reset the state, you must delete the data volumes:
9494
9595
```
9696
docker-compose down
97-
docker volume rm cwlviewer_bundle cwlviewer_git cwlviewer_graphviz cwlviewer_mongo cwlviewer_sparql
97+
docker volume rm cwlviewer_bundle cwlviewer_git cwlviewer_graphviz cwlviewer_postgres cwlviewer_sparql
9898
```
9999
100100
## Running without Docker
101101
102102
### Requirements
103103
104-
#### MongoDB
104+
#### PostgreSQL
105105
106-
You will need to have [MongoDB](https://www.mongodb.com/) running,
107-
by default on `localhost:27017`
106+
You will need to have [PostgreSQL](https://www.postgresql.org/) running,
107+
by default on `localhost:5432`
108108
109109
If you are running from the command line, you can override this by supplying
110-
system properties like `-Dspring.data.mongodb.host=mongo.example.org` and
111-
`-Dspring.data.mongodb.port=1337`
110+
system properties like `-Dspring.datasource.url=jdbc:postgresql://localhost:5432/cwlviewer` and
111+
`-Dspring.datasource.password=sa`
112112
113113
#### Apache Jena Fuseki (or alternative SPARQL server)
114114

docker-compose.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ volumes:
33
bundle:
44
git:
55
graphviz:
6-
mongo:
6+
postgres:
77
sparql:
88
services:
99
spring:
@@ -15,7 +15,7 @@ services:
1515
ports:
1616
- "8080:8080"
1717
links:
18-
- mongo
18+
- postgres
1919
- sparql
2020
volumes:
2121
- type: volume
@@ -29,19 +29,26 @@ services:
2929
target: /data/graphviz
3030
environment:
3131
- SPARQL_ENDPOINT=http://sparql:3030/cwlviewer/
32-
- SPRING_DATA_MONGODB_HOST=mongo
33-
- SPRING_DATA_MONGODB_PORT=27017
32+
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/cwlviewer
33+
- SPRING_DATASOURCE_USERNAME=sa
34+
- SPRING_DATASOURCE_PASSWORD=sa
3435
- BUNDLESTORAGE=/data/bundle
3536
- GITSTORAGE=/data/git
3637
- GRAPHVIZSTORAGE=/data/graphviz
37-
mongo:
38+
postgres:
3839
restart: always
39-
image: mongo:3.4
40-
command: mongod --setParameter="internalQueryExecMaxBlockingSortBytes=335544320"
40+
image: postgres:14-alpine
41+
command: postgres -c listen_addresses='*' -c log_statement=all
42+
environment:
43+
- POSTGRES_USER=sa
44+
- POSTGRES_PASSWORD=sa
45+
- POSTGRES_DB=cwlviewer
46+
- PGDATA=/var/lib/postgresql/data/cwlviewer/
4147
volumes:
4248
- type: volume
43-
source: mongo
44-
target: /data/db
49+
source: postgres
50+
target: /var/lib/postgresql/data
51+
- ./pg_hba.conf/:/var/lib/postgresql/data/pg_hba.conf
4552
sparql:
4653
restart: always
4754
## For debugging, expose the Fuseki port by enabling:

pga_hba.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
host all all 0.0.0.0/0 trust

src/main/java/org/commonwl/view/workflow/QueuedWorkflowRepository.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
import java.util.List;
88

99
/**
10-
* Stores workflows in the queue waiting for cwltool
10+
* Stores workflows in the queue waiting for cwltool.
11+
*
12+
* <p>Use only queries without objects and JSON here. For other methods use the Impl class to avoid
13+
* issues with serialization.</p>
1114
*/
1215
public interface QueuedWorkflowRepository extends JpaRepository<QueuedWorkflow, String>, QueuedWorkflowRepositoryCustom {
1316

@@ -17,7 +20,7 @@ public interface QueuedWorkflowRepository extends JpaRepository<QueuedWorkflow,
1720
* @param retrievedOn Date of when the queued workflow was retrieved
1821
* @return The number of queued workflows deleted
1922
*/
20-
@Query(value = "delete from queued_workflow q where q.tempRepresentation->>retrieved_on <= ?1", nativeQuery = true)
23+
@Query(value = "DELETE FROM queued_workflow q WHERE q.tempRepresentation ->> 'retrieved_on' <= ?1", nativeQuery = true)
2124
Long deleteByTempRepresentation_RetrievedOnLessThanEqual(Date retrievedOn);
2225

2326
/**
@@ -26,7 +29,7 @@ public interface QueuedWorkflowRepository extends JpaRepository<QueuedWorkflow,
2629
* @param retrievedOn Details of where the queued workflow is from
2730
* @return A list of queued workflows
2831
*/
29-
@Query(value = "select q.* from queued_workflow q where q.tempRepresentation->>retrieved_on <= ?1", nativeQuery = true)
32+
@Query(value = "SELECT q.* FROM queued_workflow q WHERE q.tempRepresentation ->> 'retrieved_on' <= ?1", nativeQuery = true)
3033
List<QueuedWorkflow> findByTempRepresentation_RetrievedOnLessThanEqual(Date retrievedOn);
3134

3235
}

src/main/java/org/commonwl/view/workflow/WorkflowRepository.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
/**
3131
* Stores and retrieved workflow objects from the database
3232
*
33-
* See Spring Data MongoDB docs:
34-
* https://docs.spring.io/spring-data/data-mongo/docs/current/reference/html/
33+
* See Spring Data JPA docs:
34+
* https://docs.spring.io/spring-data/jpa/docs/current/reference/html/
3535
*/
3636
public interface WorkflowRepository extends JpaRepository<Workflow, String> {
3737

@@ -48,7 +48,7 @@ public interface WorkflowRepository extends JpaRepository<Workflow, String> {
4848
* @param path The path to the workflow within the repository
4949
* @return The workflow model
5050
*/
51-
@Query(value = "select * from workflow w where w.lastCommit = ?1 and w.retrievedFrom->>path = ?2", nativeQuery = true)
51+
@Query(value = "SELECT w.* FROM workflow w WHERE w.lastCommit = ?1 AND w.retrievedFrom ->> 'path' = ?2", nativeQuery = true)
5252
List<Workflow> findByCommitAndPath(String commitId, String path);
5353

5454
/**
@@ -58,7 +58,7 @@ public interface WorkflowRepository extends JpaRepository<Workflow, String> {
5858
* The latest commit ID of the workflow
5959
* @return The workflow model
6060
*/
61-
@Query("select w from Workflow w where w.lastCommit = ?1")
61+
@Query("SELECT w FROM Workflow w WHERE w.lastCommit = ?1")
6262
List<Workflow> findByCommit(String commitId);
6363

6464
/**

0 commit comments

Comments
 (0)