Skip to content

Commit 8de6dfe

Browse files
committed
Running version of the project
1 parent 81aa5cc commit 8de6dfe

Some content is hidden

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

52 files changed

+1906
-176
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
breedpath_sciencedb_bak.tar.bz2
2+
gitted_sub_projs.tar.bz2

Dockerfile.postgres

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM postgres:11.1-alpine
2+
3+
COPY initUserDb.sh /docker-entrypoint-initdb.d/initUserDb.sh
4+
RUN chmod 755 /docker-entrypoint-initdb.d/initUserDb.sh

data_model_definitions/breeding_pool.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"model" : "BeedingPool",
2+
"model" : "BreedingPool",
33
"storageType" : "Sql",
44
"attributes" : {
55
"name" : "String",

data_model_definitions/genotype.json

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
{
2-
"model" : "Genotype",
3-
"storageType" : "Sql",
4-
"attributes" : {
5-
"name" : "String",
6-
"description" : "String",
2+
"model": "Genotype",
3+
"storageType": "Sql",
4+
"attributes": {
5+
"name": "String",
6+
"description": "String",
77
"pedigree_type": "String"
88
},
99

10-
"associations" : {
11-
"mother" : {
12-
"type" : "sql_belongsTo",
13-
"target" : "Individual",
14-
"targetKey" : "mother_id",
15-
"targetStorageType" : "sql",
10+
"associations": {
11+
"mother": {
12+
"type": "sql_belongsTo",
13+
"target": "Individual",
14+
"targetKey": "mother_id",
15+
"targetStorageType": "sql",
1616
"label": "name",
1717
"sublabel": "id"
1818
},
19-
"father" : {
20-
"type" : "sql_belongsTo",
21-
"target" : "Individual",
22-
"targetKey" : "father_id",
23-
"targetStorageType" : "sql",
19+
"father": {
20+
"type": "sql_belongsTo",
21+
"target": "Individual",
22+
"targetKey": "father_id",
23+
"targetStorageType": "sql",
2424
"label": "name",
2525
"sublabel": "id"
2626
},
27-
"breeding_pool" : {
28-
"type" : "sql_belongsTo",
29-
"target" : "BreedingPool",
30-
"targetKey" : "breeding_pool_id",
31-
"targetStorageType" : "sql",
27+
"breeding_pool": {
28+
"type": "sql_belongsTo",
29+
"target": "BreedingPool",
30+
"targetKey": "breeding_pool_id",
31+
"targetStorageType": "sql",
3232
"label": "name",
3333
"sublabel": "id"
3434
}

data_model_definitions/role.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"model" : "Role",
3+
"storageType" : "SQL",
4+
"attributes" : {
5+
"name" : "String",
6+
"description" : "String"
7+
},
8+
"associations" : {
9+
"users" : {
10+
"type" : "sql_belongsToMany",
11+
"target" : "User",
12+
"targetKey" : "userId",
13+
"sourceKey" : "roleId",
14+
"keysIn" : "role_to_user",
15+
"targetStorageType" : "sql"
16+
}
17+
}
18+
}

data_model_definitions/user.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"model" : "User",
3+
"storageType" : "SQL",
4+
"attributes" : {
5+
"email" : "String",
6+
"password" : "String"
7+
},
8+
"associations" :{
9+
"roles" : {
10+
"type" : "sql_belongsToMany",
11+
"target" : "Role",
12+
"targetKey" : "roleId",
13+
"sourceKey" : "userId",
14+
"keysIn" : "role_to_user",
15+
"targetStorageType" : "sql"
16+
}
17+
}
18+
19+
}

docker-compose-dev.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
version: "3.2"
2+
3+
services:
4+
bp_postgres:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile.postgres
8+
volumes:
9+
- bp_db_data:/var/lib/postgresql/data
10+
ports:
11+
- 5432:5432
12+
13+
bp_science_db_graphql_server:
14+
depends_on:
15+
- bp_postgres
16+
build:
17+
context: ./graphql-server
18+
dockerfile: Dockerfile.graphql_server
19+
ports:
20+
- 3000:3000
21+
environment:
22+
- PORT=3000
23+
volumes:
24+
- ./graphql-server:/usr/src/app
25+
# Await POSTGRES role and DB creation, migrate schema, then start web
26+
# server:
27+
command:
28+
- ./migrateDbAndStartServer.sh
29+
30+
bp_science_db_app_server:
31+
depends_on:
32+
- bp_postgres
33+
- bp_science_db_graphql_server
34+
build:
35+
context: ./single-page-app
36+
dockerfile: Dockerfile.app
37+
ports:
38+
- 8080:8080
39+
environment:
40+
- PORT=8080
41+
volumes:
42+
- ./single-page-app:/usr/src/app
43+
command: npm run dev
44+
45+
bp_minio:
46+
image: minio/minio:RELEASE.2019-02-20T22-44-29Z
47+
volumes:
48+
- bp_minio_data:/data
49+
ports:
50+
- "9000:9000"
51+
environment:
52+
MINIO_ACCESS_KEY: minio
53+
MINIO_SECRET_KEY: minio123
54+
command: server /data
55+
56+
volumes:
57+
bp_db_data:
58+
bp_minio_data:

docker-compose.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
version: "3.2"
2+
3+
services:
4+
bp_postgres:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile.postgres
8+
volumes:
9+
- bp_db_data:/var/lib/postgresql/data
10+
ports:
11+
- 5432:5432
12+
13+
bp_science_db_graphql_server:
14+
depends_on:
15+
- bp_postgres
16+
build:
17+
context: ./graphql-server
18+
dockerfile: Dockerfile.graphql_server
19+
ports:
20+
- 3000:3000
21+
environment:
22+
- PORT=3000
23+
# Await POSTGRES role and DB creation, migrate schema, then start web
24+
# server:
25+
command:
26+
- ./migrateDbAndStartServer.sh
27+
28+
bp_science_db_app_server:
29+
depends_on:
30+
- bp_postgres
31+
- bp_science_db_graphql_server
32+
build:
33+
context: ./single-page-app
34+
dockerfile: Dockerfile.app
35+
ports:
36+
- 8080:8080
37+
environment:
38+
- PORT=8080
39+
command: npm run dev
40+
41+
bp_minio:
42+
image: minio/minio:RELEASE.2019-02-20T22-44-29Z
43+
volumes:
44+
- bp_minio_data:/data
45+
ports:
46+
- "9000:9000"
47+
environment:
48+
MINIO_ACCESS_KEY: minio
49+
MINIO_SECRET_KEY: minio123
50+
command: server /data
51+
52+
volumes:
53+
bp_db_data:
54+
bp_minio_data:

graphql-server/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ models
1212
models-webservice
1313
resolvers
1414
schemas
15+
test
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM node:11.9.0-stretch-slim
2+
3+
# Create app directory
4+
WORKDIR /usr/src/app
5+
6+
# Copy generated code into the skeleton GraphQL-Server
7+
COPY . .
8+
9+
# Clone the skeleton project and install dependencies
10+
RUN apt-get update && apt-get install -y git procps &&\
11+
chmod u+x ./migrateDbAndStartServer.sh && \
12+
npm install
13+
14+
EXPOSE 3000

graphql-server/acl_rules.js

+29-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,32 @@
11
module.exports = {
22
aclRules: [{
3-
roles: 'admin',
4-
allows: [{
5-
resources: ['users', 'roles'],
6-
permissions: '*'
7-
}]
8-
},
9-
{
10-
roles: 'guest',
11-
allows: [{
12-
resources: ['dogs', 'people'],
13-
permissions: 'read'
14-
}]
15-
}]
3+
roles: 'admin',
4+
allows: [{
5+
resources: ['users', 'roles'],
6+
permissions: '*'
7+
}]
8+
},
9+
{
10+
roles: 'scientist',
11+
allows: [{
12+
resources: ['breeding_pool', 'field_plot', 'genotype',
13+
'individual', 'marker_data', 'measurement',
14+
'nuc_acid_library_result', 'sample',
15+
'sequencing_experiment', 'transcript_count'
16+
],
17+
permissions: ['create', 'update', 'delete']
18+
}]
19+
},
20+
{
21+
roles: 'guest',
22+
allows: [{
23+
resources: ['breeding_pool', 'field_plot', 'genotype',
24+
'individual', 'marker_data', 'measurement',
25+
'nuc_acid_library_result', 'sample',
26+
'sequencing_experiment', 'transcript_count'
27+
],
28+
permissions: 'read'
29+
}]
30+
}
31+
]
1632
}

graphql-server/config/config.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
"username": "sciencedb",
44
"password": "sciencedb",
55
"database": "sciencedb_development",
6-
"host": "127.0.0.1",
6+
"host": "bp_postgres",
77
"dialect": "postgres",
88
"operatorsAliases": false
99
},
1010
"test": {
1111
"username": "sciencedb",
1212
"password": "sciencedb",
1313
"database": "sciencedb_test",
14-
"host": "postgres",
14+
"host": "bp_postgres",
1515
"dialect": "postgres",
1616
"operatorsAliases": false
1717
},
1818
"production": {
1919
"username": "sciencedb",
2020
"password": "sciencedb",
2121
"database": "sciencedb_production",
22-
"host": "postgres",
22+
"host": "bp_postgres",
2323
"dialect": "postgres",
2424
"operatorsAliases": false
2525
}

graphql-server/config/globals.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
module.exports = {
2-
LIMIT_RECORDS : process.env.LIMIT_RECORDS || 10000
2+
LIMIT_RECORDS : process.env.LIMIT_RECORDS || 10000,
3+
4+
MAIL_SERVICE: "gmail",
5+
MAIL_HOST: "smtp.gmail.com",
6+
MAIL_ACCOUNT: "[email protected]",
7+
MAIL_PASSWORD: "SciDbServiceQAZ"
38
}

graphql-server/migrateDbAndStartServer.sh

+17-9
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,27 @@
44
waited=0
55
until node ./utils/testSequelizeDbServerAvailable.js
66
do
7-
if [ $waited == 240 ]; then
8-
echo -e '\nERROR: Time out reached while waiting for relational database server to be available.\n'
9-
exit 1
10-
fi
11-
sleep 2
12-
waited=$(expr $waited + 2)
7+
if [ $waited == 240 ]; then
8+
echo -e '\nERROR: Time out reached while waiting for relational database server to be available.\n'
9+
exit 1
10+
fi
11+
sleep 2
12+
waited=$(expr $waited + 2)
1313
done
1414

1515
# Run the migrations
1616
if ! ./node_modules/.bin/sequelize db:migrate; then
17-
echo -e '\nERROR: Migrating the relational database(s) caused an error.\n'
18-
exit 1
17+
echo -e '\nERROR: Migrating the relational database(s) caused an error.\n'
18+
exit 1
19+
fi
20+
21+
# Run seeders if needed
22+
if [ -d ./seeders ]; then
23+
if ! ./node_modules/.bin/sequelize db:seed:all; then
24+
echo -e '\nERROR: Seeding the relational database(s) caused an error.\n'
25+
exit 1
26+
fi
1927
fi
2028

2129
# Start GraphQL-server
22-
npm start
30+
npm start acl

graphql-server/package.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@
3535
"supertest": "^3.1.0",
3636
"uuidv4": "^2.0.0",
3737
"xlsx": "^0.12.11",
38-
"sync-request": "^6.0.0"
38+
"sync-request": "^6.0.0",
39+
"nodemailer" : "^5.1.1",
40+
"nodemailer-smtp-transport": "^2.7.4"
3941
},
4042
"devDependencies": {
41-
"mocha": "^5.2.0"
43+
"mocha": "^5.2.0",
44+
"axios": "^0.18.0",
45+
"form-data": "^2.3.2-rc1"
4246
}
4347
}

0 commit comments

Comments
 (0)