Skip to content
This repository was archived by the owner on Nov 5, 2022. It is now read-only.

Commit 9f10547

Browse files
faysal-ishtiaqisedwards
authored andcommitted
update readme
1 parent f3ebe31 commit 9f10547

File tree

2 files changed

+45
-70
lines changed

2 files changed

+45
-70
lines changed

README.md

Lines changed: 42 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# opencdms-server
1+
# opencdms-api
22

33
OpenCDMS server uses Python FastAPI to expose a web interface for `opencdms-app` and other supported CDMSs.
44

@@ -13,68 +13,63 @@ The root directory has two main directories:
1313
- `src` : Contains all the applications/CDMS wrappers
1414
- `tests` : Contains all the tests
1515

16-
Apart from these two directories we also have a docker-compose file contianing:
16+
Apart from these two directories we also have three docker-compose files:
1717

18-
- `auth-db` service which is used for authentication
19-
- `climsoft-db` service which should be used for storing Climsoft CDMS data
20-
- `surface-db` service which should be used for storing Surface CDMS data
21-
- `opencdms-server` is the application we are developing
18+
- `docker-compose.yml` For development
19+
- `docker-compose.prod.yml` For production deployment (contains traefik config for https)
20+
- `docker-compose.test.yml` For testing
2221

23-
There is also a `Dockerfile` where we have defined the docker image for `opencdms-server` service
22+
These docker-compose files have all the necessary services to run `opencdms-api`
23+
24+
There is also a `dockerfile` where we have defined the docker image for `opencdms-api` service
2425

2526
*Project root*
2627
```
2728
.
29+
├── create_mch_english_basic_tables.sql
30+
├── docker-compose.prod.yml
31+
├── docker-compose.test.yml
2832
├── docker-compose.yml
29-
├── Dockerfile
30-
├── LICENSE
33+
├── dockerfile
34+
├── entrypoint.sh
35+
├── init_climsoft_db.py
36+
├── makefile
37+
├── mch.dbn
38+
├── mch.dockerfile
39+
├── MCHtablasycampos.def
40+
├── poetry.lock
41+
├── pyproject.toml
3142
├── README.md
43+
├── requirements-old.txt
3244
├── requirements.txt
45+
├── scripts
46+
│ └── load_initial_surface_data.sh
3347
├── src
34-
│ ├── apps
35-
│ ├── db
36-
│ ├── main.py
37-
│ └── utils
38-
└── tests
39-
├── app-name
40-
├── ...other apps...
41-
├── conftest.py
42-
└── datagen
43-
44-
```
48+
│ └── opencdms_api
49+
│ ├── config.py
50+
│ ├── db.py
51+
│ ├── deps.py
52+
│ ├── __init__.py
53+
│ ├── main.py
54+
│ ├── middelware.py
55+
│ ├── models.py
56+
│ ├── router.py
57+
│ ├── schema.py
58+
│ └── templates
59+
├── tests
60+
│ ├── conftest.py
61+
│ ├── __init__.py
62+
│ └── test_router.py
63+
└── traefik
64+
└── traefik.toml
4565
46-
In the app specific directory, the file structure is like below
47-
48-
*App root*
49-
50-
```
51-
.
52-
├── controllers
53-
├── db
54-
├── schemas
55-
└── services
5666
5767
```
5868

59-
Controllers directory holds all the routes that we define. Routes are meant to handle application logic, i.e. authorization, data validation etc.
60-
61-
DB directory contains the DB configuration for respective app
62-
63-
Schemas directory contains all the DTOs defined as Pydantic Model
64-
65-
Services directory contains the business logic
66-
6769
### Running Development Server
6870

6971
The easiest way to go is running `docker-compose up -d --build`
7072

71-
The MCH database cannot be populated automatically. To populate the MCH database, do the following:
72-
73-
```bash
74-
$ docker exec -it mchdb bash
75-
$ mysql -u root -p mch < /scripts/create_mch_english_basic_tables.sql
76-
```
77-
7873
Also, you can do the following:
7974

8075
```bash
@@ -92,26 +87,6 @@ Note: You have to run database instance separately. Go to this repository for de
9287

9388
Each master release should pass all the To check if the tests are as expected or to add new feature or to fix some issue, you can run the tests on your own.
9489

95-
Follow these steps:
96-
97-
```bash
98-
$ pip3 install virtualenv
99-
$ virtualenv venv
100-
$ source venv/bin/activate
101-
$ pip install -r requirements.txt
102-
$ docker-compose down -v
103-
$ docker-compose up -d --build
104-
$ pytest tests/integration
105-
```
106-
107-
Additionally, you can run snapshot We have collected a subset of data from production climsoft instance and we will run query on them to check if we are getting expected result.
108-
109-
- From outside your project, run `git clone https://github.com/opencdms/opencdms-test-data`
110-
- `cd opencdms-test-data`
111-
- `docker-compose down -v`
112-
- `docker-compose up climsoft-4.1.1 --build`
113-
- Go to the project root `opencdms-server`
114-
- `source venv/bin/activate`
115-
- `export CLIMSOFT_DB_URI=mysql+mysqldb://root:password@127.0.0.1:33308/mariadb_climsoft_test_db_v4`
116-
- `pytest tests/snapshot`
90+
To run the tests, you just need to run `docker-compose -f docker-compose.test.yml up --build`
11791

92+
Check the logs for error.

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ services:
1818
- SURFACE_DB_NAME=surface
1919
- SURFACE_DB_USER=dba
2020
- SURFACE_DB_PASSWORD=dba
21-
- SURFACE_DB_HOST=surfacedb
21+
- SURFACE_DB_HOST=opencdms_surfacedb
2222
- SURFACE_DB_PORT=5432
2323
- MCH_DB_PORT=3306
24-
- MCH_DB_HOST=mchdb
24+
- MCH_DB_HOST=opencdms_mchdb
2525
- MCH_DB_NAME=mch
26-
- MCH_DB_PASSWORD=password
26+
- MCH_DB_PASSWORD=root_password
2727
- MCH_DB_USER=root
2828
- APP_SECRET=app-secret
2929
- SURFACE_SECRET_KEY=surface-secret-key

0 commit comments

Comments
 (0)