Skip to content

Commit

Permalink
Update template files
Browse files Browse the repository at this point in the history
  • Loading branch information
TheByronHimes committed Oct 25, 2023
1 parent 4a97d57 commit 500db69
Show file tree
Hide file tree
Showing 9 changed files with 338 additions and 219 deletions.
18 changes: 11 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/python-3-postgres
// Update the VARIANT arg in docker-compose.yml to pick a Python version: 3, 3.8, 3.7, 3.6
{
"name": "metadata-artifact-search-service",
"name": "${localWorkspaceFolderBasename}",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
Expand Down Expand Up @@ -42,6 +42,9 @@
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
"python.testing.pytestPath": "/usr/local/py-utils/bin/pytest",
"python.testing.pytestArgs": [
"--profile"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"editor.formatOnSave": true,
Expand Down Expand Up @@ -80,12 +83,13 @@
"postCreateCommand": "dev_install",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"containerEnv": {
// for testcontainers to connect to the docker host:
"TC_HOST": "host.docker.internal",
"DOCKER_HOST": "unix:///var/run/docker.sock"
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
"enableNonRootDocker": "true",
"moby": true,
"azureDnsAutoDetection": false
}
// details can be found here: https://github.com/devcontainers/features/tree/main/src/docker-outside-of-docker
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
}
}
1 change: 0 additions & 1 deletion .mandatory_files
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# may differ from that of the template repository.

.devcontainer/dev_launcher
.devcontainer/devcontainer.json
.devcontainer/docker-compose.yml
.devcontainer/Dockerfile

Expand Down
21 changes: 13 additions & 8 deletions .readme_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ $summary
$description

## Installation

We recommend using the provided Docker container.

