You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-51Lines changed: 31 additions & 51 deletions
Original file line number
Diff line number
Diff line change
@@ -1,53 +1,29 @@
1
1
# FAIR MAST Data Management System
2
2
3
-
## Overview
4
-
5
-
6
3
## Development Setup
7
4
8
-
### Mac Users:
5
+
### Mac Users
9
6
10
-
If you are using Mac for development, use [podman](https://podman.io/docs/installation) instead of docker. Follow the installation guide to set it up, then follow the below set up.
7
+
If you are using Mac for development, use [podman](https://podman.io/docs/installation) instead of docker. Follow the installation guide to set it up, then follow the below set up.
11
8
12
-
### Linux/Windows Users:
9
+
### Linux/Windows Users
13
10
14
11
If using Linux or Windows, you need to make sure you have [docker](https://www.docker.com/get-started/) and `docker-compose` installed on your system.
15
12
16
13
### Setup
17
14
18
-
We will be using the Python package manager [uv](https://astral.sh/blog/uv) to install our dependencies. As a first step, make sure this is installed with:
You can use either `conda` or `venv` to set up the environment. Follow the below instructions depending on your preference.
29
-
### Option 1: Using Conda
30
-
Assuming you already have conda installed on your system:
31
-
```bash
32
-
conda create -n mast python=3.11
33
-
conda activate mast
34
-
uv pip install -r docs/requirements.txt
35
-
```
36
-
37
-
### Option 2: Using venv
38
-
Ensure you are using Python version `3.11`:
39
-
```bash
40
-
uv venv venv
41
-
source venv/bin/activate
42
-
uv pip install -r docs/requirements.txt
43
-
```
44
-
45
-
Use `uv --help` for additional commands, or refer to the documentation if needed.
46
-
47
22
### Start the Data Management System
23
+
48
24
Run the development container to start the postgres database, fastapi, and minio containers locally. The development environment will watch the source directory and automatically reload changes to the API as you work.
49
25
50
-
### Mac Users:
26
+
####Mac Users
51
27
52
28
```bash
53
29
podman compose \
@@ -64,7 +40,7 @@ podman compose -f dev/docker/docker-compose.yml down
64
40
podman volume rm --all
65
41
```
66
42
67
-
### Linux/Windows Users:
43
+
####Linux/Windows Users
68
44
69
45
```bash
70
46
docker-compose \
@@ -76,15 +52,14 @@ up \
76
52
77
53
The following services will be started:
78
54
79
-
- FastAPI REST & GraphQL Server - will start running at `http://localhost:8081`.
80
-
- The REST API documentation is at `http://localhost:8081/redoc`.
81
-
- The GraphQL API documentation is at `http://localhost:8081/graphql`.
82
-
- Postgres Database Server - will start running at `http://localhost:5432`
83
-
- Postgres Admin Server - will start running at `http://localhost:8081/pgadmin`
84
-
- Minio S3 Storage Server - will start running at `http://localhost:9000`.
85
-
- The admin web GUI will be running at `http://localhost:8081/minio/ui`.
55
+
- FastAPI REST & GraphQL Server - will start running at `http://localhost:8081`.
56
+
- The REST API documentation is at `http://localhost:8081/redoc`.
57
+
- The GraphQL API documentation is at `http://localhost:8081/graphql`.
58
+
- Postgres Database Server - will start running at `http://localhost:5432`
59
+
- Postgres Admin Server - will start running at `http://localhost:5050`
86
60
87
61
### Populate the Database
62
+
88
63
To create the database and populate it with content we need to get the metadata files. These are stored in the repository using [Git LFS](https://git-lfs.com).
89
64
90
65
To retrieve these data files, follow the below instructions in your terminal:
@@ -95,35 +70,32 @@ git lfs fetch
95
70
git lfs pull
96
71
```
97
72
98
-
Assuming the files have been pulled successfully, the data files should exist within `tests/mock_data/mini` in the local directory. We can
73
+
Assuming the files have been pulled successfully, the data files should exist within `tests/mock_data/mini` in the local directory. We can
99
74
create the database and ingest data using the following command:
Verify everything is setup correctly by running the unit tests.
115
91
116
-
To run the unit tests, input the following command inside your environment:
92
+
Follow the below instructions to set up the environment.
117
93
118
94
```bash
119
-
python -m pytest -rsx tests/ --data-path="INSERT FULL PATH TO DATA HERE"
95
+
uv run pytest
120
96
```
121
97
122
-
The data path will be will be along the lines of `~/fair-mast/tests/mock_data/mini`.
123
-
124
-
This will run some unit tests for the REST and GraphQL APIs against a testing database, created from the data in `--data-path`.
125
-
126
-
### Production Deployment
98
+
## Production Deployment
127
99
128
100
To run the production container to start the postgres database, fastapi, and minio containers. This will also start an nginx proxy and make sure https is all setup
To also destory the volumes (including the metadatabase) you may add the volumes parameter:
113
+
141
114
```bash
142
115
docker compose --env-file dev/docker/.env.dev -f dev/docker/docker-compose.yml -f dev/docker/docker-compose-prod.yml down --volumes
143
116
```
144
117
145
-
**Note** that every time you destory volumes, the production server will mint a new certificate for HTTPS. Lets Encrypt currently limits this to [5 per week](https://letsencrypt.org/docs/duplicate-certificate-limit/)
118
+
**Note:** Every time you destory volumes, the production server will mint a new certificate for HTTPS. Lets Encrypt currently limits this to [5 per week](https://letsencrypt.org/docs/duplicate-certificate-limit/).
119
+
120
+
You'll need to download and ingest the production data like so:
0 commit comments