Skip to content
Open
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
6 changes: 3 additions & 3 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ component_lifecycle: experimental
component_owner: group:default/data_analysis
component_type: service
description: An API for small fast data analysis jobs at Diamond Light Source
distribution_name: indigoapi
distribution_name: heliotrapi
docker: true
docker_debug: false
docs_type: README
git_platform: github.com
github_org: DiamondLightSource
package_name: indigoapi
package_name: heliotrapi
pypi: true
repo_name: indigoapi
repo_name: heliotrapi
strict_typing: false
type_checker: pyright
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Contribute to the project

Contributions and issues are most welcome! All issues and pull requests are
handled through [GitHub](https://github.com/DiamondLightSource/indigoapi/issues). Also, please check for any existing issues before
handled through [GitHub](https://github.com/DiamondLightSource/heliotrapi/issues). Also, please check for any existing issues before
filing a new one. If you have a great idea but it involves big changes, please
file a ticket before making a pull request! We want to make sure you don't spend
your time coding something that might not fit the scope of the project.

## Issue or Discussion?

Github also offers [discussions](https://github.com/DiamondLightSource/indigoapi/discussions) as a place to ask questions and share ideas. If
Github also offers [discussions](https://github.com/DiamondLightSource/heliotrapi/discussions) as a place to ask questions and share ideas. If
your issue is open ended and it is not obvious when it can be "closed", please
raise it as a discussion instead.

Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,19 @@ COPY --chown=1000:1000 --from=build /app/.venv /app/.venv
RUN chmod -R 777 /app
ENV PATH=/app/.venv/bin:$PATH

# Add copy of indigoapi source to container for debugging
# Add copy of heliotrapi source to container for debugging
WORKDIR /workspaces
COPY --chown=1000:1000 . indigoapi
COPY --chown=1000:1000 . heliotrapi
# Make allowance for non-1000 uid
RUN chmod o+wrX indigoapi
RUN chmod o+wrX heliotrapi

# Make invariant symlink to site-packages for debugging
# /app/.venv/lib/python/site-packages/indigoapi:/workspaces/indigoapi
# /app/.venv/lib/python/site-packages/heliotrapi:/workspaces/heliotrapi
WORKDIR /app/.venv/lib
RUN ln -s python* python

# Switch user 1000
USER ubuntu

ENTRYPOINT ["indigoapi"]
ENTRYPOINT ["heliotrapi"]
CMD ["serve"]
4 changes: 2 additions & 2 deletions FRONTEND.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ The API includes a web frontend hosted at the root path (`/`).
- **Type-Aware Inputs**: Automatically converts form inputs to appropriate types (int, float, bool, list)
- **Beautiful UI**: Modern gradient design with smooth animations and transitions

## Accessing the Frontend
## Accessing the Frontend

Once the API server is running:

```bash
indigoapi serve
heliotrapi serve
```

Open your browser and navigate to:
Expand Down
46 changes: 23 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
[![CI](https://github.com/DiamondLightSource/indigoapi/actions/workflows/ci.yml/badge.svg)](https://github.com/DiamondLightSource/indigoapi/actions/workflows/ci.yml)
[![Coverage](https://codecov.io/gh/DiamondLightSource/indigoapi/branch/main/graph/badge.svg)](https://codecov.io/gh/DiamondLightSource/indigoapi)
[![PyPI](https://img.shields.io/pypi/v/indigoapi.svg)](https://pypi.org/project/indigoapi)
[![CI](https://github.com/DiamondLightSource/heliotrapi/actions/workflows/ci.yml/badge.svg)](https://github.com/DiamondLightSource/heliotrapi/actions/workflows/ci.yml)
[![Coverage](https://codecov.io/gh/DiamondLightSource/heliotrapi/branch/main/graph/badge.svg)](https://codecov.io/gh/DiamondLightSource/heliotrapi)
[![PyPI](https://img.shields.io/pypi/v/heliotrapi.svg)](https://pypi.org/project/heliotrapi)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)

# indigoapi
# heliotrapi

An API for small fast data analysis jobs at Diamond Light Source.

`indigoapi` exposes an HTTP API to submit analysis jobs, return queued results, and optionally consume messages from RabbitMQ.
`heliotrapi` exposes an HTTP API to submit analysis jobs, return queued results, and optionally consume messages from RabbitMQ.

Source | <https://github.com/DiamondLightSource/indigoapi>
Source | <https://github.com/DiamondLightSource/heliotrapi>
:---: | :---:
PyPI | `pip install indigoapi`
Docker | `docker run ghcr.io/diamondlightsource/indigoapi:latest`
Releases | <https://github.com/DiamondLightSource/indigoapi/releases>
PyPI | `pip install heliotrapi`
Docker | `docker run ghcr.io/diamondlightsource/heliotrapi:latest`
Releases | <https://github.com/DiamondLightSource/heliotrapi/releases>

Example Python usage:

```python
from indigoapi import __version__
from heliotrapi import __version__

print(f"Hello indigoapi {__version__}")
print(f"Hello heliotrapi {__version__}")
```

To start the api server in dev mode on local host:

```bash
uvicorn indigoapi.main:start_api --reload --factory --host 127.0.0.1 --port 8000
uvicorn heliotrapi.main:start_api --reload --factory --host 127.0.0.1 --port 8000

or

indigoapi serve
heliotrapi serve

```

Expand All @@ -42,7 +42,7 @@ The app accepts analysis jobs via HTTP or the client and stores results in memor

```python

from indigoapi.client import AnalysisClient
from heliotrapi.client import AnalysisClient

client = AnalysisClient("ixx-analysis.diamond.ac.uk")

Expand Down Expand Up @@ -73,7 +73,7 @@ You can also navigate to the url or the ip address to be met with:
AnalysisClient ─────--────────────────
│ ▲ │ │
▼ │ ▼ ▼
Analysis <-── IndigoAPI ──---► RabbitMQ ──---► Results
Analysis <-── heliotrapi ──---► RabbitMQ ──---► Results
Job ─---► ▲ │
│ │
│ │
Expand All @@ -82,7 +82,7 @@ You can also navigate to the url or the ip address to be met with:

## Kubernetes deployment

This repository includes a Helm chart under `./helm/helm/indigoapi`.
This repository includes a Helm chart under `./helm/helm/heliotrapi`.

### Config support

Expand Down Expand Up @@ -124,26 +124,26 @@ config:
1. Build and push your Docker image

```bash
podman build -t ghcr.io/diamondlightsource/indigoapi:latest .
podman push ghcr.io/diamondlightsource/indigoapi:latest
podman build -t ghcr.io/diamondlightsource/heliotrapi:latest .
podman push ghcr.io/diamondlightsource/heliotrapi:latest
```

2. Render the chart

```bash
helm template indigoapi ./helm/helm/indigoapi
helm template heliotrapi ./helm/helm/heliotrapi
```

3. Dry-run validation

```bash
helm template indigoapi ./helm/helm/indigoapi | kubectl apply --dry-run=client -f -
helm template heliotrapi ./helm/helm/heliotrapi | kubectl apply --dry-run=client -f -
```

4. Install the chart

```bash
helm install indigoapi ./helm/helm/indigoapi
helm install heliotrapi ./helm/helm/heliotrapi
```

5. Verify the deployment
Expand All @@ -156,7 +156,7 @@ kubectl get svc
6. Test the API

```bash
kubectl port-forward svc/indigoapi 8000:8000
kubectl port-forward svc/heliotrapi 8000:8000
```

Then open:
Expand All @@ -167,6 +167,6 @@ http://localhost:8000/docs

## Notes

- The chart name has been updated to `indigoapi`.
- The chart name has been updated to `heliotrapi`.
- The config file is mounted via a `ConfigMap` and loaded from `/etc/config/config.yaml`.
- The Helm chart currently creates a `Deployment`, `Service`, and `ConfigMap`.
4 changes: 2 additions & 2 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: indigoapi
title: indigoapi
name: heliotrapi
title: heliotrapi
description: An API for small fast data analysis jobs at Diamond Light Source
spec:
type: service
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion helm/indigoapi/Chart.yaml → helm/heliotrapi/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
name: indigoapi
name: heliotrapi
description: A Helm chart for Kubernetes
type: application

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "indigoapi.name" -}}
{{- define "heliotrapi.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Expand the name of the chart.
*/}}
{{- define "indigoapi.fullname" -}}
{{- define "heliotrapi.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -24,16 +24,16 @@ Expand the name of the chart.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "indigoapi.chart" -}}
{{- define "heliotrapi.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "indigoapi.labels" -}}
helm.sh/chart: {{ include "indigoapi.chart" . }}
{{ include "indigoapi.selectorLabels" . }}
{{- define "heliotrapi.labels" -}}
helm.sh/chart: {{ include "heliotrapi.chart" . }}
{{ include "heliotrapi.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -43,17 +43,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "indigoapi.selectorLabels" -}}
app.kubernetes.io/name: {{ include "indigoapi.name" . }}
{{- define "heliotrapi.selectorLabels" -}}
app.kubernetes.io/name: {{ include "heliotrapi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "indigoapi.serviceAccountName" -}}
{{- define "heliotrapi.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "indigoapi.fullname" .) .Values.serviceAccount.name }}
{{- default (include "heliotrapi.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "indigoapi.fullname" . }}-config
name: {{ include "heliotrapi.fullname" . }}-config
data:
config.yaml: |-
{{- toYaml .Values.config | nindent 4 }}
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "indigoapi.fullname" . }}
name: {{ include "heliotrapi.fullname" . }}
labels:
{{- include "indigoapi.labels" . | nindent 4 }}
{{- include "heliotrapi.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "indigoapi.selectorLabels" . | nindent 6 }}
{{- include "heliotrapi.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "indigoapi.labels" . | nindent 8 }}
{{- include "heliotrapi.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -71,7 +71,7 @@ spec:
projected:
sources:
- configMap:
name: {{ include "indigoapi.fullname" . }}-config
name: {{ include "heliotrapi.fullname" . }}-config
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand All @@ -84,7 +84,7 @@ spec:
- key: app.kubernetes.io/name
operator: In
values:
- indigoapi
- heliotrapi
- key: app.kubernetes.io/instance
operator: In
values:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "indigoapi.fullname" . }}
name: {{ include "heliotrapi.fullname" . }}
labels:
{{- include "indigoapi.labels" . | nindent 4 }}
{{- include "heliotrapi.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down Expand Up @@ -35,7 +35,7 @@ spec:
{{- end }}
backend:
service:
name: {{ include "indigoapi.fullname" $ }}
name: {{ include "heliotrapi.fullname" $ }}
port:
number: {{ $.Values.service.port }}
{{- end }}
Expand Down
13 changes: 13 additions & 0 deletions helm/heliotrapi/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: { { include "heliotrapi.fullname" . } }
labels: { { - include "heliotrapi.labels" . | nindent 4 } }
spec:
type: { { .Values.service.type } }
ports:
- port: { { .Values.service.port } }
targetPort: http
protocol: TCP
name: http
selector: { { - include "heliotrapi.selectorLabels" . | nindent 4 } }
2 changes: 1 addition & 1 deletion helm/indigoapi/values.yaml → helm/heliotrapi/values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
replicaCount: 1

image:
repository: ghcr.io/diamondlightsource/indigoapi
repository: ghcr.io/diamondlightsource/heliotrapi
pullPolicy: Always
tag: ""

Expand Down
15 changes: 0 additions & 15 deletions helm/indigoapi/templates/service.yaml

This file was deleted.

Loading
Loading