A pre-build version is available at [docker hub](https://hub.docker.com/repository/docker/ghga/$name):
Expand Down Expand Up @@ -42,6 +43,7 @@ $shortname --help
```

## Configuration

### Parameters

The service requires the following configuration parameters:
Expand Down Expand Up @@ -77,19 +79,20 @@ $openapi_doc
$design_description

## Development

For setting up the development environment, we rely on the
[devcontainer feature](https://code.visualstudio.com/docs/remote/containers) of vscode
[devcontainer feature](https://code.visualstudio.com/docs/remote/containers) of VS Code
in combination with Docker Compose.

To use it, you have to have Docker Compose as well as vscode with its "Remote - Containers"
To use it, you have to have Docker Compose as well as VS Code with its "Remote - Containers"
extension (`ms-vscode-remote.remote-containers`) installed.
Then open this repository in vscode and run the command
`Remote-Containers: Reopen in Container` from the vscode "Command Palette".
Then open this repository in VS Code and run the command
`Remote-Containers: Reopen in Container` from the VS Code "Command Palette".

This will give you a full-fledged, pre-configured development environment including:
- infrastructural dependencies of the service (databases, etc.)
- all relevant vscode extensions pre-installed
- pre-configured linting and auto-formating
- all relevant VS Code extensions pre-installed
- pre-configured linting and auto-formatting
- a pre-configured debugger
- automatic license-header insertion

Expand All @@ -101,9 +104,11 @@ if you update dependencies in the [`./pyproject.toml`](./pyproject.toml) or the
[`./requirements-dev.txt`](./requirements-dev.txt), please run it again.

## License

This repository is free to use and modify according to the
[Apache 2.0 License](./LICENSE).

## Readme Generation
This readme is autogenerate, please see [`readme_generation.md`](./readme_generation.md)
## README Generation

This README file is auto-generated, please see [`readme_generation.md`](./readme_generation.md)
for details.
1 change: 1 addition & 0 deletions .static_files
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
.devcontainer/dev_install
.devcontainer/license_header.txt
.devcontainer/Dockerfile
.devcontainer/devcontainer.json

scripts/script_utils/__init__.py
scripts/script_utils/cli.py
Expand Down
158 changes: 134 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ For more information see the OpenAPI spec linked below.


## Installation

We recommend using the provided Docker container.

A pre-build version is available at [docker hub](https://hub.docker.com/repository/docker/ghga/mass):
Expand Down Expand Up @@ -59,31 +60,90 @@ mass --help
```

## Configuration

### Parameters

The service requires the following configuration parameters:
- **`searchable_classes`** *(object)*: A collection of searchable_classes with facetable properties. Can contain additional properties.

- **Additional Properties**: Refer to *[#/definitions/SearchableClass](#definitions/SearchableClass)*.
- **Additional Properties**: Refer to *[#/$defs/SearchableClass](#$defs/SearchableClass)*.

- **`resource_change_event_topic`** *(string)*: Name of the event topic used to track resource deletion and upsertion events.


Examples:

```json
"searchable_resource"
```


- **`resource_deletion_event_type`** *(string)*: The type to use for events with deletion instructions.


Examples:

```json
"searchable_resource_deleted"
```


- **`resource_upsertion_event_type`** *(string)*: The type to use for events with upsert instructions.


Examples:

```json
"searchable_resource_upserted"
```


- **`service_name`** *(string)*: Default: `"mass"`.

- **`service_instance_id`** *(string)*: A string that uniquely identifies this instance across all instances of this service. A globally unique Kafka client ID will be created by concatenating the service_name and the service_instance_id.


Examples:

```json
"germany-bw-instance-001"
```


- **`kafka_servers`** *(array)*: A list of connection strings to connect to Kafka bootstrap servers.

- **Items** *(string)*


Examples:

```json
[
"localhost:9092"
]
```


- **`db_connection_str`** *(string, format: password)*: MongoDB connection string. Might include credentials. For more information see: https://naiveskill.com/mongodb-connection-string/.


Examples:

```json
"mongodb://localhost:27017"
```


- **`db_name`** *(string)*: Name of the database located on the MongoDB server.


Examples:

```json
"my-database"
```


- **`host`** *(string)*: IP of the host. Default: `"127.0.0.1"`.

- **`port`** *(integer)*: Port to expose the server on the specified host. Default: `8080`.
Expand All @@ -100,36 +160,83 @@ The service requires the following configuration parameters:

- **`docs_url`** *(string)*: Path to host the swagger documentation. This is relative to the specified host and port. Default: `"/docs"`.

- **`cors_allowed_origins`** *(array)*: A list of origins that should be permitted to make cross-origin requests. By default, cross-origin requests are not allowed. You can use ['*'] to allow any origin.
- **`cors_allowed_origins`**: A list of origins that should be permitted to make cross-origin requests. By default, cross-origin requests are not allowed. You can use ['*'] to allow any origin. Default: `null`.

- **Items** *(string)*
- **Any of**

- **`cors_allow_credentials`** *(boolean)*: Indicate that cookies should be supported for cross-origin requests. Defaults to False. Also, cors_allowed_origins cannot be set to ['*'] for credentials to be allowed. The origins must be explicitly specified.
- *array*

- **`cors_allowed_methods`** *(array)*: A list of HTTP methods that should be allowed for cross-origin requests. Defaults to ['GET']. You can use ['*'] to allow all standard methods.
- **Items** *(string)*

- **Items** *(string)*
- *null*

- **`cors_allowed_headers`** *(array)*: A list of HTTP request headers that should be supported for cross-origin requests. Defaults to []. You can use ['*'] to allow all headers. The Accept, Accept-Language, Content-Language and Content-Type headers are always allowed for CORS requests.

- **Items** *(string)*
Examples:

```json
[
"https://example.org",
"https://www.example.org"
]
```


- **`cors_allow_credentials`**: Indicate that cookies should be supported for cross-origin requests. Defaults to False. Also, cors_allowed_origins cannot be set to ['*'] for credentials to be allowed. The origins must be explicitly specified. Default: `null`.

- **Any of**

- *boolean*

- *null*


Examples:

```json
[
"https://example.org",
"https://www.example.org"
]
```

## Definitions

- **`cors_allowed_methods`**: A list of HTTP methods that should be allowed for cross-origin requests. Defaults to ['GET']. You can use ['*'] to allow all standard methods. Default: `null`.

- <a id="definitions/FacetLabel"></a>**`FacetLabel`** *(object)*: Contains the key and corresponding user-friendly name for a facet.
- **Any of**

- **`key`** *(string, required)*: The raw facet key, such as study.type.
- *array*

- **`name`** *(string)*: The user-friendly name for the facet. Default: `""`.
- **Items** *(string)*

- <a id="definitions/SearchableClass"></a>**`SearchableClass`** *(object)*: Represents a searchable artifact or resource type.
- *null*

- **`description`** *(string, required)*: A brief description of the resource type.

- **`facetable_properties`** *(array, required)*: A list of of the facetable properties for the resource type.
Examples:

```json
[
"*"
]
```


- **`cors_allowed_headers`**: A list of HTTP request headers that should be supported for cross-origin requests. Defaults to []. You can use ['*'] to allow all headers. The Accept, Accept-Language, Content-Language and Content-Type headers are always allowed for CORS requests. Default: `null`.

- **Any of**

- *array*

- **Items** *(string)*

- *null*


Examples:

```json
[]
```

- **Items**: Refer to *[#/definitions/FacetLabel](#definitions/FacetLabel)*.


### Usage:
Expand Down Expand Up @@ -185,19 +292,20 @@ Typical sequence of events is as follows:


## Development

For setting up the development environment, we rely on the
[devcontainer feature](https://code.visualstudio.com/docs/remote/containers) of vscode
[devcontainer feature](https://code.visualstudio.com/docs/remote/containers) of VS Code
in combination with Docker Compose.

To use it, you have to have Docker Compose as well as vscode with its "Remote - Containers"
To use it, you have to have Docker Compose as well as VS Code with its "Remote - Containers"
extension (`ms-vscode-remote.remote-containers`) installed.
Then open this repository in vscode and run the command
`Remote-Containers: Reopen in Container` from the vscode "Command Palette".
Then open this repository in VS Code and run the command
`Remote-Containers: Reopen in Container` from the VS Code "Command Palette".

This will give you a full-fledged, pre-configured development environment including:
- infrastructural dependencies of the service (databases, etc.)
- all relevant vscode extensions pre-installed
- pre-configured linting and auto-formating
- all relevant VS Code extensions pre-installed
- pre-configured linting and auto-formatting
- a pre-configured debugger
- automatic license-header insertion

Expand All @@ -209,9 +317,11 @@ if you update dependencies in the [`./pyproject.toml`](./pyproject.toml) or the
[`./requirements-dev.txt`](./requirements-dev.txt), please run it again.

## License

This repository is free to use and modify according to the
[Apache 2.0 License](./LICENSE).

## Readme Generation
This readme is autogenerate, please see [`readme_generation.md`](./readme_generation.md)
## README Generation

This README file is auto-generated, please see [`readme_generation.md`](./readme_generation.md)
for details.
Loading

0 comments on commit 500db69

Please sign in to comment.