Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 59 additions & 12 deletions register-api/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@


## Quick Start (local everything via docker compose)
## Quick Start

These commands bring up everything via Docker compose. It does not allow for local development.

```
source env.sample.noauth
docker-compose build
docker-compose up
```

# Docker
Pre-built docker containers are available.


## Configuration

Most configuration for the service is setup through environment variables.
Expand Down Expand Up @@ -75,23 +73,72 @@ token = s._session.get_auth().get_token()

## Development Setup

### Create a virtual env and install python
### Create a Python Enviroment

If using Conda create a new Conda environment:

```
conda create -f environment.yml
conda activate register-api
```

Otherwise create a Python virtual environment. Your system will need to already have rust installed:

```python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
```

Install the package requirements and the register-api software into the Python environment:

```
pip install -r requirements.txt
pip install -e .
```
### start up a postgres server

### update inis, env files
### Start up the Postgres Server

The docker compose file can be used to load a local development Postgres server without running the register-api application:

### Run the server
.venv/bin/uvicorn main:app --reload
```
docker compose up db -d
```

The database is stored persistently in a named Docker volume.

### Initialize the database

The following script will initialize the Postgres database. You will need to have installed the register-api package into the Python environment for this command to work.

```
python ap/db/init_db.py
```

### Environment Variables

The `env.local_dev` file contains the environment variables necessary for directing the locally running instance of register-api to the Docker launched postgres database as well to a locally running Invenio RDM instance.

Source this file into the shell environment before running the server:

```
source env.local_dev
```

### Run the Server

With dependencies configured and the database running and initialized you can launch the local development version of the register-api server. The `--reload` causes the server to restart when changes to the software are made.

```
uvicorn main:app --reload
```

## Docker Setup
`docker-compose up`

Run Docker compuse without specifying a target:

```
docker-compose up
```

## Database Cleanup

Expand All @@ -104,4 +151,4 @@ docker-compose down -v

# Start fresh
docker-compose up --build
```
```
21 changes: 21 additions & 0 deletions register-api/env.local_dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# API Configuration
export API_V1_STR=/api/v1
export PROJECT_NAME="MDPS Artifact Catalog"

# Database Configuration
# Must be updated fro non-local usage
export DATABASE_URL=postgresql://postgres:[email protected]:5433/mdps_catalog

# Storage Configuration
export STORAGE_PATH=./storage

export DESTINATION_REGISTRY=123.dkr.ecr.us-west-2.amazonaws.com

export JWT_AUTH_TYPE=RDM
export JWT_VALIDATION_URL=
export JWT_ISSUER_URL=
export JWT_CLIENT_ID=
export JWT_GROUPS_KEY=

#RDM Config
export RDM_URL=https://127.0.0.1:5000
3 changes: 2 additions & 1 deletion register-api/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ channels:
- conda-forge
dependencies:
- python<=3.12
- rust
- rust
- psycopg2-binary==2.9.9 # Install here or else get segfaults in psycopg2 module when installed through pip