diff --git a/.github/workflows/build-deviceregistry.yml b/.github/workflows/build-deviceregistry.yml deleted file mode 100644 index 066fbf6..0000000 --- a/.github/workflows/build-deviceregistry.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Build and push deviceregistry image - -on: - push: - branches: - - 'main' - # Publish semver tags as releases. - tags: - - 'v*.*.*' - paths_ignore: - - 'mittaridatapumppu-*/**' - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }}-deviceregistry - -jobs: - build-and-push: - - runs-on: ubuntu-latest - - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - # Login against a Docker registry - # https://github.com/docker/login-action - - name: Log into registry ${{ env.REGISTRY }} - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - # Build and push Docker image - # https://github.com/docker/build-push-action - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/build-endpoint.yml b/.github/workflows/build-endpoint.yml deleted file mode 100644 index 700d3aa..0000000 --- a/.github/workflows/build-endpoint.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Build and push endpoint image - -on: - push: - branches: - - 'main' - # Publish semver tags as releases. - tags: - - 'v*.*.*' - paths: - - 'mittaridatapumppu-endpoint/**' - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }}-endpoint - -jobs: - build-and-push: - - runs-on: ubuntu-latest - - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - repository: 'City-of-Helsinki/mittaridatapumppu-endpoint' - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - # Login against a Docker registry - # https://github.com/docker/login-action - - name: Log into registry ${{ env.REGISTRY }} - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - # Build and push Docker image - # https://github.com/docker/build-push-action - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/build-parser.yml b/.github/workflows/build-parser.yml deleted file mode 100644 index 7ed29ce..0000000 --- a/.github/workflows/build-parser.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Build and push parser image - -on: - push: - branches: - - 'main' - # Publish semver tags as releases. - tags: - - 'v*.*.*' - paths: - - 'mittaridatapumppu-parser/**' - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }}-parser - -jobs: - build-and-push: - - runs-on: ubuntu-latest - - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - repository: 'City-of-Helsinki/mittaridatapumppu-parser' - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - # Login against a Docker registry - # https://github.com/docker/login-action - - name: Log into registry ${{ env.REGISTRY }} - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - # Build and push Docker image - # https://github.com/docker/build-push-action - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/build-persister.yml b/.github/workflows/build-persister.yml deleted file mode 100644 index 76e9934..0000000 --- a/.github/workflows/build-persister.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Build and push persister image - -on: - push: - branches: - - 'main' - # Publish semver tags as releases. - tags: - - 'v*.*.*' - paths: - - 'mittaridatapumppu-persister/**' - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }}-persister - -jobs: - build-and-push: - - runs-on: ubuntu-latest - - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - repository: 'City-of-Helsinki/mittaridatapumppu-persister' - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - # Login against a Docker registry - # https://github.com/docker/login-action - - name: Log into registry ${{ env.REGISTRY }} - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - # Build and push Docker image - # https://github.com/docker/build-push-action - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/test-deviceregistry.yml b/.github/workflows/test-deviceregistry.yml deleted file mode 100644 index ab5f121..0000000 --- a/.github/workflows/test-deviceregistry.yml +++ /dev/null @@ -1,73 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: Device registry CI - -# Controls when the workflow will run -on: - # Triggers the workflow on push or pull request events but only for the "main" branch - push: - branches: [ "main" ] - tags: [ "v*" ] - pull_request: - branches: [ "main" ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - tests: - # The type of runner that the job will run on - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.10", "3.11"] - env: - DJANGO_SETTINGS_MODULE: "deviceregistry.settings" - services: - # Label used to access the service container - db: - # Docker Hub image - image: postgis/postgis:16-3.4-alpine - # Provide the password for postgres - env: - POSTGRES_PASSWORD: postgres - # Set health checks to wait until postgres has started - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - # Tests run directly on the runner so we have to map the port - - 5432:5432 - steps: - - uses: actions/checkout@v3 - - uses: awalsh128/cache-apt-pkgs-action@v1.3.0 - with: - packages: libgdal-dev libgeos-dev libproj-dev - version: 1.0 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - - name: Install dependencies - run: | - python -m pip install --upgrade pip setuptools wheel - pip install ruff pytest - pip install -r requirements.txt - - name: Lint with ruff - run: | - # stop the build if there are Python syntax errors or undefined names - ruff check --output-format=github --select=E9,F63,F7,F82 . - # default set of ruff rules with GitHub Annotations - ruff check --output-format=github . - - name: Test with pytest - env: - DJANGO_DB_HOST: localhost - DJANGO_DB_PORT: 5432 - MEDIA_ROOT: /tmp - run: | - pytest diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2d5a26e..d1bb26c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -90,6 +90,7 @@ curl http://127.0.0.1:8000/api/v1/devices/70B3D57050011422/ -H "Authorization:To ```shell python mittaridatapumppu-endpoint/tests/test_api2.py ``` +docker run --rm -e API_BASE_URL -e API_TOKEN ghcr.io/city-of-helsinki/mittaridatapumppu-endpoint python tests/test_api2.py Check docker logs what happens. diff --git a/Dockerfile b/Dockerfile index bf4a135..07d31e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,7 +39,7 @@ WORKDIR /home/app COPY --chown=app:app requirements.txt . RUN pip install --no-cache-dir --no-compile --upgrade -r requirements.txt -COPY --chown=app:app mittaridatapumppu-deviceregistry/ . +COPY --chown=app:app . . # Support Arbitrary User IDs RUN chgrp -R 0 /home/app && \ diff --git a/README.md b/README.md index cdacfc9..d59026b 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,10 @@ The following repositories contain the services for the data pipeline shown in d Go To [test set up](tests/README.md) ``` +pip install pre-commit +pre-commit install pip-compile pip-compile --extra dev --output-file requirements-dev.txt +pip-sync +pre-commit run --all-files ``` diff --git a/deploy/.helmignore b/deploy/.helmignore deleted file mode 100644 index 0e8a0eb..0000000 --- a/deploy/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/deploy/Chart.lock b/deploy/Chart.lock deleted file mode 100644 index 0777388..0000000 --- a/deploy/Chart.lock +++ /dev/null @@ -1,6 +0,0 @@ -dependencies: -- name: postgresql - repository: https://charts.bitnami.com/bitnami - version: 12.5.3 -digest: sha256:f901b326760f12d3d4411669b5e356ed6add8570f6c72a0642aefc280dc9768f -generated: "2023-06-21T10:38:50.320898+03:00" diff --git a/deploy/Chart.yaml b/deploy/Chart.yaml deleted file mode 100644 index bad6a63..0000000 --- a/deploy/Chart.yaml +++ /dev/null @@ -1,30 +0,0 @@ -apiVersion: v2 -name: mittaridatapumppu -description: A Helm chart for Kubernetes - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. -appVersion: "1.16.0" - -dependencies: - - name: postgresql - version: "12.5.3" - repository: https://charts.bitnami.com/bitnami - condition: postgresql.enabled diff --git a/deploy/templates/NOTES.txt b/deploy/templates/NOTES.txt deleted file mode 100644 index 38df759..0000000 --- a/deploy/templates/NOTES.txt +++ /dev/null @@ -1,22 +0,0 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} - {{- end }} -{{- end }} -{{- else if contains "NodePort" .Values.endpoint.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "mittaridatapumppu.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.endpoint.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "mittaridatapumppu.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "mittaridatapumppu.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.endpoint.service.port }} -{{- else if contains "ClusterIP" .Values.endpoint.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "mittaridatapumppu.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT -{{- end }} diff --git a/deploy/templates/_helpers.tpl b/deploy/templates/_helpers.tpl deleted file mode 100644 index d3c22c0..0000000 --- a/deploy/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "mittaridatapumppu.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "mittaridatapumppu.fullname" -}} -{{- if .Values.fullnameOverride }} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "mittaridatapumppu.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "mittaridatapumppu.labels" -}} -helm.sh/chart: {{ include "mittaridatapumppu.chart" . }} -{{ include "mittaridatapumppu.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "mittaridatapumppu.selectorLabels" -}} -app.kubernetes.io/name: {{ include "mittaridatapumppu.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "mittaridatapumppu.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "mittaridatapumppu.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/deploy/templates/configmap.yaml b/deploy/templates/configmap.yaml deleted file mode 100644 index e008d47..0000000 --- a/deploy/templates/configmap.yaml +++ /dev/null @@ -1,27 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "mittaridatapumppu.fullname" . }}-configmap -data: - ALLOWED_IP_ADDRESSES: "{{ .Values.endpoint.allowedIpAddresses }}" - ENDPOINT_CONFIG_URL: "{{ .Values.endpoint.endpointConfigUrl }}" - KAFKA_BOOTSTRAP_SERVERS: "{{ .Values.kafka.kafkaBootstrapServers }}" - KAFKA_GROUP_ID: "{{ .Values.kafka.kafkaGroupId }}" - KAFKA_PARSED_DATA_TOPIC_NAME: "{{ .Values.kafka.kafkaParsedDataTopicName }}" - KAFKA_RAW_DATA_TOPIC_NAME: "{{ .Values.kafka.kafkaRawDataTopicName }}" - DEVICE_REGISTRY_URL: "{{ .Values.parser.deviceRegistryUrl }}" - DEVICE_REGISTRY_TOKEN: "{{ .Values.parser.deviceRegistryToken }}" - DJANGO_SETTINGS_MODULE: "{{ .Values.deviceregistry.djangoSettingsModule }}" - DJANGO_DB_HOST: "{{ .Release.Name }}-{{ .Values.deviceregistry.databaseHost }}" - DJANGO_DB_USER: "{{ .Values.deviceregistry.databaseUser }}" - DJANGO_DB_PASSWORD: "{{ .Values.deviceregistry.databasePassword }}" - DJANGO_DB_PORT: "{{ .Values.deviceregistry.databasePort }}" - DJANGO_DB_NAME: "{{ .Values.deviceregistry.databaseName }}" - ALLOWED_HOSTS: "{{ .Values.deviceregistry.allowedHosts | toStrings }}" - SECRET_KEY: "{{ .Values.deviceregistry.secretKey }}" - INFLUX_BUCKET: "{{ .Values.persister.influxBucket }}" - INFLUX_HOST: "{{ .Values.persister.influxHost }}" - INFLUX_ORG: "{{ .Values.persister.influxOrg }}" - INFLUX_TOKEN: "{{ .Values.persister.influxToken }}" - DEBUG: 1 - UVICORN_LOG_LEVEL: "debug" diff --git a/deploy/templates/deviceregistry-deployment.yaml b/deploy/templates/deviceregistry-deployment.yaml deleted file mode 100644 index cd6b877..0000000 --- a/deploy/templates/deviceregistry-deployment.yaml +++ /dev/null @@ -1,64 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "mittaridatapumppu.fullname" . }}-deviceregistry - labels: - {{- include "mittaridatapumppu.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "mittaridatapumppu.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "mittaridatapumppu.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "mittaridatapumppu.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.deviceregistry.image.repository }}:{{ .Values.deviceregistry.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.deviceregistry.image.pullPolicy }} - ports: - - name: http - containerPort: {{ .Values.deviceregistry.service.port }} - protocol: TCP - # livenessProbe: - # httpGet: - # path: / - # port: http - # readinessProbe: - # httpGet: - # path: / - # port: http - resources: - {{- toYaml .Values.resources | nindent 12 }} - envFrom: - - configMapRef: - name: {{ include "mittaridatapumppu.fullname" . }}-configmap - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/deploy/templates/deviceregistry-service.yaml b/deploy/templates/deviceregistry-service.yaml deleted file mode 100644 index fd25173..0000000 --- a/deploy/templates/deviceregistry-service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "mittaridatapumppu.fullname" . }}-deviceregistry - labels: - {{- include "mittaridatapumppu.labels" . | nindent 4 }} -spec: - type: {{ .Values.deviceregistry.service.type }} - ports: - - port: {{ .Values.deviceregistry.service.port }} - targetPort: 8000 - protocol: TCP - name: http - selector: - {{- include "mittaridatapumppu.selectorLabels" . | nindent 4 }} diff --git a/deploy/templates/endpoint-deployment.yaml b/deploy/templates/endpoint-deployment.yaml deleted file mode 100644 index 3149630..0000000 --- a/deploy/templates/endpoint-deployment.yaml +++ /dev/null @@ -1,64 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "mittaridatapumppu.fullname" . }}-endpoint - labels: - {{- include "mittaridatapumppu.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "mittaridatapumppu.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "mittaridatapumppu.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "mittaridatapumppu.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.endpoint.image.repository }}:{{ .Values.endpoint.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.endpoint.image.pullPolicy }} - ports: - - name: http - containerPort: {{ .Values.endpoint.service.port }} - protocol: TCP - # livenessProbe: - # httpGet: - # path: / - # port: http - # readinessProbe: - # httpGet: - # path: / - # port: http - resources: - {{- toYaml .Values.resources | nindent 12 }} - envFrom: - - configMapRef: - name: {{ include "mittaridatapumppu.fullname" . }}-configmap - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/deploy/templates/endpoint-service.yaml b/deploy/templates/endpoint-service.yaml deleted file mode 100644 index 184448c..0000000 --- a/deploy/templates/endpoint-service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "mittaridatapumppu.fullname" . }}-endpoint - labels: - {{- include "mittaridatapumppu.labels" . | nindent 4 }} -spec: - type: {{ .Values.endpoint.service.type }} - ports: - - port: {{ .Values.endpoint.service.port }} - targetPort: 8000 - protocol: TCP - name: http - selector: - {{- include "mittaridatapumppu.selectorLabels" . | nindent 4 }} diff --git a/deploy/templates/hpa.yaml b/deploy/templates/hpa.yaml deleted file mode 100644 index 2f96cb5..0000000 --- a/deploy/templates/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "mittaridatapumppu.fullname" . }} - labels: - {{- include "mittaridatapumppu.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "mittaridatapumppu.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/deploy/templates/ingress.yaml b/deploy/templates/ingress.yaml deleted file mode 100644 index bd8fef4..0000000 --- a/deploy/templates/ingress.yaml +++ /dev/null @@ -1,61 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "mittaridatapumppu.fullname" . -}} -{{- $svcPort := .Values.endpoint.service.port -}} -{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} - {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} - {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} - {{- end }} -{{- end }} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - {{- include "mittaridatapumppu.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} - ingressClassName: {{ .Values.ingress.className }} - {{- end }} - {{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} - {{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ .path }} - {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} - pathType: {{ .pathType }} - {{- end }} - backend: - {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - service: - name: {{ $fullName }}-endpoint - port: - number: {{ $svcPort }} - {{- else }} - serviceName: {{ $fullName }}-endpoint - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/deploy/templates/parser-deployment.yaml b/deploy/templates/parser-deployment.yaml deleted file mode 100644 index 94052ab..0000000 --- a/deploy/templates/parser-deployment.yaml +++ /dev/null @@ -1,64 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "mittaridatapumppu.fullname" . }}-parser - labels: - {{- include "mittaridatapumppu.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "mittaridatapumppu.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "mittaridatapumppu.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "mittaridatapumppu.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.parser.image.repository }}:{{ .Values.parser.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.parser.image.pullPolicy }} - ports: - - name: http - containerPort: {{ .Values.parser.service.port }} - protocol: TCP - # livenessProbe: - # httpGet: - # path: / - # port: http - # readinessProbe: - # httpGet: - # path: / - # port: http - resources: - {{- toYaml .Values.resources | nindent 12 }} - envFrom: - - configMapRef: - name: {{ include "mittaridatapumppu.fullname" . }}-configmap - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/deploy/templates/parser-service.yaml b/deploy/templates/parser-service.yaml deleted file mode 100644 index 71b9053..0000000 --- a/deploy/templates/parser-service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "mittaridatapumppu.fullname" . }}-parser - labels: - {{- include "mittaridatapumppu.labels" . | nindent 4 }} -spec: - type: {{ .Values.parser.service.type }} - ports: - - port: {{ .Values.parser.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "mittaridatapumppu.selectorLabels" . | nindent 4 }} diff --git a/deploy/templates/persister-deployment.yaml b/deploy/templates/persister-deployment.yaml deleted file mode 100644 index afe8804..0000000 --- a/deploy/templates/persister-deployment.yaml +++ /dev/null @@ -1,64 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "mittaridatapumppu.fullname" . }}-persister - labels: - {{- include "mittaridatapumppu.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "mittaridatapumppu.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "mittaridatapumppu.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "mittaridatapumppu.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.persister.image.repository }}:{{ .Values.persister.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.persister.image.pullPolicy }} - ports: - - name: http - containerPort: {{ .Values.persister.service.port }} - protocol: TCP - # livenessProbe: - # httpGet: - # path: / - # port: http - # readinessProbe: - # httpGet: - # path: / - # port: http - resources: - {{- toYaml .Values.resources | nindent 12 }} - envFrom: - - configMapRef: - name: {{ include "mittaridatapumppu.fullname" . }}-configmap - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/deploy/templates/persister-service.yaml b/deploy/templates/persister-service.yaml deleted file mode 100644 index a4ab4ad..0000000 --- a/deploy/templates/persister-service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "mittaridatapumppu.fullname" . }}-persister - labels: - {{- include "mittaridatapumppu.labels" . | nindent 4 }} -spec: - type: {{ .Values.persister.service.type }} - ports: - - port: {{ .Values.persister.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "mittaridatapumppu.selectorLabels" . | nindent 4 }} diff --git a/deploy/templates/serviceaccount.yaml b/deploy/templates/serviceaccount.yaml deleted file mode 100644 index 80bf02f..0000000 --- a/deploy/templates/serviceaccount.yaml +++ /dev/null @@ -1,12 +0,0 @@ -{{- if .Values.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "mittaridatapumppu.serviceAccountName" . }} - labels: - {{- include "mittaridatapumppu.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} diff --git a/deploy/templates/tests/test-connection.yaml b/deploy/templates/tests/test-connection.yaml deleted file mode 100644 index 27c8ae4..0000000 --- a/deploy/templates/tests/test-connection.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "mittaridatapumppu.fullname" . }}-endpoint-test-connection" - labels: - {{- include "mittaridatapumppu.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": test -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "mittaridatapumppu.fullname" . }}-endpoint:{{ .Values.endpoint.service.port }}'] - restartPolicy: Never diff --git a/deploy/values.yaml b/deploy/values.yaml deleted file mode 100644 index 7db0e69..0000000 --- a/deploy/values.yaml +++ /dev/null @@ -1,150 +0,0 @@ -# Default values for mittaridatapumppu. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - - -endpoint: - replicaCount: 3 - image: - repository: ghcr.io/city-of-helsinki/mittaridatapumppu-endpoint - pullPolicy: Always - # pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "v0.1.1" - service: - type: ClusterIP - port: 80 - allowedIpAddresses: 127.0.0.1 - endpointConfigUrl: http://deviceregistry:8000/api/v1/hosts/localhost/ - -deviceregistry: - replicaCount: 1 - image: - repository: ghcr.io/city-of-helsinki/mittaridatapumppu-deviceregistry - pullPolicy: Always - # pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "v0.1.1" - service: - type: ClusterIP - port: 80 - djangoSettingsModule: "deviceregistry.settings" - databaseHost: "postgresql" - databaseUser: "postgres" - databasePassword: "postgres" - databasePort: "5432" - allowedHosts: - - localhost - secretKey: "django-insecure-vz&7byj9esv1ncrv(7805g7w%h+-(-k_q82q(woh%1pcxr)^jf" - -parser: - replicaCount: 1 - image: - repository: ghcr.io/city-of-helsinki/mittaridatapumppu-parser - # pullPolicy: IfNotPresent - pullPolicy: Always - # Overrides the image tag whose default is the chart appVersion. - tag: "v0.1.1" - service: - type: ClusterIP - port: 80 - deviceRegistryUrl: "http://deviceregistry/api/v1" - deviceRegistryToken: "1e172012b4404fc4b3d051710f8232a422fa8eaa" - -persister: - replicaCount: 1 - image: - repository: ghcr.io/city-of-helsinki/mittaridatapumppu-persister - # pullPolicy: IfNotPresent - pullPolicy: Always - # Overrides the image tag whose default is the chart appVersion. - tag: "v0.1.1" - service: - type: ClusterIP - port: 80 - deviceRegistryUrl: "http://deviceregistry/api/v1" - deviceRegistryToken: "1e172012b4404fc4b3d051710f8232a422fa8eaa" - influxBucket: "devbucket" - influxHost: "http://influxdb2:8086" - influxOrg: "Development" - influxToken: "insercure-token-for-development-and-testing-purposes-only-KxU4jAU23H3vTk" - -kafka: - kafkaHost: "kafka-kafka-bootstrap" - kafkaPort: "9092" - kafkaBootstrapServers: "kafka-kafka-bootstrap:9092" - kafkaGroupId: "digita_dev" - kafkaParsedDataTopicName: "digita.parseddata" - kafkaRawDataTopicName: "digita.rawdata" - -postgresql: - enabled: true - auth: - postgresPassword: "postgres" - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -serviceAccount: - # Specifies whether a service account should be created - create: true - # Annotations to add to the service account - annotations: {} - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template - name: "" - -podAnnotations: {} - -podSecurityContext: {} - # fsGroup: 2000 - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -ingress: - enabled: false - className: "" - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: endpoint.local - paths: - - path: / - pathType: ImplementationSpecific - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - -nodeSelector: {} - -tolerations: [] - -affinity: {} diff --git a/mittaridatapumppu-deviceregistry/deviceregistry/__init__.py b/deviceregistry/__init__.py similarity index 100% rename from mittaridatapumppu-deviceregistry/deviceregistry/__init__.py rename to deviceregistry/__init__.py diff --git a/mittaridatapumppu-deviceregistry/deviceregistry/asgi.py b/deviceregistry/asgi.py similarity index 100% rename from mittaridatapumppu-deviceregistry/deviceregistry/asgi.py rename to deviceregistry/asgi.py diff --git a/mittaridatapumppu-deviceregistry/deviceregistry/settings.py b/deviceregistry/settings.py similarity index 100% rename from mittaridatapumppu-deviceregistry/deviceregistry/settings.py rename to deviceregistry/settings.py diff --git a/mittaridatapumppu-deviceregistry/deviceregistry/urls.py b/deviceregistry/urls.py similarity index 100% rename from mittaridatapumppu-deviceregistry/deviceregistry/urls.py rename to deviceregistry/urls.py diff --git a/mittaridatapumppu-deviceregistry/deviceregistry/utils/__init__.py b/deviceregistry/utils/__init__.py similarity index 100% rename from mittaridatapumppu-deviceregistry/deviceregistry/utils/__init__.py rename to deviceregistry/utils/__init__.py diff --git a/mittaridatapumppu-deviceregistry/deviceregistry/utils/models.py b/deviceregistry/utils/models.py similarity index 100% rename from mittaridatapumppu-deviceregistry/deviceregistry/utils/models.py rename to deviceregistry/utils/models.py diff --git a/mittaridatapumppu-deviceregistry/deviceregistry/utils/views.py b/deviceregistry/utils/views.py similarity index 100% rename from mittaridatapumppu-deviceregistry/deviceregistry/utils/views.py rename to deviceregistry/utils/views.py diff --git a/mittaridatapumppu-deviceregistry/deviceregistry/wsgi.py b/deviceregistry/wsgi.py similarity index 100% rename from mittaridatapumppu-deviceregistry/deviceregistry/wsgi.py rename to deviceregistry/wsgi.py diff --git a/mittaridatapumppu-deviceregistry/devices/__init__.py b/devices/__init__.py similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/__init__.py rename to devices/__init__.py diff --git a/mittaridatapumppu-deviceregistry/devices/admin.py b/devices/admin.py similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/admin.py rename to devices/admin.py diff --git a/mittaridatapumppu-deviceregistry/devices/apps.py b/devices/apps.py similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/apps.py rename to devices/apps.py diff --git a/mittaridatapumppu-deviceregistry/devices/fixtures/auth.json b/devices/fixtures/auth.json similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/fixtures/auth.json rename to devices/fixtures/auth.json diff --git a/mittaridatapumppu-deviceregistry/devices/fixtures/authtoken.json b/devices/fixtures/authtoken.json similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/fixtures/authtoken.json rename to devices/fixtures/authtoken.json diff --git a/mittaridatapumppu-deviceregistry/devices/fixtures/endpoints.json b/devices/fixtures/endpoints.json similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/fixtures/endpoints.json rename to devices/fixtures/endpoints.json diff --git a/mittaridatapumppu-deviceregistry/devices/fixtures/initialdata.json b/devices/fixtures/initialdata.json similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/fixtures/initialdata.json rename to devices/fixtures/initialdata.json diff --git a/mittaridatapumppu-deviceregistry/devices/migrations/0001_initial.py b/devices/migrations/0001_initial.py similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/migrations/0001_initial.py rename to devices/migrations/0001_initial.py diff --git a/mittaridatapumppu-deviceregistry/devices/migrations/__init__.py b/devices/migrations/__init__.py similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/migrations/__init__.py rename to devices/migrations/__init__.py diff --git a/mittaridatapumppu-deviceregistry/devices/models.py b/devices/models.py similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/models.py rename to devices/models.py diff --git a/mittaridatapumppu-deviceregistry/devices/scripts/populate_db_via_api.py b/devices/scripts/populate_db_via_api.py similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/scripts/populate_db_via_api.py rename to devices/scripts/populate_db_via_api.py diff --git a/mittaridatapumppu-deviceregistry/devices/scripts/test-devices.csv b/devices/scripts/test-devices.csv similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/scripts/test-devices.csv rename to devices/scripts/test-devices.csv diff --git a/mittaridatapumppu-deviceregistry/devices/serializers.py b/devices/serializers.py similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/serializers.py rename to devices/serializers.py diff --git a/mittaridatapumppu-deviceregistry/devices/tests/test_api_device.py b/devices/tests/test_api_device.py similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/tests/test_api_device.py rename to devices/tests/test_api_device.py diff --git a/mittaridatapumppu-deviceregistry/devices/tests/test_api_devicetype.py b/devices/tests/test_api_devicetype.py similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/tests/test_api_devicetype.py rename to devices/tests/test_api_devicetype.py diff --git a/mittaridatapumppu-deviceregistry/devices/tests/test_model.py b/devices/tests/test_model.py similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/tests/test_model.py rename to devices/tests/test_model.py diff --git a/mittaridatapumppu-deviceregistry/devices/tests/test_modeladmin.py b/devices/tests/test_modeladmin.py similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/tests/test_modeladmin.py rename to devices/tests/test_modeladmin.py diff --git a/mittaridatapumppu-deviceregistry/devices/tests/testresources/testimage.jpeg b/devices/tests/testresources/testimage.jpeg similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/tests/testresources/testimage.jpeg rename to devices/tests/testresources/testimage.jpeg diff --git a/mittaridatapumppu-deviceregistry/devices/views.py b/devices/views.py similarity index 100% rename from mittaridatapumppu-deviceregistry/devices/views.py rename to devices/views.py diff --git a/mittaridatapumppu-deviceregistry/endpoints/__init__.py b/endpoints/__init__.py similarity index 100% rename from mittaridatapumppu-deviceregistry/endpoints/__init__.py rename to endpoints/__init__.py diff --git a/mittaridatapumppu-deviceregistry/endpoints/admin.py b/endpoints/admin.py similarity index 100% rename from mittaridatapumppu-deviceregistry/endpoints/admin.py rename to endpoints/admin.py diff --git a/mittaridatapumppu-deviceregistry/endpoints/apps.py b/endpoints/apps.py similarity index 100% rename from mittaridatapumppu-deviceregistry/endpoints/apps.py rename to endpoints/apps.py diff --git a/mittaridatapumppu-deviceregistry/endpoints/migrations/0001_initial.py b/endpoints/migrations/0001_initial.py similarity index 100% rename from mittaridatapumppu-deviceregistry/endpoints/migrations/0001_initial.py rename to endpoints/migrations/0001_initial.py diff --git a/mittaridatapumppu-deviceregistry/endpoints/migrations/__init__.py b/endpoints/migrations/__init__.py similarity index 100% rename from mittaridatapumppu-deviceregistry/endpoints/migrations/__init__.py rename to endpoints/migrations/__init__.py diff --git a/mittaridatapumppu-deviceregistry/endpoints/models.py b/endpoints/models.py similarity index 100% rename from mittaridatapumppu-deviceregistry/endpoints/models.py rename to endpoints/models.py diff --git a/mittaridatapumppu-deviceregistry/endpoints/serializers.py b/endpoints/serializers.py similarity index 99% rename from mittaridatapumppu-deviceregistry/endpoints/serializers.py rename to endpoints/serializers.py index 84426cf..41569fa 100644 --- a/mittaridatapumppu-deviceregistry/endpoints/serializers.py +++ b/endpoints/serializers.py @@ -3,8 +3,6 @@ from .models import Host, Endpoint - - class EndpointSerializer(serializers.ModelSerializer): class Meta: model = Endpoint @@ -15,6 +13,7 @@ class Meta: class HostSerializer(serializers.ModelSerializer): endpoints = EndpointSerializer(many=True, read_only=True) + class Meta: model = Host lookup_field = "slug" # Use slug instead of pk diff --git a/mittaridatapumppu-deviceregistry/endpoints/tests.py b/endpoints/tests.py similarity index 100% rename from mittaridatapumppu-deviceregistry/endpoints/tests.py rename to endpoints/tests.py diff --git a/mittaridatapumppu-deviceregistry/endpoints/views.py b/endpoints/views.py similarity index 100% rename from mittaridatapumppu-deviceregistry/endpoints/views.py rename to endpoints/views.py diff --git a/entrypoint.sh b/entrypoint.sh index a7b9502..16b5e51 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,9 @@ #!/bin/sh python manage.py migrate +if [ "$ENV" = "development" ]; then + python manage.py createsuperuser --noinput + python manage.py loaddata devices/fixtures/* +fi + exec "$@" diff --git a/fvhiot-python b/fvhiot-python deleted file mode 160000 index 677797f..0000000 --- a/fvhiot-python +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 677797fa6e86a3d37b43cab53edb659418b7f256 diff --git a/mittaridatapumppu-deviceregistry/manage.py b/manage.py similarity index 100% rename from mittaridatapumppu-deviceregistry/manage.py rename to manage.py diff --git a/mittaridatapumppu-endpoint b/mittaridatapumppu-endpoint deleted file mode 160000 index e71bd8f..0000000 --- a/mittaridatapumppu-endpoint +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e71bd8f5a24d5ff8b5cd07cd4f67e5f5d15f20d8 diff --git a/mittaridatapumppu-parser b/mittaridatapumppu-parser deleted file mode 160000 index 9510b50..0000000 --- a/mittaridatapumppu-parser +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9510b5071db9a59683d901796eb161bc066004a3 diff --git a/mittaridatapumppu-persister b/mittaridatapumppu-persister deleted file mode 160000 index b7086fa..0000000 --- a/mittaridatapumppu-persister +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b7086fa1c4d32f7ea4185be4f3c64ba0f596c634 diff --git a/pyproject.toml b/pyproject.toml index 9dff14b..4abf763 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,10 +75,8 @@ remove-unused-variables = true exclude = ["migrations", "venv"] [tool.pytest.ini_options] -pythonpath = "mittaridatapumppu-deviceregistry" DJANGO_SETTINGS_MODULE = "deviceregistry.settings" log_cli = 1 log_cli_level = 20 -testpaths = ["mittaridatapumppu-deviceregistry/devices/tests"] +testpaths = ["devices/tests"] addopts = ["--color=yes"] -